Backend (Go + Gin)
REST API that serves the schedule/time endpoints and current episode control. Built in Go, containerized with a multi-stage Dockerfile.
Prerequisites
- Go 1.22+
- PostgreSQL reachable (uses env-driven DSN pieces)
golang-migratenot required locally (migrations shipped in repo)
Env
The server builds its DSN from:
PGHOST,POSTGRES_PORT,POSTGRES_USER,POSTGRES_PASSWORD,POSTGRES_DB,PGSSLMODEADDR(listen address, default:8082)GIN_MODE(e.g.,release)
Commands
# Run locally (expects Postgres per env)
go run ./cmd/server
# Run migrations
go run ./cmd/migrate
# Tests
go test ./...
Docker build (used by compose)
docker build -t watchparty-backend .
Compose uses the same image for api and the one-off migrate job.
Endpoints (key)
GET /api/v1/time— server time for client clock syncGET /api/v1/current— current schedule itemPOST /api/v1/current— set current episode (expects{ id, start_time? })GET /api/v1/shows— list of episodesGET /healthz— health check