<< back to Guides

🧩 Backends-for-Frontends (BFF) β€” Quick Guide

Backends-for-Frontends (BFF) is a design pattern where you create a dedicated backend for each frontend (e.g., web, mobile, IoT). It helps tailor API responses, reduce over-fetching, and decouple frontend and backend teams.


πŸ”§ What Is BFF?

A BFF is a service layer that sits between frontend applications and backend APIs or services. Each frontend (like Web, iOS, Android) can have its own BFF that caters specifically to its needs.


🎯 Why Use BFF?


🧱 Common Patterns

1. Device-Specific BFFs

Create separate BFFs for Web, Mobile, and others.

2. Unified Gateway + BFF

Use an API Gateway for routing + lightweight BFFs for logic.

3. Micro-BFFs

Frontend teams own and deploy their own micro-BFFs per domain or module.

4. Monolith BFF

One BFF service handles all frontend types. Useful for small teams.


βš™οΈ Responsibilities of a BFF


πŸ“¦ Example Use Case

GET /dashboard (from Mobile BFF)
β†’ Aggregates:
   - User Profile Service
   - Notifications Service
   - Billing Service
β†’ Returns mobile-optimized response

πŸ›‘ When Not to Use BFF


βœ… Best Practices


🏁 Summary

Benefit Description
Tailored APIs Custom responses per device
Frontend Agility Changes in BFF don’t require backend changes
Simplified Frontend Aggregates and flattens complex data
Decoupled Logic Keeps UI logic out of core services
<< back to Guides