Create all the .env files at once:
pnpm setup:env # copies each .env.example to .env and fills JWT_SECRET
pnpm setup:env --force # backs up existing .env files, then recreates them
Every .env.example explains each setting with a link to where you get the value. Existing .env files are never overwritten unless you pass --force.
Tip
Write API addresses without a trailing / or /api. For example http://localhost:8000, not http://localhost:8000/api/.
API: apps/api/.env
| Variable | Required | Description |
|---|---|---|
NODE_ENV |
yes | development locally, production when deployed |
PORT |
yes | API port, default 8000 |
SERVER_URL |
yes | Public address of the API |
MONGO_URI |
yes | MongoDB connection string, see Database |
JWT_SECRET |
yes | 32+ random characters (filled by pnpm setup:env) |
CLIENT_URL, ADMIN_URL |
yes | Storefront and admin addresses in development |
PRODUCTION_CLIENT_URL, PRODUCTION_ADMIN_URL |
live | Live storefront and admin addresses; the only sites allowed by CORS in production |
TAX_RATE, SHIPPING_COST, FREE_DELIVERY_THRESHOLD |
no | Pricing, see Tax and shipping |
STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRET, STRIPE_CURRENCY |
no | Stripe payments |
SSLCOMMERZ_* |
no | SSLCommerz payment endpoints (Bangladesh) |
DEFAULT_UPLOAD_PROVIDER |
no | imagekit, cloudinary or s3, see Image uploads |
IMAGEKIT_*, CLOUDINARY_*, AWS_* |
no | Keys for the chosen upload provider |
SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASS, SENDER_EMAIL_ADDRESS |
no | |
FIREBASE_SERVICE_ACCOUNT |
no | Social sign-in |
SEED_ADMIN_NAME, SEED_ADMIN_EMAIL, SEED_ADMIN_PASSWORD |
recommended | The admin account pnpm seed creates |
Storefront: apps/web/.env
| Variable | Description |
|---|---|
NEXT_PUBLIC_API_URL |
API address, http://localhost:8000 locally |
NEXT_PUBLIC_ADMIN_URL |
Admin address, used for the seller-panel links |
NEXT_PUBLIC_VAT_PERCENTAGE, NEXT_PUBLIC_SHIPPING_COST |
Shown at checkout; keep equal to the API’s values |
NEXT_PUBLIC_FIREBASE_* |
Firebase web config for social sign-in |
Admin: apps/admin/.env
| Variable | Description |
|---|---|
VITE_NEXT_PUBLIC_API_URL |
API address. Required: the admin is blank without it |
VITE_APP_ENV |
development or production |
VITE_MAX_PRODUCT_IMAGES |
Images per product, default 6 |
VITE_FIREBASE_* |
Firebase web config for social sign-in |
Mobile: apps/mobile/.env
| Variable | Description |
|---|---|
EXPO_PUBLIC_API_URL |
Empty = the API on your computer (port 8000). Set your live API for store builds |
EXPO_PUBLIC_WEB_URL |
Storefront address, used for share links |
EXPO_PUBLIC_VAT_PERCENTAGE, EXPO_PUBLIC_SHIPPING_COST |
Shown at checkout |
Warning
Never commit .env files or share them. They hold your keys. Vite and Next.js read NEXT_PUBLIC_* and VITE_* values at build time, so rebuild and redeploy after changing them.
