My App

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-key

Domain

NEXT_PUBLIC_ROOT_DOMAIN=localhost:3000

For production, set this to your root domain (e.g. platform.example.com).

Tenant

DEFAULT_TENANT_SLUG=codebase
NEXT_PUBLIC_DEFAULT_TENANT_SLUG=codebase

The default tenant slug used when no subdomain is present.

Supabase Setup

  1. Create a new Supabase project at supabase.com
  2. Copy the project URL and anon key from Settings → API
  3. Copy the service role key from Settings → API (keep this secret)
  4. Run migrations to create the schema:
npx supabase db push

Or apply migrations manually via the Supabase SQL editor from supabase/migrations/.

Local Development

  1. Clone the repository
  2. Install dependencies:
npm install
  1. Copy .env.example to .env.local and fill in your Supabase credentials
  2. Run migrations (if not already applied)
  3. Start the development server:
npm run dev
  1. Open http://localhost:3000

Multi-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 build

Production Deployment

The app is a standard Next.js application and can be deployed to:

Vercel

  1. Connect your repository to Vercel
  2. Add environment variables in the Vercel project settings
  3. 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

On this page