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.
- Go to supabase.com and create a new project
- Navigate to Project Settings > Database
- 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
- Go to Google Cloud Console
- Create a new OAuth 2.0 Client ID
- 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
- Go to GitHub Developer Settings
- Create a new OAuth App
- 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.
- Create an account at dodopayments.com
- Navigate to API Keys in the dashboard
- Copy your API key
DODO_API_KEY="your-dodo-api-key"
DODO_WEBHOOK_SECRET="your-dodo-webhook-secret"
Set up webhook
- Go to Webhooks in the DodoPayments dashboard
- Add endpoint URL:
https://yourdomain.com/api/webhook/dodo - Select events:
payment.completed,subscription.created,subscription.updated,subscription.cancelled - Copy the webhook signing secret
Create products
- Go to Products in the DodoPayments dashboard
- Create your subscription plans (e.g., Starter, Pro)
- 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.
- Create an account at resend.com
- Go to API Keys and create a new key
- 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.
- Create a project at posthog.com
- Go to Project Settings
- 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
- Get an API key at console.anthropic.com
ANTHROPIC_API_KEY="sk-ant-your-api-key"
OpenAI
- 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
- First Run — verify everything is connected
- Deployment — push to production on Vercel