Environment Variables

Complete reference for all environment variables used in SaaniCare.

Required Variables

Database

  • DATABASE_URL - PostgreSQL connection string

    • Format: postgresql://user:password@host:port/database
    • Example: postgresql://postgres:password@localhost:5432/saanicare
  • DATABASE_URL_NON_POOLING - Direct database connection (for migrations)

    • Used by Prisma migrations
    • Same format as DATABASE_URL

Authentication

  • AUTH0_SECRET - Secret for Auth0 session encryption

    • Generate: openssl rand -hex 32
    • Used for session cookie encryption
  • AUTH0_BASE_URL - Base URL of your application

    • Example: http://localhost:3000 (development)
    • Example: https://parent.saanicare.dev (production)
  • AUTH0_ISSUER_BASE_URL - Auth0 domain

    • Format: https://your-domain.auth0.com
    • Found in Auth0 dashboard
  • AUTH0_CLIENT_ID - Auth0 application client ID

    • Found in Auth0 dashboard → Applications
  • AUTH0_CLIENT_SECRET - Auth0 application client secret

    • Found in Auth0 dashboard → Applications
    • Keep this secret secure
  • AUTH0_AUDIENCE - Auth0 API audience

    • Format: https://api.saanicare.dev
    • Used for API authentication

API

  • API_URL - Backend API URL

    • Example: http://localhost:3000 (development)
    • Example: https://api.saanicare.dev (production)
  • NODE_ENV - Environment

    • Values: development, production, test
    • Controls logging, error handling, etc.

Optional Variables

Cache

  • REDIS_URL - Redis connection string
    • Format: redis://host:port
    • Example: redis://localhost:6379
    • Used for session storage and caching

AI/LLM

  • GOOGLE_GEMINI_API_KEY - Google Gemini API key
    • Used for AI curriculum generation
    • Get from Google Cloud Console

File Storage

  • AWS_S3_BUCKET - S3 bucket name for file storage
  • AWS_S3_REGION - AWS region
  • AWS_ACCESS_KEY_ID - AWS access key
  • AWS_SECRET_ACCESS_KEY - AWS secret key

Payments

  • STRIPE_SECRET_KEY - Stripe secret key
  • STRIPE_PUBLISHABLE_KEY - Stripe publishable key (frontend)

Email

  • SMTP_HOST - SMTP server host
  • SMTP_PORT - SMTP server port
  • SMTP_USER - SMTP username
  • SMTP_PASSWORD - SMTP password
  • SMTP_FROM - From email address

Frontend Variables

Frontend apps use NEXT_PUBLIC_ prefix for client-side variables:

  • NEXT_PUBLIC_API_URL - API URL accessible from browser
  • NEXT_PUBLIC_AUTH0_DOMAIN - Auth0 domain
  • NEXT_PUBLIC_AUTH0_CLIENT_ID - Auth0 client ID
  • NEXT_PUBLIC_AUTH0_AUDIENCE - Auth0 API audience

Environment Files

Development

Create .env.local in the root directory:

cp env.example .env.local

Production

Set environment variables in:

  • Vercel dashboard (for each project)
  • Docker environment files
  • CI/CD pipeline secrets

Security Notes

  • Never commit .env.local to version control
  • Use different secrets for development and production
  • Rotate secrets regularly
  • Use environment-specific values
  • Keep AUTH0_CLIENT_SECRET and database passwords secure