Local Setup
Environment
bash
cd backend
cp env.example.local .envRequired Variables
| Variable | Description |
|---|---|
| DB_USER / DB_PASSWORD | PostgreSQL credentials |
| JWT_SECRET | JWT signing secret |
| ENCRYPTION_KEY | AES-256 key for encrypting provider API keys |
| SMTP_USERNAME / SMTP_PASSWORD | System SMTP credentials |
| SMTP_SYSTEM_SENDER | System sender email address |
Optional Variables
| Variable | Description |
|---|---|
| STRIPE_SECRET_KEY | Stripe secret key (for billing) |
| CLOUDFLARE_API_TOKEN | Cloudflare API token (for domain management) |
| AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY | AWS credentials (for SES/S3) |
Configuration Files
Environment-specific config is loaded from YAML:
bash
# ENV variable selects the config file
ENV=local → config.local.yaml
ENV=dev → config.dev.yaml
ENV=prod → config.prod.yamlRunning
bash
# API server
ENV=local go run cmd/server/main.go
# Worker (separate terminal)
ENV=local go run cmd/worker/main.go
# With hot reload
go install github.com/cosmtrek/air@latest
air
# Database migrations
go run cmd/migrate/main.go upDocker Compose
bash
# Start all services (PostgreSQL, Redis, API, Worker)
make docker-up
# Stop
make docker-downAPI Documentation
Swagger docs are auto-generated:
bash
make docs # Generate all docs
make docs-internal # Internal API docs
make docs-public # Public-facing API docsTests
bash
# Run all tests (requires PostgreSQL test database)
go test ./...
# Run with verbose output
go test -v ./...