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/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
├── 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
│ │ └── db/ # Database layer
│ ├── 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
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 # Go unit tests
    task web:test # Web unit tests
  4. Run linters to check code quality:
    Terminal window
    task lint:fix # Fix linting issues
  5. Run full CI before committing:
    Terminal window
    task ci # Complete CI suite

Several files are auto-generated:

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

Regenerate with:

Terminal window
task generate
  • Go 1.22+ - Primary backend language
  • Gin - HTTP framework
  • sqlc - Type-safe SQL
  • golangci-lint - Linting with 20+ linters enabled
  • React 18 - UI framework
  • Vite - Build tool
  • TanStack Query - Data fetching
  • 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:testRun Go 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