Skip to main content

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.development for 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)​

VariableLocal typicalNotes
SECRET_KEYrequiredDjango secret
DEBUGTrueFalse in production
ALLOWED_HOSTSlocalhost,127.0.0.1e.g. api.novaorder.in in prod
DATABASE_URLemptyEmpty → SQLite via DB_FILE (default db.sqlite3). Prod: RDS URL with sslmode=require
DB_FILEdb.sqlite3Used when DATABASE_URL is empty
CORS_ALLOWED_ORIGINSemptyEmpty + DEBUG → built-in localhost 3000–3003 list. Prod: comma-separated https origins, no trailing slash
CSRF_TRUSTED_ORIGINSempty locallyProd: frontend + API origins with https://
SERVE_MEDIATrueFalse when media is on R2
PUBLIC_API_BASE_URLempty / optionalPublic API origin (no trailing slash)
POS_FRONTEND_BASE_URLhttp://localhost:3001Used when minting POS URLs server-side
CHECKOUT_FRONTEND_BASE_URLhttp://localhost:3002Public checkout base for customer / catalog links
ADMIN_FRONTEND_BASE_URLhttp://localhost:3000Password-reset / admin links
ECOMMERCE_FRONTEND_BASE_URLhttp://localhost:3003Storefront base (reset links, etc.)
RESEND_API_KEYemptyPassword-reset and order-confirmation email
EMAIL_FROMNova Print defaulte.g. "Nova Print <[email protected]>"
RAZORPAY_KEY_IDempty until setupEcommerce only; never put secret in Next.js
RAZORPAY_KEY_SECRETempty until setupSee docs/RAZORPAY_SETUP.md
RAZORPAY_WEBHOOK_SECRETempty until webhook createdSame doc
R2_BUCKET_NAMEemptyEmpty → 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_DOMAINe.g. media.novaorder.inHostname 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:

AppFileVariables
Adminfrontend-admin-dashboard/.env.developmentVITE_API_BASE_URL, VITE_POS_BASE_URL, VITE_STOREFRONT_URL
POSfrontend-pos/.env.developmentVITE_API_BASE_URL, VITE_CHECKOUT_BASE_URL
Checkoutprintbazar-checkout/.env.developmentVITE_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​

VariableLocal (.env.development)Role
NEXT_PUBLIC_API_BASE_URLhttp://localhost:8000/apiClient + server API calls (frontend-ecommerce/src/lib/apiBase.ts)
NEXT_PUBLIC_SITE_URLhttp://localhost:3003Canonical 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:

  1. Backend CHECKOUT_FRONTEND_BASE_URL — absolute links returned/stored by the API.
  2. POS VITE_CHECKOUT_BASE_URL — what the POS UI uses when rewriting localhost API URLs or building /{posSlug}/{linkCode} paths.
EnvironmentCheckout base
Localhttp://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.