LogoLaunchSaaS

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
NEXT_PUBLIC_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_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 (Optional)

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)

Newsletter (Optional)

Learn how to set up newsletter in the Newsletter Setup guide.

VariableDescription
RESEND_AUDIENCE_NEWSLETTERResend Audience ID for newsletter (optional)
RESEND_AUDIENCE_WAITLISTResend Audience ID for waitlist (optional)

Payment - Stripe (Optional)

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_...)

Payment - Creem (Optional)

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

VariableDescription
CREEM_API_KEYCreem API key
CREEM_WEBHOOK_SECRETCreem webhook signing secret

Captcha (Optional)

VariableDescription
NEXT_PUBLIC_CAPTCHA_PUBLIC_KEYCaptcha site key
CAPTCHA_SECRET_KEYCaptcha secret key

Storage (Optional)

Learn how to set up storage in the Storage Setup guide.

VariableDescription
S3_REGIONS3 region
S3_BUCKETS3 bucket name
S3_ACCESS_KEY_IDS3 access key ID
S3_SECRET_ACCESS_KEYS3 secret access key
S3_API_ENDPOINTS3 API endpoint
S3_PUBLIC_ENDPOINTS3 public endpoint URL

Cache (Optional)

Learn how to set up cache in the Cache Setup guide.

Redis (Standard)

For local Redis or managed Redis services (AWS ElastiCache, Azure Cache, etc.).

VariableDescription
REDIS_URLRedis connection URL (e.g., redis://localhost:6379 or rediss://...)

Upstash Redis

For Upstash Redis using HTTP REST API (perfect for serverless).

VariableDescription
UPSTASH_REDIS_REST_URLUpstash Redis REST endpoint
UPSTASH_REDIS_REST_TOKENUpstash Redis REST token

Cloudflare KV

VariableDescription
CLOUDFLARE_ACCOUNT_IDCloudflare Account ID
CLOUDFLARE_KV_NAMESPACE_IDCloudflare KV Namespace ID
CLOUDFLARE_API_TOKENCloudflare API Token

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)
NEXT_PUBLIC_AHREFS_ANALYTICS_ENABLEDEnable Ahrefs Analytics (true / false)

GitHub Integration (Optional)

For automatic repository access on payment completion. Enable in src/configuration/features.ts.

VariableDescription
GITHUB_TOKENGitHub Personal Access Token with admin:org and repo scopes
GITHUB_REPORepository in format owner/repo

Feature Configuration

LaunchSaaS uses a centralized feature configuration file at src/configuration/features.ts to control which providers are enabled:

export const features: Features = {
  email: {
    provider: "resend", // "resend" | "disabled"
  },
  newsletter: {
    provider: "resend", // "resend" | "disabled"
  },
  storage: {
    provider: "disabled", // "s3" | "disabled"
  },
  authentication: {
    magicLink: true,
    captcha: {
      enabled: true,
      provider: "cloudflare-turnstile",
    },
    oauths: {
      google: true,
      github: true,
    },
  },
  payment: {
    provider: "stripe", // "stripe" | "creem" | "disabled"
    hooks: {
      github: true, // Enable GitHub integration
      email: true, // Enable payment completion emails
    },
  },
};

Learn more in the Features Configuration guide.

Verifying Environment Variables

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

pnpm run dev

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

Next Steps