Skip to content

Development Setup

Prerequisites

  • Go 1.25+
  • Node.js 22+ (with npm)
  • Docker & Docker Compose
  • Air (for backend hot-reload): go install github.com/air-verse/air@latest

1. Clone & Configure

bash
git clone git@github.com:edsuwarna/anjungan.git
cd anjungan
cp .env.example .env

Edit .env if needed (defaults work for local dev).

2. Start Dependencies (PostgreSQL + Redis)

bash
make dev-db
# or: docker compose up -d postgres redis

3. Run Backend (with hot-reload)

bash
make dev-backend

The server starts on localhost:8080 and auto-runs database migrations on startup.

4. Run Frontend (dev server)

bash
make dev-frontend

Opens on localhost:5173 with HMR. Proxies /api/* to the backend.

5. Full Stack (Docker only)

bash
make dev
# or: docker compose up -d

Runs everything in containers. Frontend at http://localhost, backend at http://localhost:8080.

Makefile Commands

CommandDescription
make devStart all services
make dev-backendBackend with hot-reload
make dev-frontendFrontend dev server
make dev-dbStart databases only
make buildBuild Docker images
make upStart Docker services
make downStop Docker services
make restartRestart Docker services
make logsTail all service logs
make migrate-upRestart backend to run pending migrations
make migrate-createCreate new migration files
make build-backendBuild Go binary locally
make build-frontendBuild frontend SPA locally
make go-testRun Go tests
make go-lintRun go vet
make go-tidyTidy Go modules

Environment Variables

Key variables (see .env.example for all):

VariableDefaultDescription
POSTGRES_USERanjunganDatabase user
POSTGRES_PASSWORDanjunganDatabase password
POSTGRES_DBanjunganDatabase name
JWT_SECRETchange-me-in-productionJWT signing key
REGISTRY_URLhttp://zot:5000Internal Zot URL
REGISTRY_EXTERNAL_URLregistry.anjungan.ioExternal Zot URL
LOG_LEVELinfoLog level: debug, info, warn, error
SELF_SERVER_ENABLEDfalseAuto-register host server
SELF_SERVER_NAMEanjungan-hostDisplay name for self-server

Connecting to the Database

bash
make db
# or: docker compose exec postgres psql -U anjungan -d anjungan