As systems grow, a "One Size Fits All" API Gateway can become a bottleneck. The BFF (Backend for Frontend) pattern offers a solution for complex multi-client applications.
Instead of one General API Gateway, you create specific entry points (BFFs) for each client type.
Mobile BFF: Calls the underlying microservices (User, Order, Inventory), stitches the data into a compact JSON specifically designed for the iOS screen, and sends it back.
Web BFF: Calls the same microservices, but aggregates detailed data specifically for the Desktop view.
Optimized Experience: The API matches the UI requirements perfectly. No over-fetching or under-fetching.
2.
Team Autonomy: The Mobile Team can write their own BFF code (e.g., in Node.js) to format data exactly how they want, without waiting for the Backend Team to change the core microservices.
3.
Encapsulation: If the Mobile App requires a specific legacy authentication flow, it stays in the Mobile BFF, not pollution the core system.