Skip to content

Development

This section covers everything you need to contribute to Rack Gateway development, from setting up your local environment to understanding the codebase architecture.

Rack Gateway is split into three main components:

ComponentLocationPurpose
Gateway Serverinternal/gateway/API server with OAuth, RBAC, proxying, and audit logging
CLI Clientcmd/rack-gateway/, internal/cli/Multi-rack aware CLI that authenticates via gateway
Web UIweb/React SPA for admin interface
Mock OAuthmock-oauth/Mock Google OAuth server for testing
rack-gateway/
├── cmd/
│ ├── gateway/ # Gateway server entrypoint
│ ├── rack-gateway/ # CLI client entrypoint
│ ├── mock-convox/ # Mock Convox API for testing
│ └── totp-gen/ # TOTP codes for development and tests
├── internal/
│ ├── gateway/ # Gateway server packages
│ │ ├── app/ # Application setup
│ │ ├── auth/ # OAuth + sessions + MFA
│ │ ├── rbac/ # Role-based access control
│ │ ├── proxy/ # Convox API proxy
│ │ ├── audit/ # Audit logging + redaction
│ │ ├── handlers/ # HTTP handlers
│ │ ├── middleware/ # HTTP middleware
│ │ ├── jobs/ # Background jobs (River)
│ │ └── db/ # Database layer and SQL migrations
│ ├── cli/ # CLI implementation
│ └── integration/ # Integration tests
├── web/ # React SPA frontend
│ ├── src/
│ │ ├── api/ # Generated API client
│ │ ├── components/ # React components
│ │ └── pages/ # Page components
│ └── e2e/ # Playwright E2E tests
├── mock-oauth/ # Mock OAuth server
├── docs/ # This documentation site
└── taskfiles/ # Task runner configuration
Terminal window
# Start the development environment (Overmind; for people, not scripts or AI agents)
task dev
# This starts:
# - Gateway API on port 8447
# - Web UI on port 5223
# - Mock OAuth on port 3345
# - Mock Convox on port 5443
# - PostgreSQL database
  1. Create a branch for your changes
  2. Make your changes in the appropriate package
  3. Run tests to verify:
    Terminal window
    task go:test:unit # Go unit tests (task go:test adds the integration tests)
    task web:test # Web unit tests
  4. Run linters to check code quality:
    Terminal window
    task lint:fix # Fix linting issues
  5. Commit and push. The pre-commit hook formats, lints and checks duplication and file lengths. CI runs the full suite (task ci: lint, unit and integration tests, E2E tests and builds) on every push; run it locally only when you need to (it takes about 15 minutes)

Several files are auto-generated:

  • OpenAPI spec (server): internal/gateway/openapi/generated/swagger.json
  • OpenAPI spec (web): web/src/api/openapi.json
  • API client and schema types (orval): web/src/api/generated.ts and web/src/api/schemas/

Regenerate with:

Terminal window
task generate
  • Go (version pinned in mise.toml) - Primary backend language
  • Gin - HTTP framework
  • pgx / database/sql - PostgreSQL access, with plain SQL migrations
  • River - Background jobs in PostgreSQL
  • golangci-lint - Linting with 20+ linters enabled
  • React 19 - UI framework
  • Vite - Build tool
  • TanStack Router and Query - Routing and data fetching
  • Tailwind CSS - Styling
  • Biome - Linting and formatting
  • Go testing - Unit and integration tests
  • Vitest - Web unit tests
  • Playwright - E2E tests
  • PostgreSQL - Primary database
  • Docker - Container builds
  • Task - Task runner (like Make, but better)
  • mise - Environment variable management
CommandDescription
task devStart development environment
task ciRun full CI suite (lint, test, build)
task lint:fixFix linting issues
task go:test:unitRun Go unit tests
task go:testRun Go unit and integration tests
task web:testRun web tests
task web:e2eRun Playwright E2E tests
task buildBuild all binaries
task generateRegenerate code
ServicePortURL
Gateway API8447http://localhost:8447
Web UI5223http://localhost:5223
Mock OAuth3345http://localhost:3345
Mock Convox5443http://localhost:5443
PostgreSQL55432localhost:55432
Terminal window
# Gateway health
curl http://localhost:8447/api/v1/health
# Mock OAuth health
curl http://localhost:3345/health
# Mock Convox health
curl http://localhost:5443/health
  1. Set up your local environment
  2. Understand the testing strategy
  3. Review contribution guidelines
  4. Explore the API reference