View on GitHub
Clean Architecture Toolkit for .NET
Clean Architecture Toolkit is a clean, modular architecture foundation for .NET applications.
It embraces SOLID principles and focuses on maintainability, testability, and scalability through clear boundaries and pluggable design.

|   HOME   |   MODULE OVERVIEW   |   DEMO   |

Plans for Cat.Api.Gateway

The single front door of an application: it routes the calls of clients and services to the right service and checks the token in one place.
Status: not started. This plan collects what we know. The open questions need an answer before the build.

Contents

The idea

The application architecture of the toolkit has an API gateway. Clients only talk to it, and so do services that need something from another service. Every team that follows the architecture has to build that gateway itself: the routes, the token check, the forwarding and the health checks. Most of it is the same in every application.

Cat.Api.Gateway gives the gateway a standard shape. A developer picks it when they want the architecture as it is described, and leaves it out when they use another gateway. It holds no business logic. It only routes, and it does the cross-cutting work that belongs at the door.

It sits between two other modules. Cat.Api.Client is the caller side of a service to service call and sends it to the gateway. Cat.Authorization makes the service check the token again, because the gateway and the service both validate it.

What we already know

From the root readme:

From the demo plan:

From the other module plans:

From the module conventions:

Decisions and open questions

Decided

Topic Decision
Name Cat.Api.Gateway. The owner decided that the gateway is a module.
Job The single front door. It routes the calls of clients and services. It holds no business logic. See the root readme.
Token The gateway validates the token and forwards it unchanged. The service validates it again. See the demo plan.
Aspire The module never references Aspire or ServiceDefaults.

Open

Questions before building

  1. Do we build on YARP, or write our own router?
  2. Is the module a library of extensions, a ready made host, or both?
  3. Where do the routes come from: configuration, code or the services?
  4. Does the gateway only check that a token is valid, or also rules such as a role?
  5. Which duties are in the first version besides routing and the token check?
  6. How does a route say that it is public?
  7. Is token exchange for service to service calls in scope?
  8. How does the gateway find the services outside Aspire?
  9. May a developer use another gateway, such as Azure API Management, and still use Cat.Api.Client?
  10. Should the first version wait until the demo gateway of stage 2 works, as Cat.Api.Client waits for CatalogPriceProvider?