Overview
aSaaSin uses several external services that require configuration via environment variables. These variables are stored in a .env
file at the root of your project.
Environment variables are not committed to Git. Each developer must set them individually.
Create .env
# Create a copy of the example file
cp .env.example .env
The .env.example
file contains all required variables as empty keys. After copying, replace them with your own project-specific values.
# General
NEXT_PUBLIC_APP_URL=http://localhost:3000
# Feature flags
ENABLE_AUTH=false
ENABLE_SUPABASE=false
ENABLE_RESEND=false
ENABLE_OPENAI=false
ENABLE_POLAR=false
ENABLE_MAINTENANCE=false
# Google Analytics
NEXT_PUBLIC_GA_ID=
# Supabase
NEXT_PUBLIC_SUPABASE_URL=
NEXT_PUBLIC_SUPABASE_ANON_KEY=
SUPABASE_SERVICE_ROLE_KEY=
# Tina CMS
NEXT_PUBLIC_TINA_CLIENT_ID=
TINA_TOKEN=
TINA_SEARCH_TOKEN=
# Resend
RESEND_API_KEY=
RESEND_AUDIENCE_ID=
RESEND_NOTIFICATION_EMAIL=
# Polar
POLAR_API_KEY=
POLAR_WEBHOOK_SECRET=
POLAR_SUCCESS_URL=http://localhost:3000/success?checkout_id={CHECKOUT_ID}
# OpenAI
OPENAI_API_KEY=
Feature flags
Feature flags control optional integrations. All feature flags are server-only and not exposed to the client.
ENABLE_AUTH
→ Enables authentication pages and protected routes.ENABLE_SUPABASE
→ Enables database access and auth sessions (required ifENABLE_AUTH
is true).ENABLE_RESEND
→ Enables transactional email and newsletter audience management.ENABLE_OPENAI
→ Enables AI-powered helpers (branding, palettes, etc.).ENABLE_POLAR
→ Enables payments and subscription flow via Polar.ENABLE_MAINTENANCE
→ Enables maintenance mode to restrict access. Redirect all traffic to/maintenance
when set to true.
Variable reference
General
NEXT_PUBLIC_APP_URL
→ Base URL of your app (local or production).
Google Analytics
NEXT_PUBLIC_GA_ID
→ Google Analytics measurement ID (optional).
Supabase
NEXT_PUBLIC_SUPABASE_URL
→ Project API URL from Supabase dashboard.NEXT_PUBLIC_SUPABASE_ANON_KEY
→ Public anon key from Supabase project settings.SUPABASE_SERVICE_ROLE_KEY
→ Service role key (server-side only).
TinaCMS
NEXT_PUBLIC_TINA_CLIENT_ID
→ Client ID from Tina Cloud project.TINA_TOKEN
→ API token for content editing.TINA_SEARCH_TOKEN
→ Token for Tina search.
Resend
RESEND_API_KEY
→ API key from Resend dashboard.RESEND_AUDIENCE_ID
→ Audience list ID for newsletters.RESEND_NOTIFICATION_EMAIL
→ Default sender email for notifications.
Polar
POLAR_API_KEY
→ API key from Polar.POLAR_WEBHOOK_SECRET
→ Secret for validating webhook signatures.POLAR_SUCCESS_URL
→ Redirect after successful checkout, must includecheckout_id
placeholder, e.g.https://yourdomain.com/success?checkout_id={CHECKOUT_ID}
.
OpenAI
OPENAI_API_KEY
→ API key for AI features (branding, color palettes, etc.).