Api Design medium
Your microservices architecture has 20 services. Each has its own auth, rate limiting, and logging. You introduce an API Gateway. What does it centralize?
- A Cross-cutting concerns such as authentication, request routing, rate limiting, and request/response logging, simplifying the underlying microservices.
- B The core business logic and domain validation rules, ensuring that every microservice remains a thin wrapper around a shared central controller.
- C Database connection pooling and object-relational mapping (ORM) logic to provide a unified data access layer for all downstream services.
- D The static asset hosting and frontend template rendering (SSR) logic to reduce the load on the client-side browser and improve SEO scores.
Answer: A. Cross-cutting concerns such as authentication, request routing, rate limiting, and request/response logging, simplifying the underlying microservices.
An **API Gateway** acts as a single entry point for a system, centralizing **cross-cutting concerns** such as authentication, termination, rate limiting, and request routing. This simplifies individual microservices, allowing them to focus purely on business logic rather than reimplementing shared infrastructure concerns.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- You're designing a REST API for a blog. Which endpoint best represents 'get all comments for post 123'?
- A client wants to update only the 'status' field of an order, leaving other fields unchanged. Which HTTP method is most appropriate?
- A client calls POST /users with valid data, and the user is created. What status code should the server return?
- A client retries a failed 'POST /payments' request due to network timeout. The server receives the request twice. Without idempotency handling, what can happen?
- An API returns 10,000 products. Returning all in one response is impractical. Which pagination approach is simple and stateless?
- Your API serves both mobile apps and third-party integrations. Which authentication method is most appropriate?