Skip to content

Environment Setup

Backend (main/.env)

Copy the example file and fill in every value before starting the server.

bash
cp main/.env.example main/.env
VariableRequiredExampleDescription
DATABASE_URLpostgresql://user:pass@localhost:5432/impactmelFull PostgreSQL connection string
JWT_SECRETa-long-random-stringSigns all JWT tokens — keep secret, rotate on breach
JWT_EXPIRY7dJWT TTL; defaults to 7d
PORT3001NestJS listen port
GOOGLE_CLIENT_ID✅ (OAuth)123.apps.googleusercontent.comGoogle OAuth app client ID
GOOGLE_CLIENT_SECRET✅ (OAuth)GOCSPX-...Google OAuth app client secret
GOOGLE_CALLBACK_URL✅ (OAuth)https://api.impactmel.com/auth/google/callbackMust match Google Console exactly
FRONTEND_URLhttps://app.impactmel.comUsed in CORS policy + OAuth redirect
SMTP_HOST(email)smtp.sendgrid.netFor password-reset emails
SMTP_PORT(email)587SMTP port
SMTP_USER(email)apikeySMTP username
SMTP_PASS(email)SG.xxxSMTP password or API key
SMTP_FROM(email)noreply@impactmel.comFrom address
COOKIE_DOMAIN.impactmel.comShared cookie domain for OAuth
NODE_ENVproductiondevelopment | production

Minimum local setup

env
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/impactmel
JWT_SECRET=dev-secret-change-in-production
PORT=3001
FRONTEND_URL=http://localhost:3000

Frontend (frontend/.env.local)

bash
cp frontend/.env.local.example frontend/.env.local
VariableRequiredExampleDescription
NEXT_PUBLIC_API_URLhttp://localhost:3001NestJS backend base URL
NEXT_PUBLIC_APP_URLhttp://localhost:3000Frontend origin (used in share links)

Minimum local setup

env
NEXT_PUBLIC_API_URL=http://localhost:3001
NEXT_PUBLIC_APP_URL=http://localhost:3000

PostgreSQL

ImpactMEL requires PostgreSQL ≥ 14. Extensions used:

  • uuid-osspuuid_generate_v4() for primary keys (auto-installed via migration)

Quick local DB

bash
# macOS with Homebrew
brew install postgresql@16
brew services start postgresql@16
createdb impactmel
bash
# Docker
docker run -d \
  --name impactmel-db \
  -e POSTGRES_DB=impactmel \
  -e POSTGRES_PASSWORD=postgres \
  -p 5432:5432 \
  postgres:16

Google OAuth Setup

  1. Go to Google Cloud ConsoleAPIs & ServicesCredentials
  2. Create an OAuth 2.0 Client ID (Web application)
  3. Add authorized redirect URIs:
    • Local: http://localhost:3001/auth/google/callback
    • Production: https://api.impactmel.com/auth/google/callback
  4. Copy Client ID and Client Secret into .env

WARNING

GOOGLE_CALLBACK_URL in .env must exactly match one of the URIs in Google Console — no trailing slash differences.


Production Checklist

  • [ ] JWT_SECRET is at least 32 random characters
  • [ ] NODE_ENV=production
  • [ ] COOKIE_DOMAIN set to your shared root domain (e.g. .impactmel.com)
  • [ ] SMTP credentials configured for password-reset flow
  • [ ] Google OAuth redirect URIs updated to production URLs
  • [ ] PostgreSQL with SSL (?sslmode=require in DATABASE_URL)
  • [ ] Run pnpm run migration:run in main/ after each deploy

ImpactMEL — Enterprise M&E Platform