FDA

Project 2 - Marketing Homepage

Marketing Homepage - Environment & Config

This page describes environment variables and configuration for the Marketing Homepage.

Environment variables

Create .env.local in the project root (fda-website-marketing-homepage). These are typically the only vars needed for basic and API-backed operation.

VariableRequiredDescription
NEXT_PUBLIC_API_BASE_URLNo (recommended for API data)Base URL of the Admin Panel. Used to fetch courses, categories, and blogs from /api/public/*. Example: https://learn.fda.org.in or http://localhost:3000.

If NEXT_PUBLIC_API_BASE_URL is not set, the app uses static/fallback data from src/data/ where applicable.

Example .env.local

Development (Admin Panel on same machine):

NEXT_PUBLIC_API_BASE_URL=http://localhost:3000

Production (Admin Panel on learn subdomain):

NEXT_PUBLIC_API_BASE_URL=https://learn.fda.org.in

Static-only (no API):

Leave .env.local empty or omit NEXT_PUBLIC_API_BASE_URL; ensure pages use static data imports (e.g. @/data/courses instead of @/data/courses-api).

Next.js config

  • Config file: next.config.js (or next.config.mjs). Used for redirects, images, or headers if needed.
  • Vercel: If deployed on Vercel, vercel.json can define redirects or rewrites.

Deployment

  • Build: npm run build
  • Start: npm run start (or use platform’s start command)
  • Env in production: Set NEXT_PUBLIC_API_BASE_URL in your hosting dashboard (Vercel, etc.) so the marketing site points to the correct Admin Panel URL.
  • Same domain vs cross-domain: If marketing and Admin Panel are on different domains, ensure CORS is configured on the Admin Panel for /api/public/* as in API Integration.

Optional: Database

The marketing site is primarily a frontend that consumes the Admin Panel API. If you add a direct DB connection (e.g. for analytics or forms), add DATABASE_URL to .env.local and do not commit it. The test:db script can be used to verify DB connectivity if applicable.

Previous
Pages & features