This is sample banking API that uses .NET 7 & C# 11. It includes most popular technologies, concepts and patterns. To insure quality I performed unit tests & integration tests. And finnaly everything is dockerized and built with aid of Azure DevOps CI/CD & Docker.
Image 1. Overview of API Architecture & used technologies
Image 2. Request pipline
- .NET 7 & C# 11
- PostgreSQL with Dapper
- FluentMigrator for migrations
- Swagger UI with OpenAPI 3.1
- Redis for caching
- XUnit for testing
- Docker & Kubernetes for deployment
- Custom middleware for logging, API versioning, request throttling and migrations
- Custom Attributes & Filters to reduce boiler plate code in controllers (BadRequests, InternalServerErrors, NotFound, Caching)
- Extension methodes to extract service registry and middleware registry from Program.cs
- Using IDisposable & Garbage Collector to free unused resources
- Asynchronous programming
- Func<,> , Spans, Tuplets & Deconstructing, Collections, Locks, params, ...
- Unit Of Work pattern to perform transactions on cash transfers from accounts
- Repository pattern to abstract repositoires, services from consumers
- Factory pattern to create database connections
- Singleton, Transient and Scoped for DI
- Unit tests for repositories, controllers, caching
- Integration testing of PostgreSQL database connection and transaction
- Dockerization and orchestration of API, PostgreSQL database, Redis Caching and other tools
- Azure CI/CD Piplines
- Kubernetes for orchestration or docker compose
To run all required containers with Docker compose orchestration :
docker-compose up
You can use Kubernetes but first you have to push the api image to Docker Hub or other container registry.
Then deploy to Kubernetes use following command in your terminal:
kubectl apply -f deployment.yml
kubectl apply -f service.yml
Author: Armin Smajlagic