Kinoko's TIL Log

BFF 101

The Point

BFF (Backend For Frontend) is an architecture pattern where you build a dedicated backend layer for each frontend client, instead of having all clients share a single API.

Explanation

Why do you need BFF?

Different clients have very different data needs. Take an e-commerce platform as an example:

With a single shared API, two problems arise:

BFF adds a layer between clients and backend microservices:

Mobile App  →  Mobile BFF  ┐
Web App     →  Web BFF     ├─→  microservices
Partner API →  Partner BFF ┘

Each BFF handles:

  1. Aggregating responses from multiple microservices (one request instead of many)
  2. Trimming data to the format that specific client needs
  3. Client-specific logic (e.g. mobile pagination)

Who maintains the BFF?

Usually the frontend team, so they can adjust the API format on their own without waiting for backend changes.

Knowledge Sugar

BFF vs API Gateway

These are easy to confuse, but they serve different purposes:

BFFAPI Gateway
PurposeTrim data for a specific clientTraffic routing, auth, rate limiting
Maintained byFrontend teamPlatform / infra team
CountOne per client typeUsually one

In practice they can coexist – the API Gateway sits in front handling common concerns, while BFFs sit behind it doing client-specific data aggregation.

When do you not need BFF?

#architecture #api-design #til

← Back to Main Page