.env file at the project root.
Quick Setup
-
Copy the example environment file:
-
Edit
.envand fill in your values for each variable.
Database Configuration
PostgreSQL database connection string in the format:Example:This is used by Drizzle ORM to connect to your PostgreSQL database. See Database Setup for more details.
Application Configuration
The base URL where your application is hosted. This is used by Better Auth for session management and authentication flows.Development:Production:
Authentication
Secret key for Better Auth session encryption and token signing. Must be 32 characters minimum and generated with high entropy for production.Generate a secure secret:Example:See Better Auth documentation for more details.
Email Configuration
Gmail email address used to send password recovery emails via Nodemailer.Example:See Email Setup for complete Gmail configuration.
Gmail App Password (not your regular Gmail password) for SMTP authentication. This is a 16-character password generated in your Google Account settings.Example:Important: You must enable 2-factor authentication on your Google Account to generate App Passwords. See Email Setup for step-by-step instructions.
Admin Seed Configuration
These variables are used to create the initial administrator account when seeding the database.Display name for the default administrator account.Example:
Email address for the default administrator account. This will be used to log in.Example:
Password for the default administrator account. Choose a strong password for production environments.Example:Security Note: Change this password immediately after first login in production.
Example .env File
Here’s a complete example with all required variables:
Validation
The application validates environment variables at startup:- DATABASE_URL - Checked in
drizzle.config.js:3andsrc/lib/server/db/index.js:6 - If
DATABASE_URLis missing, the application throws:DATABASE_URL is not set
Next Steps
- Database Setup - Configure PostgreSQL and run migrations
- Email Setup - Configure Gmail for password recovery emails
