Environment Variables
This page lists all environment variables with step-by-step instructions for obtaining each one.
For site branding, categories, pricing, and analytics setup, see Configuration.
Setup process
-
Copy the example environment file:
cp .env.example .env
-
Fill in each variable using the instructions below.
Database
- DATABASE_URL
-
PostgreSQL connection string for your database.
-
Development: Use the Docker setup from Quick Start
DATABASE_URL="postgresql://postgres:mypassword@localhost:5432/postgres"
-
Production: Copy from your provider (Supabase, Neon, Railway, etc.) See Deployment for more details.
-
Authentication (Better Auth)
-
BETTER_AUTH_SECRET
- Secret key for signing authentication tokens.
- How to get it: Generate a secure random string:
openssl rand -hex 32
- Important: Use a different value in production.
-
BETTER_AUTH_URL
- Public URL of your application.
- Development:
http://localhost:3000
- Production:
https://yourdomain.com
-
NEXT_PUBLIC_APP_URL
- Public URL used on the client side.
- Development:
http://localhost:3000
- Production:
https://yourdomain.com
Google OAuth
-
GOOGLE_CLIENT_ID
- Google OAuth client ID.
- How to get it:
- Go to Google Cloud Console
- Create a project, enable "OAuth 2.0 Client IDs"
- Add redirect URI:
http://localhost:3000/api/auth/callback/google
- Copy the "Client ID"
-
GOOGLE_CLIENT_SECRET
- Secret associated with your Google client.
- How to get it: Same place, copy the "Client Secret"
GitHub OAuth
-
GITHUB_CLIENT_ID
- GitHub OAuth client ID.
- How to get it:
- Go to GitHub Developer Settings > OAuth Apps
- Create "New OAuth App"
- Set callback URL:
http://localhost:3000/api/auth/callback/github
- Copy the "Client ID"
-
GITHUB_CLIENT_SECRET
- Secret associated with your GitHub client.
- How to get it: Same place, copy the "Client Secret"
Stripe (payments & subscriptions)
-
STRIPE_PUBLISHABLE_KEY
- Stripe publishable key for development.
- How to get it: Stripe Dashboard > Developers > API keys → Use test key
pk_test_...
-
STRIPE_SECRET_KEY
- Stripe API key for development.
- How to get it: Stripe Dashboard > Developers > API keys → Use test key
sk_test_...
-
STRIPE_WEBHOOK_SECRET
-
Stripe webhook signing secret for local testing.
-
How to get it: Use Stripe CLI for local development.
- In a new terminal, install and login to Stripe CLI (install instructions here):
stripe login
- Forward webhooks to your local server:
stripe listen --forward-to localhost:3000/api/auth/stripe/webhook
- Copy the webhook signing secret from the CLI output.
- In a new terminal, install and login to Stripe CLI (install instructions here):
Don't close the terminal, it's used to forward webhooks to your local server. If you close it, you will need to run the command again.
For complete setup details, see Better Auth Stripe Plugin Documentation.
-
-
STRIPE PRICE ID
- Price ID for each subscription plan.
- How to create products:
- Stripe Dashboard > Products > Create product
- Create 3 products: Starter, Plus, Max
- For each product, create 2 prices: Monthly and Yearly
- Copy each price ID (e.g.
price_1Nxxxxxx
)
Example product structure:
Starter Plan ├── Monthly: $5/month → price_1ABC123 └── Yearly: $50/year → price_1DEF456 Plus Plan ├── Monthly: $15/month → price_1GHI789 └── Yearly: $150/year → price_1JKL012 Max Plan ├── Monthly: $30/month → price_1MNO345 └── Yearly: $300/year → price_1PQR678
-
STRIPE_COUPON_ID (optional)
- Coupon ID for early bird promotion.
- How to create:
- Stripe Dashboard > Products > Coupons > Create coupon
- Settings:
- Discount: Percentage or fixed amount
- Duration: "Once" (not repeating)
- Restrictions: Check "First-time customer"
- Usage limit: Set maximum number of uses
- Copy the coupon ID
For production deployment, you'll update these to live Stripe keys and real product IDs. See Deployment for production setup.
Cloudflare R2 (image storage)
-
CLOUDFLARE_ACCOUNT_ID
- Your Cloudflare account ID.
- How to get it: Cloudflare Dashboard > My Profile > Account ID
-
R2_UPLOAD_IMAGE_ACCESS_KEY_ID
- R2 access key for API access.
- How to get it: Cloudflare Dashboard > R2 > API > Manage API tokens > Create User API token > with Object Read & Write permissions
-
R2_UPLOAD_IMAGE_SECRET_ACCESS_KEY
- Secret associated with the access key.
- How to get it: Generated at the same time as the access key above
-
R2_UPLOAD_IMAGE_BUCKET_NAME
- R2 bucket name.
- How to get it: Cloudflare Dashboard > R2 > Create bucket → Use the bucket name
-
NEXT_PUBLIC_R2_UPLOAD_IMAGE_PUBLIC_URL
- Public URL for the bucket.
- How to get it: Cloudflare Dashboard > R2 > Click on your bucket > Settings > Public Development URL > Enable and copy the URL
Once you have your environment variables configured, continue with platform setup and customization in Configuration.