Course contentsShow
← System Design
Lesson 904 of 1,91923. API Gateway PatternFree lesson

BFF vs Single Gateway Tradeoffs

Comparing a single shared gateway to multiple BFFs: duplication vs optimization, maintenance vs performance, and when each fits.

BFF vs Single Gateway Tradeoffs

What You'll Learn

You'll understand when to use a single shared API gateway versus multiple Backend-for-Frontend (BFF) gateways, and the key tradeoffs involved.

The Core Decision

Imagine you're building entrances to a building. You could have one main entrance (single gateway) where everyone uses the same door, or separate entrances (BFFs) optimized for different groups—one for delivery trucks, one for office workers, one for customers. Each approach has distinct advantages.

A single shared gateway routes all clients (web, mobile, IoT) through one system, while multiple BFFs give each client type its own dedicated gateway.

Single Gateway Benefits

  • Less duplication: Write authentication, rate limiting, and logging logic once
  • Simpler operations: One service to deploy, monitor, and scale
  • Consistency: All clients experience the same security and routing rules
  • Lower infrastructure costs: Fewer running services

BFF Benefits

  • Client optimization: Each BFF tailors responses perfectly for its client (mobile gets compact JSON, web gets richer data)
  • Independent evolution: Teams can modify the mobile BFF without affecting web clients
  • Performance tuning: Mobile BFF can implement aggressive caching; web BFF can prioritize real-time updates
  • Team autonomy: Mobile and web teams control their own gateways

The Tradeoff Reality

Single gateways favor standardization and simplicity but may force compromises ("lowest common denominator" APIs). BFFs favor optimization and flexibility but increase maintenance burden and potential inconsistency.

Choose a single gateway when your clients have similar needs and you value operational simplicity. Choose BFFs when client requirements diverge significantly and you have teams capable of managing multiple gateways.

Key Takeaway: Single gateways minimize duplication and operational overhead, while BFFs maximize client-specific optimization at the cost of maintenance complexity—choose based on how different your client needs truly are.