Copy .env.example to .env and fill it in. Restart pnpm dev after every change.
cp .env.example .env
| Variable | Required | What it is |
|---|---|---|
NEXT_PUBLIC_BASE_URL |
yes | Your store URL. http://localhost:3000 locally |
NEXT_PUBLIC_SANITY_PROJECT_ID |
yes | Sanity project ID |
NEXT_PUBLIC_SANITY_DATASET |
yes | Usually production |
NEXT_PUBLIC_SANITY_API_VERSION |
no | Defaults to 2025-01-01 in .env.example |
SANITY_API_TOKEN |
yes | Editor token (server only) |
SANITY_API_READ_TOKEN |
yes | Viewer token for live content and previews |
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY |
yes | Clerk publishable key |
CLERK_SECRET_KEY |
yes | Clerk secret key (server only) |
NEXT_PUBLIC_CLERK_SIGN_IN_URL |
yes | /auth/signin |
NEXT_PUBLIC_CLERK_SIGN_UP_URL |
yes | /auth/signup |
STRIPE_SECRET_KEY |
yes | Stripe secret key (server only) |
STRIPE_WEBHOOK_SECRET |
yes | Webhook signing secret |
ADMIN_EMAIL |
yes | Comma-separated admin emails |
NEXT_PUBLIC_ADSENSE_CLIENT_ID |
no | AdSense publisher ID; empty means no ads |
Warning
Never commit .env. It is in .gitignore. Variables that start with NEXT_PUBLIC_ are sent to the browser, so never put a secret in one.
Where each value comes from
- Sanity: sanity.io/manage → your project. See Sanity setup.
- Clerk: dashboard.clerk.com → API keys. See Clerk setup.
- Stripe: dashboard.stripe.com → Developers. See Stripe payments.
ADMIN_EMAIL: your own email, then sign up with it. See Admin panel.