Back to Home
Chitthi Docs
v1.0.0

Documentation

Configuration

Environment variables and infrastructure setup for self-hosted deployments.

Cloud users: You don't need to configure any of this. Your infrastructure is managed for you.

Environment Variables

Create a .env file in the root directory

env
# Server Configuration
PORT=8080
APP_ENV=production

# Database Configuration
DATABASE_URL=postgres://postgres:postgres@db:5432/chitthi?sslmode=disable

# Redis Configuration
REDIS_URL=redis://redis:6379

# Auth & Encryption
JWT_SECRET=your-secret-key
ENCRYPTION_KEY=your-32-byte-key

# Server-to-server auth (Next.js ↔ Go API)
CHITTHI_BFF_SECRET=generate-with-openssl-rand-hex-32

# NextAuth (Google OAuth)
GOOGLE_CLIENT_ID=your-client-id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your-client-secret
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=generate-with-openssl-rand-base64-32

# Email Provider Keys (Optional - environment-level fallback)
SENDGRID_API_KEY=your_sendgrid_api_key
BREEVO_API_KEY=your_breevo_api_key
MAILERSEND_API_KEY=your_mailersend_api_key

# Message Queue (Optional)
RABBITMQ_URL=amqp://guest:guest@localhost:5672/

PostgreSQL

Stores users, providers, unified API keys, and daily metrics.

bash
docker run -d \
  --name chitthi-postgres \
  -e POSTGRES_PASSWORD=postgres \
  -e POSTGRES_DB=chitthi \
  -p 5432:5432 \
  postgres:15

Redis

Used for caching and rate limiting.

bash
docker run -d \
  --name chitthi-redis \
  -p 6379:6379 \
  redis:7-alpine

Database Migrations

Run migrations to set up the required tables

Install the golang-migrate CLI. Run from the repository root.

Run Migrations

bash
migrate -path migrations \
  -database "postgres://postgres:postgres@localhost:5432/chitthi?sslmode=disable" up

Rollback One Step

bash
migrate -path migrations \
  -database "postgres://postgres:postgres@localhost:5432/chitthi?sslmode=disable" down 1