← Lessons

quiz vs the machine

Gold1360

System Design

The Backend for Frontend

Give each client type a tailored gateway instead of one generic API.

4 min read · core · beat Gold to climb

One API for all clients hurts

A single generic API must serve web, mobile, and partners at once. Mobile then over fetches data it cannot show, and each client bends the API in conflicting ways.

The BFF pattern

A Backend for Frontend is a dedicated gateway per client type. Each BFF:

  • Shapes responses for exactly that client.
  • Aggregates calls to downstream services.
  • Holds client specific logic out of the core services.

Benefits

  • Tailored payloads cut mobile bandwidth and round trips.
  • Teams owning a client own its BFF, so they move fast.
  • Core services stay generic and stable.

Costs

You now run more gateways and may duplicate some logic across BFFs. Keep shared concerns, like auth, in common libraries to limit drift.

Key idea

A Backend for Frontend gives each client a tailored gateway, reducing over fetching at the cost of more gateways to run.

Check yourself

Answer to earn rating on the learn ladder.

1. What problem does a Backend for Frontend solve?

2. What is a cost of the BFF pattern?