The four config layers
- Env Variables
- Database Schema
- Site Config
- App Tool Config
.env.example is the source of truth. pnpm bootstrap generates a working .env.local from it.This is where you configure:- Auth (Better Auth secret, URLs)
- Database (
DATABASE_URL) - AI provider keys
- Payments
- Analytics
- Storage
- Meta attribution
- Sentry
Env var reference
Core (required)
Core (required)
These are the bare minimum to run the app:Plus at least one AI provider:
Auth
Auth
Email/password works with just For Loops auth-email templates:
BETTER_AUTH_SECRET.For magic links and forgot password, add:NEXT_PUBLIC_EMAIL_PROVIDER controls whether the auth UI shows magic-link and reset-password modes. EMAIL_PROVIDER is the server-side provider selection.For Google OAuth:Database
Database
- Use
pnpm db:migrateto apply schema changes - Use
pnpm db:generateto create SQL after schema edits - Keep custom SQL migrations small and focused
AI Providers
AI Providers
You only need the providers you plan to use:
PDF RAG requires OpenAI for embeddings. Image/video generation often needs Replicate. Voice needs ElevenLabs.
Storage
Storage
Required for uploads, file-backed workflows, and generated assets:Without storage, these features won’t work: chat file upload, PDF flows, image/video/voice outputs, vision uploads.
Payments
Payments
STRIPE_SECRET_KEY+STRIPE_WEBHOOK_SECRETLEMON_SQUEEZY_WEBHOOK_SECRETPOLAR_WEBHOOK_SECRET
Email
loops, resend, or brevo when you want auth emails or contact sync. Then add the matching key:LOOPS_API_KEYRESEND_API_KEYBREVO_API_KEY
AUTH_EMAIL_FROM (required) and AUTH_EMAIL_REPLY_TO (optional).Analytics
Analytics
One or more providers, comma-separated:Then configure the specific provider env vars. See Analytics for details.
Meta Attribution
Meta Attribution
Optional — only if you run Meta Ads:
Sentry
Sentry
Recommended setup order
Don’t try to fill every env var at once. Go in this order:Common mistakes to avoid
Common mistakes to avoid
- Using
.envinstead of.env.local - Missing
BETTER_AUTH_SECRET - Forgetting
DATABASE_URL - Enabling email auth flows without
AUTH_EMAIL_FROM - Enabling provider features without the matching API key
- Expecting uploads to work without storage configured
- Setting payment env vars but forgetting checkout URLs
- Editing generated SQL by hand instead of updating
lib/db/schema/* - Forgetting that
NEXT_PUBLIC_APP_URLaffects auth redirects
Get Started
Follow the setup guide first.
Troubleshooting
Something not working? Check here.
Launch Checklist
Ready to ship? Verify everything.

