Next.js + Supabase
structuralNext.js App Router front-end against Supabase (Postgres + Auth + Storage). Row-Level Security policies enforce per-workspace tenancy. Inngest runs scheduled email sequences.
For spec: CRM Platform
Packages
next^15@supabase/supabase-js^2inngest— Scheduled email sequencesEnvironment
NEXT_PUBLIC_SUPABASE_URLrequiredNEXT_PUBLIC_SUPABASE_ANON_KEYrequiredSUPABASE_SERVICE_ROLE_KEYrequiredFeature implementations
Audit Logging
audit-loggingPostgres trigger writes to audit_log on changes to tenant tables.
Tables
audit_log8 fieldsidbigintworkspace_iduuidactor_iduuidactiontexttarget_tabletexttarget_idtextdiffjsonbcreated_attimestamptz
File Storage
file-storageSupabase Storage bucket per workspace. Signed URLs for downloads.
Notifications
notificationsIn-app toasts + digest emails via Resend + Inngest cron.
Tables
notifications5 fieldsiduuiduser_iduuidkindtextpayloadjsonbread_attimestamptz
Roles & Permissions
roles-permissionsRLS policies on every tenant table: USING (workspace_id IN (SELECT ...)).
Policies live in `supabase/migrations/*_rls.sql`. Keep them in sync with any new tenant-scoped table.
Search
searchPostgres tsvector over contact.name, company.name, deal.title.
Routes
/searchTransactional Email
transactional-emailResend for single sends; Inngest functions for sequences.
Modules
inngest/functions/email-sequence.ts— N-step drip campaign
User System & Auth
user-systemSupabase Auth; a workspaces table + workspace_members for team access.
Tables
workspaces3 fieldsiduuidnametextowner_iduuid
workspace_members3 fieldsworkspace_iduuiduser_iduuidroletext
Uncovered features
The spec includes features this implementation doesn't describe. Contributions welcome.