Skip to main content

Required environment variables

Toots requires several environment variables to function properly. Create a .env file in the apps/web directory with the following configuration.

Database connection

DATABASE_URL="postgresql://postgres:postgres@localhost:5432/toots"
The PostgreSQL connection string. This should point to your PostgreSQL database instance. Format: postgresql://[user]:[password]@[host]:[port]/[database]
Make sure the database specified in DATABASE_URL exists before running migrations.

Authentication secrets

BETTER_AUTH_SECRET="your-random-secret-here"
BETTER_AUTH_URL="http://localhost:3000"
  • BETTER_AUTH_SECRET - A random secret string used for session signing and encryption. Generate a secure random string for production.
  • BETTER_AUTH_URL - The base URL where your application is hosted. Use http://localhost:3000 for local development.
Never commit your BETTER_AUTH_SECRET to version control. Use a strong random string in production.

AI integration

GOOGLE_GENERATIVE_AI_API_KEY="your-gemini-api-key"
Your Google Gemini API key for AI-powered ticket generation and project chat features.
Without a valid Gemini API key, the AI features (ticket generation and project chat) will not work. See AI integration for setup instructions.

Docker Compose environment

If you’re using the included compose.yaml for PostgreSQL, you can also set these variables in a root .env file:
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=toots
These variables configure the PostgreSQL container. Make sure they match the credentials in your DATABASE_URL.

Example configuration

Here’s a complete .env file for local development:
apps/web/.env
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/toots"
BETTER_AUTH_SECRET="generate-a-random-secret-string-here"
BETTER_AUTH_URL="http://localhost:3000"
GOOGLE_GENERATIVE_AI_API_KEY="your-gemini-api-key-here"

Generating secrets

For BETTER_AUTH_SECRET, generate a secure random string:
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"

Next steps

After configuring your environment variables:
  1. Set up your PostgreSQL database
  2. Configure authentication
  3. Set up Google Gemini API

Build docs developers (and LLMs) love