API Gateway Template¶
Repository: ConnectSoft.ApiGatewayTemplate
Short name: connectsoft-apigateway
Layer: 3 (extends ConnectSoft.BaseTemplate via base-template/ submodule)
Purpose¶
The API Gateway template scaffolds a .NET ASP.NET Core host that acts as the edge for HTTP traffic to downstream microservices. It is designed for:
- Reverse proxy / YARP-style routing to internal services
- Perimeter authentication (e.g. JWT validation, forwarding identity headers)
- Rate limiting, compression, CORS, and feature-flag–aware behavior
- Backend-for-Frontend (BFF) patterns: shape APIs per channel (web, mobile, partner) without duplicating domain logic
- Observability at the edge (OpenTelemetry, optional collector stacks)
It is not a domain service: business rules and aggregates belong in Microservice Template or SaaS templates behind the gateway.
Architectural role¶
flowchart LR
Client[Clients]
GW[Api Gateway host]
MS[Microservices]
Id[Identity / Auth]
Client --> GW
GW --> MS
GW --> Id
- Northbound: public or partner HTTP(S).
- Southbound: internal REST/gRPC services; often paired with Identity Backend and Authorization Server for token issuance and user claims.
Composition with Base Template¶
- Same three-layer DI as other web extended templates:
ApplicationModelRegistrationBase→MicroserviceRegistrationBase→ApiGatewayMicroserviceRegistration(or equivalent template registration type). - Central Package Management and conditional features inherit from Base; gateway adds routing, throttling, gateway-specific options.
Template packaging note¶
Listed in Templates registry. The checked-in .template.config/template.json in the gateway repo may be a stub; CI often merges Base template.json with template/apigateway.template.extend.json to produce the installer metadata. Treat dotnet new connectsoft-apigateway -h and pipeline outputs as authoritative for a given release.
Documentation map¶
| Section | Purpose |
|---|---|
| Getting Started | Install, run, Docker |
| Parameters | Scaffold flags and conditional features |
| Solution structure | Projects |
| Architecture | Edge, multi-tenancy, DI |
| Features | Routing, auth, tenants |
| Configuration | appsettings |
| Authentication | JWT, policies |
| Resiliency | Timeouts, rate limits |
| Testing | Test strategy |
| Development | Extend gateway |
| Use cases | BFF and edge scenarios |
| Runbook | Deploy, probes |
Related¶
- Microservice Template — services behind the gateway
- Template layering and reuse
- Repository ConnectSoft.ApiGatewayTemplate