A professional, scalable Expense Tracking SaaS Backend built with .NET 9, following the principles of Clean Architecture and Domain-Driven Design (DDD). Designed to be the robust core for a modern financial management dashboard.
This project is structured around the Dependency inversion principle, ensuring the core domain logic is decoupled from external frameworks and UI.
graph TD;
API[Presentation Layer (API)] --> Application;
Infrastructure --> Application;
Application --> Domain;
Infrastructure --> Domain;
- ExpenseTracker.Domain: The heart of the system. Contains Entities, Enums, and Repository Interfaces. No dependencies.
- ExpenseTracker.Application: Business logic, DTOs, Validators, and Service Interfaces. Orchestrates data flow.
- ExpenseTracker.Infrastructure: Implementation of data access (EF Core), external services, and repositories.
- ExpenseTracker.API: The entry point. Controllers, Middleware, and Dependency Injection configuration.
- Core: .NET 9.0, C# 12
- Data Access: Entity Framework Core, Repository Pattern
- Database: MySQL 8.0
- Validation: FluentValidation
- Mapping: AutoMapper
- Logging: Serilog (Structured Logging)
- Documentation: Swagger / OpenAPI (with JWT Auth support)
- Authentication: JWT (JSON Web Tokens) with Refresh Tokens
- Security: BCrypt hashing, CORS policies, Exception Handling Middleware
- .NET 9.0 SDK
- MySQL Server
Pre-requisite: Make sure you have Docker and Docker Compose installed.
-
Clone the repository
git clone https://github.com/your-username/ExpenseTracker.git cd ExpenseTracker -
Run with Docker Compose
docker-compose up --build
-
Access the App
- Frontend: http://localhost:3000
- API Swagger: http://localhost:5062/swagger
Note: If running for the first time, you may need to apply migrations manually or simply let the API initialize.
-
Configure Database Update
appsettings.jsonor preferably use User Secrets:"ConnectionStrings": { "DefaultConnection": "Server=localhost;Port=3306;Database=ExpenseTrackerDb;User=root;Password=YOUR_STRONG_PASSWORD;" }
-
Run Migrations
dotnet ef database update --project ExpenseTracker.Infrastructure --startup-project ExpenseTracker.API
-
Run the API
dotnet run --project ExpenseTracker.API
-
Explore Navigate to
https://localhost:7139/swaggerto view the interactive API documentation.
The solution includes a dedicated test project ExpenseTracker.Tests using xUnit and FluentAssertions.
dotnet test- Docker Support: Containerize the API and Database.
- CI/CD Pipeline: GitHub Actions for automated testing and deployment.
- Role-Based Access Control (RBAC): Admin vs User roles.
- Reporting Service: Background jobs for generating monthly PDF reports.
Developed by Adham - Backend Engineer