Appearance
Integration: Supabase
Supabase is the backbone — PostgreSQL, Auth, Edge Functions (Deno), and Storage.
Client
A single browser client singleton lives at src/lib/supabaseClient.js. Never create additional clients. Admin-only features use src/lib/customSupabaseClient.js.
How it's used
| Capability | Where | Notes |
|---|---|---|
| Auth | src/contexts/SupabaseAuthContext.jsx → useAuth() | Session + user. EFs re-verify the JWT server-side. |
| Reads (RPC) | hooks | supabase.rpc('get_…'). See Data Access. |
| Writes (EF) | services | supabase.functions.invoke('…'). |
| Realtime | hooks | supabase.channel() for frequently-INSERTed tables. |
| Storage | EFs / specific features | e.g. trainer KYC documents. |
Two independent projects — Production and Dev/UAT
Since 2026-07-08 (NFX-027), Nefoxx runs two separate Supabase projects, not one shared backend:
| Project | Ref | Serves |
|---|---|---|
| Nefoxx-Prod | lyaldbfgdhxpllgxbcxp | nefoxx.com |
| Nefoxx-Dev | rchglrpywmxkcbmxcepl | devv.nefoxx.com, uatt.nefoxx.com, local npm run dev |
Every migration, Edge Function, secret, storage bucket, and cron job must be promoted to both — full rule, promotion runbook, and current parity status: Environment Strategy.
Local development
npx supabaseCLI runs a local stack (supabase start) for the E2E/local-Docker workflow — separate from both hosted projects above.- The CLI is linked to exactly one hosted project at a time (
supabase link --project-ref <ref>);npx supabase db push --linkedapplies local migrations to whichever project is currently linked — defaults to Nefoxx-Dev day-to-day, must be deliberately relinked to Nefoxx-Prod to promote a change. npm run test:dbruns pgTAP tests against the local DB.
Edge functions
67 functions under supabase/functions/, sharing _shared/ utilities, deployed to both projects. See Backend architecture and the EF index.
Hard rules
- No
supabase.from()anywhere insrc/. - RLS on every user-facing table; the EF is the primary enforcement layer.