Skip to content

Local Setup

Environment

bash
cd backend
cp env.example.local .env

Required Variables

VariableDescription
DB_USER / DB_PASSWORDPostgreSQL credentials
JWT_SECRETJWT signing secret
ENCRYPTION_KEYAES-256 key for encrypting provider API keys
SMTP_USERNAME / SMTP_PASSWORDSystem SMTP credentials
SMTP_SYSTEM_SENDERSystem sender email address

Optional Variables

VariableDescription
STRIPE_SECRET_KEYStripe secret key (for billing)
CLOUDFLARE_API_TOKENCloudflare API token (for domain management)
AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEYAWS 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.yaml

Running

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 up

Docker Compose

bash
# Start all services (PostgreSQL, Redis, API, Worker)
make docker-up

# Stop
make docker-down

API Documentation

Swagger docs are auto-generated:

bash
make docs           # Generate all docs
make docs-internal  # Internal API docs
make docs-public    # Public-facing API docs

Tests

bash
# Run all tests (requires PostgreSQL test database)
go test ./...

# Run with verbose output
go test -v ./...

TechTrans Lab