A deterministic, fail-fast API Gateway for modern microservices.
A lightweight, modern API Gateway written in Go. Designed for simplicity, reliability, and ease of use in microservices architectures. Currently in early development — APIs may change.
# Clone and start with Docker Compose
git clone https://github.com/pietroagazzi/gater.git
cd gater
docker compose up --build -dThe gateway is available at http://localhost:8080 and the Consul UI at http://localhost:8500.
# Verify the gateway is running
curl http://localhost:8080/healthGater uses two YAML files in the config/ directory.
Defines how incoming requests map to backend services:
routes:
- path: /users
service_name: user-service
methods: [GET, POST, PUT, DELETE]
priority: 1
- path: /v2/users
service_name: user-service
methods: [GET, PUT, DELETE]
priority: 2
- path: /posts
service_name: post-service
methods: [GET, POST, DELETE]| Field | Description |
|---|---|
path |
URL prefix to match incoming requests |
service_name |
Service name to route to (must match discovery registry) |
methods |
Allowed HTTP methods |
priority |
Route evaluation order (higher = evaluated first) |
Configures per-service resilience policies:
services:
user-service:
service_name: user-service
resilience:
circuit_breaker:
recovery_timeout: 30s
post-service:
service_name: post-service
resilience:
circuit_breaker:
recovery_timeout: 20s| Field | Description |
|---|---|
service_name |
Must match the name in the discovery registry |
recovery_timeout |
Time the circuit breaker waits before allowing retries |
- Deterministic — No hidden defaults or magic behavior. Every configuration value is explicit.
- Fail-fast — Invalid configuration, unreachable dependencies, and bad input are caught at startup, not at request time. Constructors verify connectivity and reject incomplete state before returning.
- Interface-driven — Core components (service discovery, load balancing, circuit breaking) are defined as interfaces, making providers pluggable and the entire stack testable with mocks.
- Composable — Infrastructure concerns are layered as
http.RoundTripperdecorators (validation, circuit breaking, transport), each with a single responsibility.
- Go 1.26+
- Docker
- pre-commit
docker compose -f docker-compose.dev.yml up --buildEdit files under cmd/ or internal/ and Air will rebuild and reload automatically.
pip install pre-commit
pre-commit installRuns formatting, linting, and tests automatically on commit.
Run all tests with:
go test ./...Or with docker:
docker compose -f docker-compose.test.yml -p gater-test up --build --abort-on-container-exit && \
docker compose -f docker-compose.test.yml -p gater-test downPull the pre-built image from GitHub Container Registry:
docker pull ghcr.io/pietroagazzi/gater:latestThe image supports linux/amd64 and linux/arm64 architectures.
Download pre-built binaries from the Releases page.
go build -o gater ./cmd/gater- Fork the repository
- Create a branch following Conventional Branch naming
- Commit using Conventional Commits
- Push to the branch
- Open a Pull Request
Please ensure all tests pass and pre-commit hooks are clean before submitting.
Built with:
- Gin — HTTP framework
- Consul API — Service discovery
- gobreaker — Circuit breaker