docs: add /docs living documentation per AGENT.MD
- docs/README.md: navigation hub - docs/architecture.md: system overview, tech stack, data flows, ports - docs/backend/: supabase-core, schema, rpcs, rls, seed, docker - docs/frontend/: app-structure, screens, api-client - docs/next-steps.md: Phase 2/3/4 plan + open decisions - Fix README demo-account emails to match the actual seed Co-authored-by: Stephan Charles <[email protected]> Co-authored-by: Amelia Hernandez <[email protected]> Co-authored-by: Markus Franz <[email protected]> Co-authored-by: Sabrina Hota <[email protected]> Co-authored-by: Nilüfer Doğan <[email protected]>
This commit is contained in:
1 parent
63aa4ecfc8
commit
33c058b5ee
16 files changed
+1494
-7
No files matched your search
@@ -0,0 +1,38 @@
|
||||
# Backend — Supabase Core
|
||||
|
||||
Convivo has **no custom backend**. The entire server side is a **local Supabase
|
||||
stack** (run with the Supabase CLI) plus the schema, RPCs, and RLS that live in
|
||||
Postgres. This folder documents that core.
|
||||
|
||||
| File | What it covers |
|
||||
|---|---|
|
||||
| [supabase-core.md](./supabase-core.md) | The local stack: containers, ports, how to start/reset, config |
|
||||
| [schema.md](./schema.md) | All 9 tables, columns, constraints, indexes |
|
||||
| [rpcs.md](./rpcs.md) | The transactional points RPCs (the business logic) |
|
||||
| [rls.md](./rls.md) | Row Level Security policies + which key the app uses |
|
||||
| [seed.md](./seed.md) | Seed data + the 13 demo accounts |
|
||||
| [docker.md](./docker.md) | Docker: the app image + root compose (how the core + app run together) |
|
||||
|
||||
## The big picture
|
||||
|
||||
```
|
||||
Postgres 17 ── schema (9 tables)
|
||||
── RLS (who can read/write what)
|
||||
── RPCs (security definer, transactional points logic)
|
||||
── seed (demo data)
|
||||
```
|
||||
|
||||
- **Data + logic live in the database.** The app never computes points or writes
|
||||
to `profiles.points` directly — it calls RPCs, and Postgres enforces the rules.
|
||||
- **RLS is the security boundary.** The app uses the **anon key + the user's
|
||||
session JWT**; RLS decides what that user may see and do. The service-role key
|
||||
is never shipped to the app. See [rls.md](./rls.md).
|
||||
- **Points are transactional.** Each RPC updates points, inserts the related row,
|
||||
and re-syncs the `leaderboard` mirror in **one transaction**, so the leaderboard
|
||||
is always consistent and duplicate actions never double-award. See [rpcs.md](./rpcs.md).
|
||||
|
||||
## Source of truth
|
||||
|
||||
- Schema + RPCs + RLS: [`supabase/migrations/20260822000000_init.sql`](../../supabase/migrations/20260822000000_init.sql)
|
||||
- Seed: [`supabase/seed.sql`](../../supabase/seed.sql)
|
||||
- Stack config: [`supabase/config.toml`](../../supabase/config.toml)
|
||||
Reference in new issue
Block a user