Repository navigation
Technology Gateways and Key Management
Part of the Technology Evaluation. Should keys, limits and routing live in a separate gateway or key service, or in the API itself?
At the first stage, keys, limits, tiers and the licence gate live in the API process, and the existing TLS edge in front of it adds only a coarse per-IP ceiling and body-size limits. Reasons:
- A gateway adds a container, its own configuration language and its own memory, and still knows nothing about licences.
- Priority admission must sit next to the database pool to work; a gateway cannot see the pool.
- Key handling for this API (hashed keys, scopes, expiry, rotation, revocation, audit) is a few hundred lines of well-tested code.
- No third party should hold key-holder data.
| Option | Verdict | Reason |
|---|---|---|
| Existing TLS edge (reverse proxy) as a coarse guard | Recommended | nothing new to run; per-IP ceiling and body limits |
| KrakenD CE | Viable later | light and stateless; useful with several replicas or backends |
| Kong Gateway OSS | Rejected | open-source images appear to have stopped; advanced limits are commercial |
| Tyk OSS | Rejected | requires Redis; portal is commercial |
| Apache APISIX | Rejected | etcd or standalone complexity |
| Envoy | Rejected now | operational weight; its adaptive-concurrency idea is borrowed in-process |
| Zuplo | Rejected now | managed SaaS: key-holder data with a third party, cost, lock-in |
| Unkey | Rejected | self-hosting needs several heavy stores; managed version holds key data outside our hosting |
- An OpenResty-based gateway with key-auth and rate-limiting plugins.
- Estimated 150–300 MB plus a database or declarative config. Kong's installation pages list an older OSS line as the latest, and community reports say newer OSS images were not published; advanced rate limiting is enterprise-only.
- Licence. Apache-2.0 (source). Verdict: Rejected (a likely dead end for open source).
- A Go gateway with keys, quotas, rate limits and policies.
- Requires Redis; the dashboard and portal are commercial.
- Licence. MPL-2.0 (gateway). Verdict: Rejected at this scale: two extra containers and no licence awareness.
- A stateless Go gateway with declarative JSON configuration and token-bucket limits per endpoint and per client.
- Light (estimated 30–80 MB) and needs no database; but limits are per instance, key validation is header or JWT rather than a key store, and there are no tiers, admission or licence gate.
- Licence. Apache-2.0. Verdict: Viable later, as a thin edge if several API replicas or backends appear.
- An OpenResty gateway with key-auth and fixed-window counting; uses etcd or standalone YAML.
- Estimated 100–200 MB plus etcd; the default path stores secrets in etcd.
- Licence. Apache-2.0. Verdict: Rejected at this scale.
- Per-source rate-limit middleware and forward-auth. A reverse proxy already in front of the service adds nothing new to run.
- Not key-aware without calling back into the API.
- Licence. MIT (Traefik), Apache-2.0 (Caddy). Verdict: Recommended as a coarse edge guard only. All per-key logic stays in the API.
- A CNCF proxy with local and global rate limiting (the global one needs a separate service, usually with Redis) and an adaptive-concurrency filter.
- Best-in-class overload controls, but heavy to operate for one backend.
- Licence. Apache-2.0. Verdict: Rejected now. The adaptive-concurrency idea is planned in-process instead.
- A managed, programmable edge gateway with key management, a developer portal and monetisation.
- Key-holder data would sit with a third party (with data-protection paperwork), plus cost and lock-in.
- Verdict: Rejected now. Reconsider only if self-service sign-up becomes a goal.
- An open-source key and rate-limit service, managed or self-hosted.
- Self-hosting needs MySQL, Redis, ClickHouse and a vault service: far too heavy for the first stage's footprint. The managed version places key metadata outside our own hosting.
- Licence. AGPL-3.0 (to verify). Verdict: Rejected.
See Security and Access Keys for the design: high-entropy keys with checksum and prefix, HMAC with a pepper, scopes per source family, expiry, rotation with overlap, immediate revocation, audit log.
- Kong installation: https://developer.konghq.com/gateway/install/; community discussion: https://github.com/Kong/kong/discussions/14405
- Tyk: https://tyk.io/docs/
- KrakenD rate limit: https://www.krakend.io/docs/v2.9/backends/rate-limit/
- APISIX limit-count: https://apisix.apache.org/docs/apisix/3.6/plugins/limit-count/
- Traefik rate limit: https://doc.traefik.io/traefik/middlewares/http/ratelimit/; caddy-ratelimit: https://github.com/mholt/caddy-ratelimit
- Envoy adaptive concurrency: https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/adaptive_concurrency_filter
- Zuplo: https://zuplo.com/docs
- Unkey: https://github.com/unkeyed/unkey
ViaFrei API: a public, keyed, read-only REST API to live German mobility data. Design phase; nothing on these pages is a measurement of a running service. Data on viafrei.de and in every API answer is attributed to its publishers under their licences.
About
Design
- Domain Model
- API Design
- Architecture Overview
- Security and Access Keys
- Rate Limits and Priority
- Performance and Caching
- Configuration
- Observability
Data Model
Technical specification
-
Technical Specification
- Interface
- Scope, Conventions and References
- Protocol
- Common Envelope
- Resource Model
- Endpoints, Places
- Endpoints, Roads
- Endpoints, Energy and Parking
- Endpoints, Public Transport and Accessibility
- Endpoints, Weather Risk, Driving Rules and Composed Features
- Service Endpoints
- Errors
- Authentication and Authorisation
- Rate Limiting, Quotas and Priority
- Data Licensing and Attribution
- Compatibility and Versioning
- OpenAPI Skeleton
- Quality
- Delivery and operations
- Interface
Testing
- Testing Strategy
- Testing and Quality (design summary)
Engineering
Technology choice
- Technology Evaluation
- Architecture: Go
- Architecture: Rust
- Architecture: TypeScript
- Stack Comparison
- Benchmark Plan
Reference