Environment Variables
All environment variables Piyaz uses, with defaults and examples.
Environment Variables
Piyaz reads all configuration from .env.local in the project root. Copy the example file to get started:
cp .env.local.example .env.localVariable reference
| Name | Required | Default | Example | Purpose |
|---|---|---|---|---|
DATABASE_URL | Yes | (none) | postgresql://piyaz:piyaz@localhost:5432/piyaz | PostgreSQL connection string. Used by Drizzle ORM and Drizzle Kit. |
BETTER_AUTH_SECRET | Yes | (none) | (generate, see below) | Secret key for Better Auth session signing. Must be at least 32 characters. |
BETTER_AUTH_URL | Yes | (none) | http://localhost:3000 | Base URL of the Piyaz app. Used by Better Auth for redirects and cookie scoping. |
GOOGLE_GENERATIVE_AI_API_KEY | Yes | (none) | AIza... | Google Gemini API key. Required; at least one LLM provider must be configured. |
ANTHROPIC_API_KEY | No | (none) | sk-ant-... | Anthropic API key. Optional additional LLM provider. |
OPENAI_API_KEY | No | (none) | sk-... | OpenAI API key. Optional additional LLM provider. |
OLLAMA_BASE_URL | No | (none) | http://localhost:11434 | Base URL for a local Ollama instance. Optional for local model inference. |
Generating BETTER_AUTH_SECRET
Generate a cryptographically random secret:
openssl rand -base64 32Paste the output as the value of BETTER_AUTH_SECRET in .env.local. Do not reuse this value across environments.
If BETTER_AUTH_SECRET is missing or shorter than 32 characters, authentication will fail silently. Always generate a fresh secret for each deployment.
Database URL formats
Docker Compose (local development):
DATABASE_URL=postgresql://piyaz:piyaz@localhost:5432/piyazNeon (serverless cloud):
DATABASE_URL=postgresql://user:password@ep-xxx.us-east-2.aws.neon.tech/piyaz?sslmode=requireNeon connection strings require ?sslmode=require. You can find your connection string in the Neon dashboard under Connection Details.
LLM providers
At minimum, configure GOOGLE_GENERATIVE_AI_API_KEY. The optional providers (ANTHROPIC_API_KEY, OPENAI_API_KEY, OLLAMA_BASE_URL) add model choices but are not required.
If no LLM provider key is set, AI features (brainstorm, decompose, planning) will not function.
Example .env.local
# Database (Docker Compose local)
DATABASE_URL=postgresql://piyaz:piyaz@localhost:5432/piyaz
# Better Auth
BETTER_AUTH_SECRET=your-generated-secret-at-least-32-chars
BETTER_AUTH_URL=http://localhost:3000
# LLM Providers (at least one required)
GOOGLE_GENERATIVE_AI_API_KEY=your-gemini-api-key
# Optional providers
# ANTHROPIC_API_KEY=your-anthropic-key
# OPENAI_API_KEY=your-openai-key
# OLLAMA_BASE_URL=http://localhost:11434