It is a work-in-progress API Gateway built in Go, designed for learning and experimentation. It includes various essential features commonly found in production API Gateways.
If you are looking for an actual lightweight production grade api-gateway checkout motiv-labs/janus
Features:
- URL Rewriting
- Rate Limiting (ref: https://pkg.go.dev/golang.org/x/time/rate & https://blog.logrocket.com/rate-limiting-go-application/)
- Throttling
- Authentication (ref: https://konghq.com/blog/engineering/jwt-kong-gateway)
- Caching (ref: https://github.com/patrickmn/go-cache)
- TLS Termination
- Orchestration/Aggregation (Ambitious feature) (really cool tho)
- Protocol Translation
- IP Whitelisting
- Circuit Breaker (ref: https://github.com/sony/gobreaker)
- Logging (ref: https://betterstack.com/community/guides/logging/logging-in-go/ & https://pkg.go.dev/golang.org/x/exp/slog)
- Tracing / Metrics (ref: https://prometheus.io/docs/guides/go-application/)
To get started with go-api-gateway, clone the repository and follow the setup instructions below.
- Go (version 1.22 or later)
- Docker (for containerization and deployment)
- Install dependencies
go mod download
- Build and run the gateway
make run
This will start the gateway(locally) on port 8080.
OR
make image
make run_image
This will build the docker image and run the gateway in a container.
Configuration options can be found in the config.yaml
file. Customize it as needed for your environment/use case.
Feel free to contribute to this project by adding more features, improving existing ones, or fixing bugs. Let's build something amazing together!