Development Setup
Prerequisites
| Tool | Version | Notes |
|---|---|---|
| Go | 1.22+ | go version |
| Node.js | 20+ | node --version |
| npm | 9+ | Comes with Node |
| Make | any | Optional, see Makefile |
| golangci-lint | 1.57+ | For Go linting |
| air | latest | Optional, for hot reload |
Installing Prerequisites
# Go — https://go.dev/dl/
# macOS with Homebrew:
brew install go
# Node.js — https://nodejs.org/
# or with nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
nvm install 20
# golangci-lint
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.57.2
# air (live reload for Go)
go install github.com/air-verse/air@latest
Clone and Build
git clone https://github.com/go2engle/gantry.git
cd gantry
# Install frontend dependencies
cd web && npm install && cd ..
# Build frontend (required for backend to serve the SPA)
cd web && npm run build && cd ..
# Build Go binary
go build -o bin/gantry ./cmd/gantry
# Verify
./bin/gantry version
Running in Development
Option A: Backend + Pre-built Frontend
./bin/gantry serve --dev
Opens at http://localhost:8080.
Option B: Hot Reload (Recommended)
Terminal 1 — Backend with live reload:
# Using air (watches Go files and rebuilds automatically)
air
# or without air:
go run ./cmd/gantry serve --dev
Terminal 2 — Frontend dev server:
cd web
npm run dev
Frontend dev server runs at http://localhost:5173 and proxies API calls to :8080. Changes to React files hot-reload instantly.
Option C: Full Rebuild
make build
bin/gantry serve --dev
The Makefile runs frontend build then Go build.
Project Structure
gantry/
├── cmd/gantry/ # CLI entry point (cobra commands)
│ ├── main.go
│ ├── serve.go # gantry serve
│ ├── apply.go # gantry apply
│ ├── get.go # gantry get
│ ├── describe.go # gantry describe
│ ├── export.go # gantry export
│ ├── run.go # gantry run
│ └── version.go # gantry version
│
├── internal/
│ ├── api/ # HTTP server + routes
│ │ ├── server.go # chi router setup, middleware wiring
│ │ ├── handlers/ # HTTP request handlers
│ │ │ ├── entities.go
│ │ │ ├── auth.go
│ │ │ ├── actions.go
│ │ │ ├── audit.go
│ │ │ ├── graph.go