↑ ↓ move · Enter open · Esc close

← All projects

GATEWAY

API Gateway

Mutual Trust Bank PLC · 05/2026 - Present

A single, hardened front door for money-movement APIs, built on YARP.

  • .NET
  • YARP
  • Redis
  • Polly
  • JWT
  • Health checks
Customer append-user JWTInternal serviceservice JWTPartnerAPI keyAuth policyRate limitResilienceRedisCBS MiddlewareFuture serviceFuture servicerejected over the limit
  1. Client
  2. Auth policy
  3. Rate limit (Redis)
  4. Resilience pipeline
  5. Service cluster

The problem

// Context

Services were exposed with inconsistent authentication and per-instance rate limiting. A gateway had to protect money-movement routes under load spikes without retrying anything unsafe.

Approach

// What I built
  • YARP chosen over alternatives for raw throughput on the hot routes.
  • Three authentication schemes (end-user JWT, internal service JWT, partner API key) selected per route by authorization policy.
  • Redis-backed rate limiting coordinated across gateway replicas; Redis is a hard dependency that fails fast at startup.
  • A Polly pipeline per cluster: bulkhead, timeout, circuit breaker and optional retry. Retries are never enabled on money routes.
  • Correlation IDs, security headers, CIDR-gated internal routes and config-toggled routes.

Decisions and trade-offs

// Why it is built this way

YARP instead of Ocelot

Chosen for raw throughput on money-movement routes during load spikes.

Redis-backed rate limiting

Per-instance in-memory limits cannot be coordinated across replicas, so a client could multiply its allowance by the replica count.

No retries on money routes

A retry after a timeout can post the same transfer twice.

One project, no MediatR

A proxy has no business logic to protect, so extra layers would add ceremony without benefit.

Outcomes

// Result
  • A clear, documented decision record for the gateway choice.
  • Safe-by-default behaviour: no silent degradation and no double-posting from retries.
An unhandled error has occurred. Reload 🗙