01 / Context
What this project is solving
SAWL began as a private chat product and grew into a small social platform: a public feed with posts, reactions, and threaded comments alongside realtime 1-to-1 messaging. The important product decision is also the security decision: conversations, membership, and messages are owned by Postgres policies rather than hidden client controls. A separate admin application runs moderation, content and username rules, feature flags, platform settings, analytics, and audit logs. The web applications deploy through Vercel, while the Supabase database and supporting services are self-hosted on a server with Docker, with nightly backups and a fully audited Row Level Security model.
02 / Architecture
How the system is arranged
app/
Next.js App Router: auth, feed, messenger, friends, profiles, notifications, settings, public post/profile pages, and API routes
components/
Feed, chat, people, profile, and settings components, with shared ui primitives (portal menus, lightbox, emoji and reaction pickers)
lib/
Supabase client/server/session helpers, conversations, messages, founding ranks, notification preferences, content domain, validation, and rate limiting
supabase/
75+ Postgres migrations — RLS policies, notification and moderation triggers, content-check functions — plus the delete-account Edge Function
admin panel
A separate Next.js app at admin.sawl.eddahby.me: users, reports, content & username rules, feature flags, platform settings, analytics, audit logs, system health
ops
Self-hosted Supabase on Docker (Oracle Cloud VM), nightly backups with 14-day retention, Vercel deployments for both apps
03 / Shipped
What made it into the build
- Public feed with posts, reactions, and threaded comments
- Realtime 1-to-1 messaging with reactions, pins, and mute
- A complete admin panel — moderation, feature flags, settings, analytics, audit logs
- Content safety: username rules and a flagged-content review queue
- Founding-member program with ranked badges for the first 100 members
- Link previews and share cards for posts and profiles
- Installable PWA with an offline fallback
- Row Level Security on every table, verified by a full audit; 136 automated tests
