Development Setup
Prerequisites
- Go 1.25 (see
go.mod) - Node.js 20+ (see
frontend/package.json) - PostgreSQL 15+ running on
localhost:5432 - Redis 7+ (optional, for caching — see
docker-compose.yml)
Quick Start
bash
# 1. Start PostgreSQL and Redis via Docker (optional)
docker compose up -d postgres redis
# 2. Backend — run with hot-reload
cd cmd/slozy-web && go run .
# 3. Frontend — start Vite dev server (port 3000, proxies API to :8080)
cd frontend && npm install && npm run devThe frontend dev server at http://localhost:3000 proxies /api requests to http://localhost:8080.
Hot-Reload with Air
bash
# Install Air (if not installed)
go install github.com/air-verse/air@latest
# Run in project root (uses .air.toml config)
airThe .air.toml builds ./cmd/slozy-web, watches .go, .tpl, .html, .yaml, .toml, .mod, .sum files, and rebuilds on changes with a 1-second delay.
Environment Variables
Copy .env.example to .env and adjust. Key variables:
| Variable | Default | Description |
|---|---|---|
PORT | 8080 | Server port |
POSTGRES_DSN | postgres://postgres:postgres@localhost:5432/slozy_db?sslmode=disable | Database connection |
REDIS_URL | redis://localhost:6379 | Redis connection |
JWT_SECRET | dev_change_me_in_production_min_32_chars | JWT signing key |
DEV_MODE | true | Enables dev-only routes and debug logging |
LOG_LEVEL | debug | Logging verbosity |
Pre-configured files: .env.development (dev defaults), .env.production (prod defaults).
Docker Development
Dockerfile.dev— Go build with Alpine runtime, exposes:8080and:9090docker-compose.yml— Full stack: postgres, redis, prometheus, grafana, slozy-web, slozy-frontenddocker compose up --buildto start everything