Environment Variables
Canonical templates:
- Repo root
.env.example— local backend + documented frontend vars backend-main/.env.example— backend-only (includes R2 placeholders)- Per-app
.env.developmentfor Vite / Next (checked into git for local defaults)
Production values and GitHub Actions secrets are listed in docs/DEPLOYMENT.md. Do not commit real secrets.
Backend (backend-main/.env)
| Variable | Local typical | Notes |
|---|---|---|
SECRET_KEY | required | Django secret |
DEBUG | True | False in production |
ALLOWED_HOSTS | localhost,127.0.0.1 | e.g. api.novaorder.in in prod |
DATABASE_URL | empty | Empty → SQLite via DB_FILE (default db.sqlite3). Prod: RDS URL with sslmode=require |
DB_FILE | db.sqlite3 | Used when DATABASE_URL is empty |
CORS_ALLOWED_ORIGINS | empty | Empty + DEBUG → built-in localhost 3000–3003 list. Prod: comma-separated https origins, no trailing slash |
CSRF_TRUSTED_ORIGINS | empty locally | Prod: frontend + API origins with https:// |
SERVE_MEDIA | True | False when media is on R2 |
PUBLIC_API_BASE_URL | empty / optional | Public API origin (no trailing slash) |
POS_FRONTEND_BASE_URL | http://localhost:3001 | Used when minting POS URLs server-side |
CHECKOUT_FRONTEND_BASE_URL | http://localhost:3002 | Public checkout base for customer / catalog links |
ADMIN_FRONTEND_BASE_URL | http://localhost:3000 | Password-reset / admin links |
ECOMMERCE_FRONTEND_BASE_URL | http://localhost:3003 | Storefront base (reset links, etc.) |
RESEND_API_KEY | empty | Password-reset and order-confirmation email |
EMAIL_FROM | Nova Print default | e.g. "Nova Print <[email protected]>" |
RAZORPAY_KEY_ID | empty until setup | Ecommerce only; never put secret in Next.js |
RAZORPAY_KEY_SECRET | empty until setup | See docs/RAZORPAY_SETUP.md |
RAZORPAY_WEBHOOK_SECRET | empty until webhook created | Same doc |
R2_BUCKET_NAME | empty | Empty → local disk uploads. Set in prod for Cloudflare R2 |
R2_ACCESS_KEY_ID / R2_SECRET_ACCESS_KEY / R2_ENDPOINT_URL | — | Required when R2_BUCKET_NAME is set |
R2_CUSTOM_DOMAIN | e.g. media.novaorder.in | Hostname only (no https://) |
Production sample block (EC2 path /opt/nova-print/backend/.env) is in docs/DEPLOYMENT.md § API environment file.
Frontend — Vite apps
Vars are baked at build time (import.meta.env). Local files:
| App | File | Variables |
|---|---|---|
| Admin | frontend-admin-dashboard/.env.development | VITE_API_BASE_URL, VITE_POS_BASE_URL, VITE_STOREFRONT_URL |
| POS | frontend-pos/.env.development | VITE_API_BASE_URL, VITE_CHECKOUT_BASE_URL |
| Checkout | printbazar-checkout/.env.development | VITE_API_BASE_URL |
Local API base for all: http://localhost:8000/api.
Public URL helpers:
- POS → checkout links:
VITE_CHECKOUT_BASE_URL→frontend-pos/src/lib/publicUrls.ts(buildCheckoutLink/resolveCheckoutLink) - Admin → POS URLs:
VITE_POS_BASE_URL→frontend-admin-dashboard/src/lib/publicUrls.ts(buildPosUrl)
CI / production GitHub secrets (same names): VITE_API_BASE_URL, VITE_POS_BASE_URL, VITE_STOREFRONT_URL, VITE_CHECKOUT_BASE_URL — see docs/DEPLOYMENT.md § GitHub Actions secrets.
Optional admin test helper: VITE_TEST_TOKEN (declared in vite-env.d.ts / testing docs; not required for normal local use).
Frontend — Next.js storefront
| Variable | Local (.env.development) | Role |
|---|---|---|
NEXT_PUBLIC_API_BASE_URL | http://localhost:8000/api | Client + server API calls (frontend-ecommerce/src/lib/apiBase.ts) |
NEXT_PUBLIC_SITE_URL | http://localhost:3003 | Canonical site URL |
Also referenced in site config (optional): NEXT_PUBLIC_SUPPORT_EMAIL, NEXT_PUBLIC_SUPPORT_PHONE (frontend-ecommerce/src/lib/site-config.ts).
Production secrets: NEXT_PUBLIC_API_BASE_URL, NEXT_PUBLIC_SITE_URL in GitHub Actions.
Checkout public URL (end-to-end)
Two layers must agree on the checkout host:
- Backend
CHECKOUT_FRONTEND_BASE_URL— absolute links returned/stored by the API. - POS
VITE_CHECKOUT_BASE_URL— what the POS UI uses when rewriting localhost API URLs or building/{posSlug}/{linkCode}paths.
| Environment | Checkout base |
|---|---|
| Local | http://localhost:3002 |
| Production (Nova Print) | https://store.novaorder.in |
Razorpay
Keys are backend-only. After setting RAZORPAY_*, restart Django and enable Razorpay under Admin → Ecommerce → Payment Options. Full steps and webhook URLs: docs/RAZORPAY_SETUP.md.