Skip to content

Simple CRUD API .NET 9 + Clean Architecture + Prometheus + Open Telemetry + Polly

Notifications You must be signed in to change notification settings

ThiagoIsland/Net9GenericAPI

Repository files navigation

Generic CRUD API in .NET: Overview

This project demonstrates a clean, modular, and scalable implementation of a CRUD (Create, Read, Update, Delete) API built using .NET 9 and PostgreSQL, following the Clean Architecture principles.

The repository can be used as a template for other projects requiring a structured, testable, and maintainable back-end service.

Technologies Used

  • .NET 9.0

  • Entity Framework Core

  • PostgreSQL

  • AutoMapper, MediatR, FluentValidation, Npgsql, Swagger/Swashbuckle

  • Prometheus, OpenTelemetry

Architecture

The API adheres to Clean Architecture principles:

  • Domain/Core Layer: Contains the core logic and entities.

  • Application Layer: Handles use cases, DTOs, and business rules.

  • nfrastructure/Infra Layer: Database access, repositories, and external services.

  • API Layer: Exposes endpoints and manages incoming requests.

Pre-requisites

Linux - Ubuntu/Debian
wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt update
sudo apt install -y dotnet-sdk-9.0
MacOS 
  brw install --cask dotnet-sdk
Windows
  winget install Microsoft.DotNet.SDK.9
  or
  choco install dotnet-sdk
  Linux
    Ubuntu/Others + SNAP: sudo snap install prometheus
    Fedora: sudo dnf install prometheus
  MacOS
    brew install Prometheus
  Windows + Chocolatey
    choco install prometheus

Things I still pretend to implement:

•⁠ ⁠Other CRUD methods (Add User/Pessoa, Edit User/Pessoa, Remove User/Pessoa) and Dependency Injection

•⁠ ⁠Repository Layer and all others principles and concepts who makes this API be Clean ARCH

•⁠ ⁠Prometheus.NET and OpenTelemetry for observability, metrics collection and the API perfomance

•⁠ ⁠Polly: A library that improves resiliency to your appliaction aplying strategies like Circuit Breaker, Retry, Timeout, etc...

About

Simple CRUD API .NET 9 + Clean Architecture + Prometheus + Open Telemetry + Polly

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages