Supabase is the foundation of the app. It handles authentication, the main
Postgres database, and user/session data used across every product surface.
What Supabase Handles Here
- sign-in and session cookies
- user profiles and credits
- purchases and generations
- chat history and document metadata
Required Env Vars
Link Your Project
Auth URLs You Must Add
In SupabaseAuthentication -> URL Configuration, add:
- Site URL:
http://localhost:3000 - Redirect URL:
http://localhost:3000/auth/confirm
https://yourdomain.comhttps://yourdomain.com/auth/confirm
Auth Helpers In The Repo
The main server-side auth helpers live inlib/auth/server.ts.
Use these patterns:
getAuthContext()when auth is optionalrequireUser()in server pages and layoutsrequireApiUser()in API routessignOutCurrentSession()for logout flows
What The Setup Should Create
Afterpnpm exec supabase db push, you should have the tables needed for:
- profiles
- purchases
- generations
- chat and document data
- audio and other app-specific records
Verification
Your Supabase setup is correct if you can:- sign in on
/auth - reach
/home - see a profile row created for your user
- use at least one authenticated app flow
Authentication Setup
Need the exact auth flow, magic link setup, and Google OAuth steps?

