| technology | Microservices | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| domain | backend | ||||||||||
| level | Senior/Architect | ||||||||||
| version | Agnostic | ||||||||||
| tags |
|
||||||||||
| ai_role | Senior Microservices Architect | ||||||||||
| last_updated | 2026-03-27 |
// Client talks directly to multiple microservices
fetch('http://user-service:3000/users');
fetch('http://order-service:4000/orders');Exposing individual microservices directly to clients creates security risks, forces the client to handle aggregation, and makes API versioning difficult.
// Client talks to API Gateway
fetch('https://api.example.com/graphql');Note
Internal Routing: For more context, refer back to the Microservices Index.
Implement an API Gateway or Backend-for-Frontend (BFF) pattern to act as a single entry point, handle cross-cutting concerns (auth, rate limiting), and aggregate responses.
graph TD
A[Client App] --> B[API Gateway]
B --> C[User Service]
B --> D[Order Service]
classDef default fill:#e1f5fe,stroke:#03a9f4,stroke-width:2px,color:#000;
classDef component fill:#e8f5e9,stroke:#4caf50,stroke-width:2px,color:#000;
classDef layout fill:#f3e5f5,stroke:#9c27b0,stroke-width:2px,color:#000;
class A layout;
class B component;
class C component;
class D component;