KitRocket

Environment Setup

Configure every service KitRocket connects to — database, auth, payments, email, and more.

KitRocket uses environment variables for all service configuration. Copy the template and fill in each value:

cp .env.example .env.local

Here's every variable, grouped by service.

Database (Supabase)

KitRocket uses Supabase Postgres via Drizzle ORM.

  1. Go to supabase.com and create a new project
  2. Navigate to Project Settings > Database
  3. Copy the Connection string (URI format)
DATABASE_URL="postgresql://postgres.[project-ref]:[password]@aws-0-[region].pooler.supabase.com:6543/postgres"

Use the Transaction connection pooler (port 6543) for serverless environments like Vercel.

Authentication (Better Auth)

Better Auth handles all authentication flows.

Auth secret

Generate a random secret for session signing:

openssl rand -base64 32
AUTH_SECRET="your-generated-secret"
BETTER_AUTH_URL="http://localhost:3000"

Set BETTER_AUTH_URL to your production domain when deploying.

Google OAuth

  1. Go to Google Cloud Console
  2. Create a new OAuth 2.0 Client ID
  3. Set Authorized redirect URI to http://localhost:3000/api/auth/callback/google
GOOGLE_CLIENT_ID="your-google-client-id"
GOOGLE_CLIENT_SECRET="your-google-client-secret"

GitHub OAuth

  1. Go to GitHub Developer Settings
  2. Create a new OAuth App
  3. Set Authorization callback URL to http://localhost:3000/api/auth/callback/github
GITHUB_CLIENT_ID="your-github-client-id"
GITHUB_CLIENT_SECRET="your-github-client-secret"

Payments (DodoPayments)

DodoPayments is a Merchant of Record — it handles sales tax, VAT, and compliance so you don't have to.

  1. Create an account at dodopayments.com
  2. Navigate to API Keys in the dashboard
  3. Copy your API key
DODO_API_KEY="your-dodo-api-key"
DODO_WEBHOOK_SECRET="your-dodo-webhook-secret"

Set up webhook

  1. Go to Webhooks in the DodoPayments dashboard
  2. Add endpoint URL: https://yourdomain.com/api/webhook/dodo
  3. Select events: payment.completed, subscription.created, subscription.updated, subscription.cancelled
  4. Copy the webhook signing secret

Create products

  1. Go to Products in the DodoPayments dashboard
  2. Create your subscription plans (e.g., Starter, Pro)
  3. Note the product and price IDs
DODO_STARTER_PRICE_ID="price_starter_monthly"
DODO_PRO_PRICE_ID="price_pro_monthly"

Email (Resend)

Resend powers transactional emails with React Email templates.

  1. Create an account at resend.com
  2. Go to API Keys and create a new key
  3. Verify your sending domain under Domains
RESEND_API_KEY="re_your-api-key"
EMAIL_FROM="noreply@yourdomain.com"

For local development, you can use Resend's test domain — emails show up in the Resend dashboard but aren't delivered.

Analytics (PostHog) — Pro

PostHog provides event tracking, feature flags, and session recording.

  1. Create a project at posthog.com
  2. Go to Project Settings
  3. Copy the API key and host URL
NEXT_PUBLIC_POSTHOG_KEY="phc_your-posthog-key"
NEXT_PUBLIC_POSTHOG_HOST="https://us.i.posthog.com"

These are NEXT_PUBLIC_ variables because the PostHog client runs in the browser.

AI (Claude / OpenAI) — Pro

The AI module supports both Anthropic Claude and OpenAI.

Anthropic Claude

  1. Get an API key at console.anthropic.com
ANTHROPIC_API_KEY="sk-ant-your-api-key"

OpenAI

  1. Get an API key at platform.openai.com
OPENAI_API_KEY="sk-your-api-key"

Set the provider you want to use:

AI_PROVIDER="anthropic"  # or "openai"
AI_MODEL="claude-sonnet-4-20250514"  # or "gpt-4o"

Full .env.example reference

# Database
DATABASE_URL=

# Auth
AUTH_SECRET=
BETTER_AUTH_URL=http://localhost:3000
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=

# Payments
DODO_API_KEY=
DODO_WEBHOOK_SECRET=
DODO_STARTER_PRICE_ID=
DODO_PRO_PRICE_ID=

# Email
RESEND_API_KEY=
EMAIL_FROM=

# Analytics (Pro)
NEXT_PUBLIC_POSTHOG_KEY=
NEXT_PUBLIC_POSTHOG_HOST=

# AI (Pro)
AI_PROVIDER=anthropic
AI_MODEL=claude-sonnet-4-20250514
ANTHROPIC_API_KEY=
OPENAI_API_KEY=

Next steps

On this page