Skip to content

.NET 7 & C# 11 Sample Banking API with caching, unit of work, enhanced pipeline and more...

License

Notifications You must be signed in to change notification settings

ArminSmajlagic/.NET-7-Banking-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

.NET 7 & C# 11 Sample Banking API

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.

Diagrams

Image 1. Overview of API Architecture & used technologies

Image 2. Request pipline

Technologies

  • .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

C# & .NET Features

  • 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, ...

Design patterns

  • 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

Testing

  • Unit tests for repositories, controllers, caching
  • Integration testing of PostgreSQL database connection and transaction

DevOps

  • 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

and to make it available through TCP protocol you have to run Load Balancer with the following command :

kubectl apply -f service.yml

Author: Armin Smajlagic

Releases

No releases published

Packages

No packages published