Environment Setup
Configure environment variables for your LaunchSaaS application
Environment Setup
LaunchSaaS requires several environment variables to function properly. This guide explains how to set them up.
Create a .env file in the root directory of your project, and never commit it to version control.
cp .env.example .envEnvironment Variables
Core Configuration
| Variable | Description |
|---|---|
APP_ENV | Set to local for development, production for production |
NEXT_PUBLIC_APP_URL | Your site URL (e.g., http://localhost:3000 for dev, https://yourdomain.com for prod) |
Database
Learn how to set up a database in the Database Setup guide.
| Variable | Description |
|---|---|
DATABASE_TYPE | Database type: postgresql (default) or mysql |
DATABASE_URL | Database connection URL |
Authentication
Learn how to set up authentication in the Authentication Setup guide.
| Variable | Description |
|---|---|
BETTER_AUTH_SECRET | A random 32+ character string for encryption. Generate with VictoryHub |
NEXT_PUBLIC_MAGIC_LINK_ENABLED | Enable magic link login (true / false) |
NEXT_PUBLIC_GOOGLE_CLIENT_ID | Google OAuth client ID (optional) |
GOOGLE_CLIENT_SECRET | Google OAuth client secret (optional) |
NEXT_PUBLIC_GITHUB_CLIENT_ID | GitHub OAuth client ID (optional) |
GITHUB_CLIENT_SECRET | GitHub OAuth client secret (optional) |
Admin User
| Variable | Description |
|---|---|
ADMIN_ID | UUID for admin user. Generate at VictoryHub |
ADMIN_EMAIL | Admin email address |
ADMIN_PASSWORD | Admin password |
Learn how to set up email in the Email Setup guide.
| Variable | Description |
|---|---|
RESEND_API_KEY | API key from Resend |
RESEND_FROM_EMAIL | Sender email (use [email protected] for testing) |
RESEND_AUDIENCE_NEWSLETTER | Resend Audience ID for newsletter (optional) |
RESEND_AUDIENCE_WAITLIST | Resend Audience ID for waitlist (optional) |
Payment
Learn how to set up payments in the Payment Setup guide.
| Variable | Description |
|---|---|
STRIPE_SECRET_KEY | Stripe secret key (sk_test_... or sk_live_...) |
STRIPE_WEBHOOK_SECRET | Stripe webhook signing secret (whsec_...) |
Captcha (Optional)
| Variable | Description |
|---|---|
NEXT_PUBLIC_CAPTCHA_PROVIDER | Provider: cloudflare-turnstile, hcaptcha, or captchafox |
NEXT_PUBLIC_CAPTCHA_PUBLIC_KEY | Captcha site key |
CAPTCHA_SECRET_KEY | Captcha secret key |
Storage (Optional)
| Variable | Description |
|---|---|
NEXT_PUBLIC_STORAGE_ENABLED | Enable storage (true / false) |
STORAGE_PROVIDER | Storage provider (currently s3) |
STORAGE_ACCESS_KEY_ID | S3 access key ID |
STORAGE_SECRET_ACCESS_KEY | S3 secret access key |
STORAGE_BUCKET | S3 bucket name |
STORAGE_REGION | S3 region |
STORAGE_API_ENDPOINT | S3 API endpoint |
STORAGE_PUBLIC_ENDPOINT | S3 public endpoint URL |
Analytics (Optional)
| Variable | Description |
|---|---|
NEXT_PUBLIC_GOOGLE_ANALYTICS_ID | Google Analytics ID |
NEXT_PUBLIC_OPENPANEL_CLIENT_ID | OpenPanel client ID |
NEXT_PUBLIC_PLAUSIBLE_DOMAIN | Plausible domain |
NEXT_PUBLIC_UMAMI_WEBSITE_ID | Umami website ID |
NEXT_PUBLIC_UMAMI_URL | Umami script URL |
NEXT_PUBLIC_POSTHOG_KEY | PostHog API key |
NEXT_PUBLIC_POSTHOG_HOST | PostHog host URL |
NEXT_PUBLIC_VERCEL_ANALYTICS_ENABLED | Enable Vercel Analytics (true / false) |
GitHub Integration (Optional)
For automatic repository access on payment completion:
| Variable | Description |
|---|---|
GITHUB_INTEGRATION_ENABLED | Enable GitHub integration (true / false) |
GITHUB_TOKEN | GitHub Personal Access Token with admin:org and repo scopes |
GITHUB_REPO | Repository in format owner/repo |
Verifying Environment Variables
To verify that your environment variables are correctly set up, run:
npm run devIf everything is configured correctly, your application should start without any environment-related errors.