Environment Variables
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
- Format:
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
- Generate:
AUTH0_BASE_URL- Base URL of your application- Example:
http://localhost:3000(development) - Example:
https://parent.saanicare.dev(production)
- Example:
AUTH0_ISSUER_BASE_URL- Auth0 domain- Format:
https://your-domain.auth0.com - Found in Auth0 dashboard
- Format:
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
- Format:
API
API_URL- Backend API URL- Example:
http://localhost:3000(development) - Example:
https://api.saanicare.dev(production)
- Example:
NODE_ENV- Environment- Values:
development,production,test - Controls logging, error handling, etc.
- Values:
Optional Variables
Cache
REDIS_URL- Redis connection string- Format:
redis://host:port - Example:
redis://localhost:6379 - Used for session storage and caching
- Format:
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 storageAWS_S3_REGION- AWS regionAWS_ACCESS_KEY_ID- AWS access keyAWS_SECRET_ACCESS_KEY- AWS secret key
Payments
STRIPE_SECRET_KEY- Stripe secret keySTRIPE_PUBLISHABLE_KEY- Stripe publishable key (frontend)
SMTP_HOST- SMTP server hostSMTP_PORT- SMTP server portSMTP_USER- SMTP usernameSMTP_PASSWORD- SMTP passwordSMTP_FROM- From email address
Frontend Variables
Frontend apps use NEXT_PUBLIC_ prefix for client-side variables:
NEXT_PUBLIC_API_URL- API URL accessible from browserNEXT_PUBLIC_AUTH0_DOMAIN- Auth0 domainNEXT_PUBLIC_AUTH0_CLIENT_ID- Auth0 client IDNEXT_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.localto version control - Use different secrets for development and production
- Rotate secrets regularly
- Use environment-specific values
- Keep
AUTH0_CLIENT_SECRETand database passwords secure