Environment Variables
A complete reference for all environment variables used by CareNova, including required and optional configuration.
Written By Dev010
Last updated 19 days ago
CareNova uses environment variables to configure all external services, database connections, and application behavior.
This page is a complete reference for every variable used by the application.
Creating the Environment File
Inside the root of carenova-app/, create a new file named .env.local:
touch .env.localThe file must be placed at the project root:
carenova-app/
βββ app/
βββ components/
βββ lib/
βββ public/
βββ .env.local β create this file here
βββ package.json
βββ next.config.js
.env.localis already included in.gitignoreand will never be committed to version control. Never rename it to.envas that file can be accidentally committed.
Complete Variable Reference
Supabase β Authentication & Database
These variables connect CareNova to your Supabase project. Found in Supabase Dashboard β Settings β API.
NEXT_PUBLIC_SUPABASE_URLRequired Β· Public
Your Supabase project URL. Used by both the frontend and backend to communicate with Supabase services.
NEXT_PUBLIC_SUPABASE_URL=https://your-project-ref.supabase.coWhere to find it: Settings β API β Project URL
NEXT_PUBLIC_SUPABASE_ANON_KEYRequired Β· Public
The public anonymous API key. Used for authentication and client-side Supabase requests. Safe to expose in the browser β Supabase enforces security at the database level.
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-keyWhere to find it: Settings β API β Project API Keys β anon public
SUPABASE_SERVICE_ROLE_KEYRequired Β· Server only
The service role key. Used for admin operations, storage bucket management, and seed scripts. Bypasses Row Level Security β never expose this publicly.
SUPABASE_SERVICE_ROLE_KEY=your-service-role-keyWhere to find it: Settings β API β Project API Keys β service_role
This key has full database access. Keep it server-side only and never commit it to a public repository.
Database β Drizzle ORM Connection
DATABASE_URLRequired Β· Server only
The PostgreSQL connection string used by Drizzle ORM for all database queries. Must use the Transaction pooler on port 6543 with ?pgbouncer=true appended.
DATABASE_URL=postgresql://postgres.[ref]:[YOUR-PASSWORD]@aws-0-[region].pooler.supabase.com:6543/postgres?pgbouncer=trueWhere to find it: Settings β Database β Connection String β Transaction mode
β οΈ Port 6543 and
?pgbouncer=trueare both required. Using port 5432 without pgBouncer will cause connection failures under load. CareNova usesprepare: falsein Drizzle config for pgBouncer transaction mode compatibility.
DIRECT_DATABASE_URLOptional Β· Server only
A direct session-mode connection string used only when running npm run db:migrate. Not required for normal development or production operation.
DIRECT_DATABASE_URL=postgresql://postgres.[ref]:[YOUR-PASSWORD]@aws-0-[region].pooler.supabase.com:5432/postgresWhere to find it: Settings β Database β Connection String β Session mode
Application Configuration
NEXT_PUBLIC_SITE_URLRequired Β· Public
The base URL of your application. Used for authentication redirects and email confirmation links.
# Local development
NEXT_PUBLIC_SITE_URL=http://localhost:3000
# Production
NEXT_PUBLIC_SITE_URL=https://yourdomain.comThis value must match the Site URL configured in Supabase β Authentication β URL Configuration. If they do not match, email confirmation links will not work.
CRON_SECRETRequired Β· Server only
A secret string that protects the cleanup cron endpoint at /api/cron/cleanup-auth. Any request to this endpoint without the correct secret returns a 401 error.
CRON_SECRET=your-random-secret-stringGenerate a secure value using:
openssl rand -base64 32CARENOVA_DEBUGOptional Β· Server only
Enables verbose [CareNova] debug logs in the terminal. Useful for tracing auth flows, DB queries, and layout performance during development.
# Enable debug logs
CARENOVA_DEBUG=1
# Disable (default)
# CARENOVA_DEBUG=0Set to
1for local development only. Remove or set to0for production β leaving it enabled in production will output excessive logs.
When enabled, the following are activated:
Verbose auth and layout trace logs
Drizzle SQL query logger (prints every query)
Extra dashboard performance timing
Background task failure warnings
Email β Resend
RESEND_API_KEYRequired for email Β· Server only
API key for sending transactional emails via Resend β signup confirmation, password reset, and email verification.
RESEND_API_KEY=re_xxxxxxxxxxWhere to find it: resend.com β API Keys β Create API Key
Without this key, email confirmation will not work in production. During local development, a mock log is shown in the terminal instead of sending a real email.
Envato License
ENVATO_PERSONAL_TOKENRequired for production Β· Server only
Your Envato personal token. Used to verify Envato purchase codes submitted on the /setup activation screen.
ENVATO_PERSONAL_TOKEN=your-envato-personal-tokenWhere to find it: build.envato.com/api/ β Create a new token with Purchase permission
ENVATO_ITEM_IDRequired for production Β· Server only
The CodeCanyon item ID for CareNova. Used to verify that a submitted purchase code belongs to CareNova and not another product.
ENVATO_ITEM_ID=your-codecanyon-item-idWhere to find it: Your CodeCanyon listing URL β the number at the end is your item ID.
Demo Data
DEMO_PASSWORDOptional Β· Server only
The password assigned to all demo accounts created by npm run db:seed. If not set, defaults to Demo123!.
DEMO_PASSWORD=Demo123!Demo accounts created by the seed script:
admin@carenova.demodoctor@carenova.demoreceptionist@carenova.demonurse@carenova.demo
Change this value before seeding if you want custom demo account passwords. The value must meet the password policy β minimum 8 characters, uppercase, lowercase, number, and special character.
Optional Configuration
DIRECT_DATABASE_URLOptional Β· Server only
Already covered in the Database section above. Only needed for npm run db:migrate.
TEETH_IMAGES_BASE_URLOptional Β· Server only
Base URL for teeth images used in the Odontogram module. If not set, a default external URL is used.
TEETH_IMAGES_BASE_URL=https://your-domain.com/teethOnly required if you want to self-host the odontogram tooth images.
Complete .env.local Template
Copy this template into your .env.local file and replace all placeholder values:
# βββ Supabase (Auth + Database) βββββββββββββββββββββββββββββ
# Get these from: Supabase Dashboard β Settings β API
NEXT_PUBLIC_SUPABASE_URL=https://your-project-ref.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
# βββ Database (Drizzle ORM) ββββββββββββββββββββββββββββββββββ
# Use Transaction pooler (port 6543) β add ?pgbouncer=true
# Get from: Settings β Database β Connection String β Transaction mode
DATABASE_URL=postgresql://postgres.[ref]:[PASSWORD]@aws-0-[region].pooler.supabase.com:6543/postgres?pgbouncer=true
# Optional: Session mode (port 5432) for migrations only
# Get from: Settings β Database β Connection String β Session mode
# DIRECT_DATABASE_URL=postgresql://postgres.[ref]:[PASSWORD]@aws-0-[region].pooler.supabase.com:5432/postgres
# βββ Supabase Service Role βββββββββββββββββββββββββββββββββββ
# Required for storage and admin operations β never expose publicly
# Get from: Settings β API β service_role key
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key
# βββ Site URL ββββββββββββββββββββββββββββββββββββββββββββββββ
# Must match Site URL in Supabase Auth β URL Configuration
# Local: http://localhost:3000 | Production: https://yourdomain.com
NEXT_PUBLIC_SITE_URL=http://localhost:3000
# βββ Resend (Transactional Email) ββββββββββββββββββββββββββββ
# Required for email confirmation and password reset
# Get from: https://resend.com/api-keys
RESEND_API_KEY=re_xxxxxxxxxx
# βββ Cron Job Protection βββββββββββββββββββββββββββββββββββββ
# Protects /api/cron/cleanup-auth β generate with: openssl rand -base64 32
CRON_SECRET=your-random-secret-string
# βββ Envato License Verification βββββββββββββββββββββββββββββ
# Required for purchase code activation on first launch
# Get from: https://build.envato.com/api/
ENVATO_PERSONAL_TOKEN=your-envato-personal-token
ENVATO_ITEM_ID=your-codecanyon-item-id
# βββ Demo Data (optional) ββββββββββββββββββββββββββββββββββββ
# Password for demo accounts created by npm run db:seed
# Default: Demo123! β must meet password policy requirements
# DEMO_PASSWORD=Demo123!
# βββ Debug Logs (development only) ββββββββββββββββββββββββββ
# Set to 1 to enable verbose [CareNova] logs β remove for production
# CARENOVA_DEBUG=1
# βββ Teeth Images (optional) βββββββββββββββββββββββββββββββββ
# Base URL for odontogram tooth images β uses default if not set
# TEETH_IMAGES_BASE_URL=https://your-domain.com/teethVariable Summary Table
Security Best Practices
Never commit
.env.localto any repository β it is already in.gitignoreNever expose
SUPABASE_SERVICE_ROLE_KEYin client-side code or browser-accessible filesUse strong values for
CRON_SECRETβ generate withopenssl rand -base64 32Use different values for development and production environments
Store production secrets in your hosting platform's environment variable settings β never in files
Setting Variables in Production (Vercel)
For production deployments on Vercel:
Go to your Vercel project dashboard
Navigate to Settings β Environment Variables
Add each variable with its production value
Set the environment scope β Production, Preview, or Development
Redeploy your application after adding variables
NEXT_PUBLIC_SITE_URLmust be set to your actual production domain in Vercel β for examplehttps://app.yourdomain.com. The localhost value from.env.localmust not be used in production.
Helpful resources:
Next Step
Environment variables are now configured. Continue to the Deployment guide to take CareNova to production, or return to the Installation Guide to complete your local setup.