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 .env

Environment Variables

Core Configuration

VariableDescription
APP_ENVSet to local for development, production for production
NEXT_PUBLIC_APP_URLYour 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.

VariableDescription
DATABASE_TYPEDatabase type: postgresql (default) or mysql
DATABASE_URLDatabase connection URL

Authentication

Learn how to set up authentication in the Authentication Setup guide.

VariableDescription
BETTER_AUTH_SECRETA random 32+ character string for encryption. Generate with VictoryHub
NEXT_PUBLIC_MAGIC_LINK_ENABLEDEnable magic link login (true / false)
NEXT_PUBLIC_GOOGLE_CLIENT_IDGoogle OAuth client ID (optional)
GOOGLE_CLIENT_SECRETGoogle OAuth client secret (optional)
NEXT_PUBLIC_GITHUB_CLIENT_IDGitHub OAuth client ID (optional)
GITHUB_CLIENT_SECRETGitHub OAuth client secret (optional)

Admin User

VariableDescription
ADMIN_IDUUID for admin user. Generate at VictoryHub
ADMIN_EMAILAdmin email address
ADMIN_PASSWORDAdmin password

Email

Learn how to set up email in the Email Setup guide.

VariableDescription
RESEND_API_KEYAPI key from Resend
RESEND_FROM_EMAILSender email (use [email protected] for testing)
RESEND_AUDIENCE_NEWSLETTERResend Audience ID for newsletter (optional)
RESEND_AUDIENCE_WAITLISTResend Audience ID for waitlist (optional)

Payment

Learn how to set up payments in the Payment Setup guide.

VariableDescription
STRIPE_SECRET_KEYStripe secret key (sk_test_... or sk_live_...)
STRIPE_WEBHOOK_SECRETStripe webhook signing secret (whsec_...)

Captcha (Optional)

VariableDescription
NEXT_PUBLIC_CAPTCHA_PROVIDERProvider: cloudflare-turnstile, hcaptcha, or captchafox
NEXT_PUBLIC_CAPTCHA_PUBLIC_KEYCaptcha site key
CAPTCHA_SECRET_KEYCaptcha secret key

Storage (Optional)

VariableDescription
NEXT_PUBLIC_STORAGE_ENABLEDEnable storage (true / false)
STORAGE_PROVIDERStorage provider (currently s3)
STORAGE_ACCESS_KEY_IDS3 access key ID
STORAGE_SECRET_ACCESS_KEYS3 secret access key
STORAGE_BUCKETS3 bucket name
STORAGE_REGIONS3 region
STORAGE_API_ENDPOINTS3 API endpoint
STORAGE_PUBLIC_ENDPOINTS3 public endpoint URL

Analytics (Optional)

VariableDescription
NEXT_PUBLIC_GOOGLE_ANALYTICS_IDGoogle Analytics ID
NEXT_PUBLIC_OPENPANEL_CLIENT_IDOpenPanel client ID
NEXT_PUBLIC_PLAUSIBLE_DOMAINPlausible domain
NEXT_PUBLIC_UMAMI_WEBSITE_IDUmami website ID
NEXT_PUBLIC_UMAMI_URLUmami script URL
NEXT_PUBLIC_POSTHOG_KEYPostHog API key
NEXT_PUBLIC_POSTHOG_HOSTPostHog host URL
NEXT_PUBLIC_VERCEL_ANALYTICS_ENABLEDEnable Vercel Analytics (true / false)

GitHub Integration (Optional)

For automatic repository access on payment completion:

VariableDescription
GITHUB_INTEGRATION_ENABLEDEnable GitHub integration (true / false)
GITHUB_TOKENGitHub Personal Access Token with admin:org and repo scopes
GITHUB_REPORepository in format owner/repo

Verifying Environment Variables

To verify that your environment variables are correctly set up, run:

npm run dev

If everything is configured correctly, your application should start without any environment-related errors.

Next Steps