Deployment
Environment setup, Supabase configuration, and deployment guide
Prerequisites
- Node.js 18 or higher
- npm or pnpm
- Supabase account
- PostgreSQL 15+ (via Supabase)
Environment Variables
Create a .env.local file (or use .env) with the following variables. See .env.example for reference.
Supabase
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
SUPABASE_SERVICE_ROLE_KEY=your-service-role-keyDomain
NEXT_PUBLIC_ROOT_DOMAIN=localhost:3000For production, set this to your root domain (e.g. platform.example.com).
Tenant
DEFAULT_TENANT_SLUG=codebase
NEXT_PUBLIC_DEFAULT_TENANT_SLUG=codebaseThe default tenant slug used when no subdomain is present.
Supabase Setup
- Create a new Supabase project at supabase.com
- Copy the project URL and anon key from Settings → API
- Copy the service role key from Settings → API (keep this secret)
- Run migrations to create the schema:
npx supabase db pushOr apply migrations manually via the Supabase SQL editor from supabase/migrations/.
Local Development
- Clone the repository
- Install dependencies:
npm install- Copy
.env.exampleto.env.localand fill in your Supabase credentials - Run migrations (if not already applied)
- Start the development server:
npm run devMulti-Tenant URLs
- Local:
{workspace}.localhost:3000(e.g.codebase.localhost:3000) - Production:
{workspace}.yourdomain.com - Vercel preview:
{workspace}---{branch}.vercel.app
Configure your DNS and Vercel project to support wildcard subdomains if needed.
Build
npm run buildProduction Deployment
The app is a standard Next.js application and can be deployed to:
- Vercel (recommended) — Next.js deployment docs
- Other platforms — Any Node.js host that supports Next.js
Vercel
- Connect your repository to Vercel
- Add environment variables in the Vercel project settings
- Deploy — Vercel will detect Next.js and build automatically
Environment Variables in Production
Ensure all variables from .env.example are set in your deployment platform. The service role key must never be exposed to the client.
Code Quality
Before committing:
npm exec -- ultracite fix # Format and auto-fix lint issues
npm exec -- ultracite check # Check without fixing