Architecture
Monorepo Structure
Tonnex uses Turborepo for monorepo management with pnpm workspaces.Data Flow
- User →
apps/web(Next.js) for UI interactions apps/web→ Server Actions for simple mutationsapps/web→ Proxy (/api/v1/*) →apps/api(NestJS) for business logicapps/api→@tonnex/db(Drizzle) → Supabase PostgreSQL- Supabase RLS ensures data isolation per
org_id
Authentication Flow
Multi-Tenancy
Every table hasorg_id. PostgreSQL Row Level Security (RLS) policies filter data automatically: