Core Architectural & Structural Patterns
Master the foundational microservice design patterns: API Gateway, Strangler Fig, Backend-for-Frontend (BFF), Aggregator, and Database-per-Service.
Microservices architecture is not merely splitting code into smaller repositories; it is about organizing boundaries, managing distributed state, and structuring communication contracts.
Over the last decade, the software engineering industry has crystallized proven solutions to recurrent architectural problems: the Microservices Design Patterns.
01The Backend for Frontend (BFF) Pattern
The Problem Statement
A desktop web browser on high-speed fiber needs rich, detailed product views with large images, full customer reviews, and side-by-side spec comparisons. Conversely, a mobile phone on a congested cellular network needs a lightweight, compact JSON payload with small thumbnails to conserve battery and data bandwidth.
If a single monolithic API serves both, mobile clients suffer from Over-fetching (downloading hundreds of unused JSON fields) and Chatty Network Calls (executing 6 consecutive HTTP requests to render one screen).
The Solution: BFF
Create separate, dedicated edge gateway layers tailored specifically to each client interface:
mobile-bff: Strips unnecessary JSON fields, downsamples image URLs, and aggregates multiple backend calls into one lightweight response.web-bff: Serves complete metadata, high-resolution media galleries, and server-side rendered (SSR) markup for SEO.
Trade-Offs
- Advantages: Client teams gain autonomy to deploy their own BFF without waiting for backend changes; mobile app latency drops dramatically.
- Disadvantages: Code duplication across BFFs if not governed properly; additional operational hops to deploy and monitor.
Loading the rest of the lesson…