piyaz
Reference

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.local

Variable reference

NameRequiredDefaultExamplePurpose
DATABASE_URLYes(none)postgresql://piyaz:piyaz@localhost:5432/piyazPostgreSQL connection string. Used by Drizzle ORM and Drizzle Kit.
BETTER_AUTH_SECRETYes(none)(generate, see below)Secret key for Better Auth session signing. Must be at least 32 characters.
BETTER_AUTH_URLYes(none)http://localhost:3000Base URL of the Piyaz app. Used by Better Auth for redirects and cookie scoping.
GOOGLE_GENERATIVE_AI_API_KEYYes(none)AIza...Google Gemini API key. Required; at least one LLM provider must be configured.
ANTHROPIC_API_KEYNo(none)sk-ant-...Anthropic API key. Optional additional LLM provider.
OPENAI_API_KEYNo(none)sk-...OpenAI API key. Optional additional LLM provider.
OLLAMA_BASE_URLNo(none)http://localhost:11434Base URL for a local Ollama instance. Optional for local model inference.

Generating BETTER_AUTH_SECRET

Generate a cryptographically random secret:

openssl rand -base64 32

Paste 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/piyaz

Neon (serverless cloud):

DATABASE_URL=postgresql://user:password@ep-xxx.us-east-2.aws.neon.tech/piyaz?sslmode=require

Neon 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

On this page