The Bank API is a design reference project suitable to bootstrap development for a compliant and modern API.
-
ASP.NET Core 9.0 - Minimal API for API development, with following base services:
-
Resilience for resilience when calling downstream APIs
-
Compliance for redacting sensitive data
-
Health checks for checking health status
-
Service Discovery for resolving endpoints from config
-
Hybrid Cache for caching
-
Rate limiting for rate limiting
-
API Key, JWT bearer and OpenID Connection-based authentication for security
-
OpenApi for generating OpenAPI specifications
-
-
OpenTelemetry (OTel) for observability
-
.NET Aspire for development bootstrapping and client integrations
-
Kiota API client generation for calling downstream APIs
-
Gridify for filtering, ordering and paging
-
Scalar for interactive API documentation
-
Spectral for linting
-
OpenApiAnyFactory from Swashbuckle.AspNetCore for parsing JSON to
IOpenApiAnytypes -
TUnit for unit tests
-
REST Client extension in Visual Studio Code for quick local tests via
.httpfiles
If not using the Dev Container, install:
-
(Optionally) regenerate the GitHub downstream API client by going to the Kiota workspace and clicking
Re-generateunderclients. -
Generate a new JWT-token for secured endpoints:
dotnet user-jwts create --scope "bank_api" --role "banker"
-
Run
dotnet buildto output the OpenAPI definition -
Validate the OpenAPI definition by going to the generated.json definition and check for problems via the Spectral extension.
This mode just runs the ASP.NET Core API.
-
Start the standalone Aspire Dashboard for developer visualization:
docker run --rm -it ` -p 18888:18888 ` -p 4317:18889 ` --name aspire-dashboard ` mcr.microsoft.com/dotnet/aspire-dashboard:latest
Copy the url shown in the resulting output when running the container, and replace
0.0.0.0withlocalhost, eg http://localhost:18888/login?t=123456780abcdef123456780 and open that in your browser, or you can also paste the key after/login?t=when the login dialog is shown. The token will change each time you start the container. -
Run the launch config
C#: Api Debug (with standalone Aspire).
This mode starts the API in the context of .NET Aspire. Do not run in Aspire mode inside the Dev Container, it is not yet suitable for that.
-
Make sure the docker runtime is started.
-
Run the launch config
C#: App Host Debug (via Aspire).
-
OpenID Connect isn't fully supported in Scalar yet: scalar/scalar#3656
-
Running tests works in VSCode. However, debugging tests doesn't work with TUnit in VSCode yet, please see: microsoft/vscode-dotnettools#1616 (comment)
-
To extend OpenTelemetry logging to Application Insights, expand the OpenTelemetry exporter
Please see the Reddit r/dotnet post about this project for more considerations and information.
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.


