# Supabase Core — Local Stack The Supabase core is a set of Docker containers managed by the **Supabase CLI** (installed as a root devDependency — `npx supabase` works out of the box). It is the "main docker" of the project. ## Containers `supabase start` brings up the full local stack (project id `Convivo`): | Container | Image | Role | |---|---|---| | `supabase_db_Convivo` | `supabase/postgres:17` | Postgres 17 — schema, RLS, RPCs, data | | `supabase_auth_Convivo` | `supabase/gotrue` | Auth (QR + email login) | | `supabase_rest_Convivo` | `supabase/postgrest` | REST API over Postgres (tables + RPCs) | | `supabase_realtime_Convivo` | `supabase/realtime` | WebSocket realtime (leaderboard) | | `supabase_storage_Convivo` | `supabase/storage-api` | Storage — the `materials` bucket (session material) | | `supabase_kong_Convivo` | `supabase/kong` | **API gateway** — fronts everything on one port | | `supabase_studio_Convivo` | `supabase/studio` | Web UI (Studio) | | `supabase_inbucket_Convivo` | `supabase/mailpit` | Captures emails (none sent in this flow) | | `supabase_pg_meta_Convivo` | `supabase/postgres-meta` | Metadata API (used by Studio) | | `supabase_edge_runtime_Convivo` | `supabase/edge-runtime` | Edge functions (unused in v1) | | `supabase_vector_Convivo` | `supabase/vector` | Log shipping | | `supabase_analytics_Convivo` | `supabase/logflare` | Analytics | All containers share the external Docker network **`supabase_network_Convivo`** (named `supabase_network_`). The app sidecar joins this network — see [docker.md](./docker.md). ## Ports | Service | Host port | Container port | Notes | |---|---|---|---| | **API (Kong)** | **54321** | 8000 | The single gateway the app proxies to. **Inside the network, Kong is on 8000** — the `54321→8000` mapping is host-only. | | Studio | 54323 | 3000 | UI — login `postgres` / `postgres` | | Postgres | 54322 | 5432 | Direct DB — `postgres` / `postgres` | | SMTP (Mailpit) | 54324 | 8025 | Captures emails | | Analytics | 54327 | 4000 | Logflare | > **Gotcha:** from *inside* the shared network (e.g. the app container), reach > Kong at `supabase_kong_Convivo:8000`, **not** `:54321`. The `54321` port only > exists on the host. This is why the app's nginx proxies to > `supabase_kong_Convivo:8000` by default. ## How to run ```bash # Start the core (creates containers + the supabase_network_Convivo network) npm run db:start # = supabase start # (Re)apply migrations + seed, then restart the stack npm run db:reset # = supabase db reset (NOT `supabase reset`) # Stop the core npm run db:stop # = supabase stop # Show status / URLs / keys npx supabase status ``` - `db:reset` drops and recreates the database, applies **all** migrations in order (`20260822000000_init.sql` → `20260823000000_admin_app.sql` → [`20260824000000_redesign.sql`](../../supabase/migrations/20260824000000_redesign.sql), the last of which replaces the old schema), then runs [`seed.sql`](../../supabase/seed.sql). Use it any time you want a clean demo state. - Migrations and seed are **idempotent** (`on conflict ... do nothing`), so a reset is safe to repeat. ## Config highlights (`supabase/config.toml`) | Setting | Value | Why | |---|---|---| | `project_id` | `Convivo` | Names the Docker network + containers | | `[api] port` | `54321` | Kong gateway port | | `[db] port` | `54322` | Postgres port | | `[studio] port` | `54323` | Studio port | | `[auth.email] enable_confirmations` | `false` | **No email is sent** — the QR+email login never emails the user | | `[auth] jwt_expiry` | `86400` | **24-hour login** — the session JWT lives a full day | | `[auth] site_url` | `http://127.0.0.1:3000` | The app origin | | `[db.seed] sql_paths` | `["./seed.sql"]` | Seed runs on reset | ## Keys | Key | Value | Where it's used | |---|---|---| | **Anon key** | standard local anon JWT (see `apps/convivo/.env.example`) | **Ships in the app** (public by design) | | **Service-role key** | standard local service-role JWT | **Never in the app** — server-side only. The **sidecar** is its first consumer (see [sidecar.md](./sidecar.md)). | The app's security model (anon key + session JWT + RLS) is documented in [rls.md](./rls.md).