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.
-
.NET 9.0
-
Entity Framework Core
-
PostgreSQL
-
AutoMapper, MediatR, FluentValidation, Npgsql, Swagger/Swashbuckle
-
Prometheus, OpenTelemetry
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.
- .NET 9 SDK: Download .NET 9 SDK (Direct Download)
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
-
PostgreSQL(Version 12+): Download PostgreSQL
-
IDE: Visual Studio, Rider, or VS Code
- Visual Studio: Download Visual Studio
- Rider: Download Rider
- VS Code: Download VS Code
(Personally, I prefer to use Rider or Visual Studio).
-
Prometheus:
Linux
Ubuntu/Others + SNAP: sudo snap install prometheus
Fedora: sudo dnf install prometheus
MacOS
brew install Prometheus
Windows + Chocolatey
choco install prometheus
• 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...