Understanding Your Environment Variables
Environment variables keep your app customizable and flexible. Here's a quick breakdown of the variables in your .env
file, what they do, and where to get the values.
Customization
These control the basics of your app's identity:
NEXT_PUBLIC_SITE_NAME
: Your app's name. It'll show up in titles, emails, and anywhere branding matters. Example:FastStartup
.NEXT_PUBLIC_SITE_URL
: The app's main URL (where it lives on the web). Example:faststartup.dev
.NEXT_PUBLIC_SUPPORT_EMAIL
: The email your users can contact for support. Example:contact@faststartup.dev
.NEXT_PUBLIC_UNDER_MAINTENANCE
: A quick toggle for maintenance mode. Set totrue
when you're making updates.
Database
-
DATABASE_URL
: Connection string for your database. Looks like this:postgresql://username:password@host:port/database?schema=public
Replace
username
,password
, andhost
with your database details. If you're using PostgreSQL locally, this might be something likelocalhost:5432
.
Authentication
Auth Secret
AUTH_SECRET
: A secret key used for things like signing tokens. Find more details here: AuthJS Docs.
Google Auth
AUTH_GOOGLE_ID
andAUTH_GOOGLE_SECRET
: These are your Google OAuth credentials. Get them by setting up a project in the Google API Console.
Resend (Email Sending)
Resend handles your app's emails (like password resets or welcome messages):
AUTH_RESEND_KEY
: Your Resend API key. Create an account at resend.com to get it.NEXT_PUBLIC_RESEND_EMAIL
: The email address your app uses to send messages (e.g.,noreply@faststartup.dev
). You'll need to configure this in Resend. See their domain setup docs.
Stripe (Payments)
Stripe powers payments for your app:
STRIPE_PUBLISHABLE_KEY
: Public key for Stripe. Safe to share on the frontend.STRIPE_SECRET_KEY
: Keep this one private. It's used to interact with Stripe's API on the backend.STRIPE_WEBHOOK_SECRET
: Verifies events from Stripe (like payment confirmations). Find it in your Stripe Dashboard.
Analytics (Optional)
Analytics help you understand how users interact with your app. These are optional—if they're empty, analytics scripts won't run.
NEXT_PUBLIC_GOOGLE_ANALYTICS_ID
: Your Google Analytics tracking ID.NEXT_PUBLIC_HOTJAR_ID
: Hotjar ID for user session recordings.NEXT_PUBLIC_SIMPLE_ANALYTICS_ENABLED
: Toggle Simple Analytics withtrue
orfalse
.
Full config
# --- CUSTOMIZATION ---
NEXT_PUBLIC_SITE_NAME="FastStartup"
NEXT_PUBLIC_SITE_URL="faststartup.dev"
NEXT_PUBLIC_SUPPORT_EMAIL="contact@faststartup.dev"
NEXT_PUBLIC_UNDER_MAINTENANCE=false
# --- DATABASE ---
DATABASE_URL="postgresql://johndoe:randompassword@localhost:5432/mydb?schema=public"
# --- AUTHENTICATION ---
AUTH_SECRET=""
AUTH_GOOGLE_ID="client id"
AUTH_GOOGLE_SECRET="client secret"
# --- RESEND ---
AUTH_RESEND_KEY=abc123
NEXT_PUBLIC_RESEND_EMAIL="noreply@faststartup.dev"
# --- STRIPE ---
STRIPE_PUBLISHABLE_KEY="123"
STRIPE_SECRET_KEY="123"
STRIPE_WEBHOOK_SECRET="123"
# --- ANALYTICS ---
NEXT_PUBLIC_GOOGLE_ANALYTICS_ID=
NEXT_PUBLIC_HOTJAR_ID=
NEXT_PUBLIC_SIMPLE_ANALYTICS_ENABLED=false
Wrapping Up
Not every variable here is mandatory—just fill in what you need. And remember: sensitive values (like DATABASE_URL
or STRIPE_SECRET_KEY
) should never be exposed to the public. Keep them safe in your backend.