Skip to main content
  1. References/
  2. Architecture Design Basics/
  3. Pattern Taxonomy/
  4. Communication & API Design/

Backend for Frontend (BFF)

·· 178 words· 1 min

🟠 P1 — solves the “one API doesn’t fit all clients” problem

Problem #

Mobile clients need minimal payloads and few round-trips. Web clients need richer data. Admin dashboards need different views entirely. A single generic API serves none of them well.

Mechanism #

Mobile App     Web App     Admin Dashboard
    ↓              ↓              ↓
Mobile BFF     Web BFF     Admin BFF        ← per-client API layer
    ↓              ↓              ↓
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               ↓
        Shared Backend Services

Each BFF is a thin service that:

  • Aggregates calls to multiple backend services
  • Transforms responses to client-specific shapes
  • Optimises payload size and round-trips for its client

Key Trade-offs #

DimensionBFF approachSingle API approach
Client UXTailored per-clientCompromise for all clients
MaintenanceMultiple API surfaces to maintainSingle surface
DuplicationLogic can duplicate across BFFsNo duplication
Team ownershipClient teams own their BFFAPI team owns everything

Instinct #

BFF is justified when you have genuinely different client requirements — not just “mobile vs web.” If the data shape and round-trip requirements truly differ, BFF pays for itself. If clients differ only in styling/presentation, a single API with sparse fieldsets (or GraphQL) is simpler.

References #