A scalable and maintainable backend system for a multi-vendor marketplace, built using modern .NET technologies and clean software architecture principles.
- Framework: ASP.NET Core (.NET 10)
- Language: C# 14
- Architecture: Clean Architecture (Layered + CQRS)
- Mediator Pattern: MediatR 12
- Database: PostgreSQL
- ORM: Entity Framework Core
- Patterns: Generic Repository + Unit of Work
- Migrations: EF Core CLI
- Authentication: ASP.NET Core Identity
- Authorization: Role-Based Access Control (RBAC)
- Background Jobs: Hangfire
- Containerization: Docker
- API Docs: Swagger / OpenAPI
- Testing Tools: Postman
The project follows Clean Architecture principles:
- Domain Layer: Core business logic and entities
- Application Layer: Use cases, DTOs, interfaces, validation
- Infrastructure Layer: Database, external services, background jobs
- Presentation Layer: API controllers and endpoints
Key design patterns:
- CQRS (Command Query Responsibility Segregation)
- Dependency Injection
- Separation of Concerns
- Vendors manage their own products
- Orders can contain items from multiple vendors
- Vendor-specific order tracking
- Automatic stock reservation on order creation
- Background job releases stock for unpaid orders
- Prevents inventory inconsistencies
- Scheduled and recurring jobs using Hangfire:
- Order expiration handling
- Stock synchronization
- Notification triggers
- Identity class Authentication
- Role-based access (Admin, Vendor, Customer)
- Secure password hashing and validation
- RESTful API conventions
- Proper HTTP status codes
- Centralized validation using FluentValidation
- Global exception handling middleware
- Standardized API response format
- Asynchronous programming (async/await)
- Pagination for large datasets
- Optimized queries with EF Core
- Caching strategy
- Input validation and sanitization
- token protection
- HTTPS enforcement
- Rate limiting
- Structured logging
- Request/response logging
- Health checks endpoint
git clone https://github.com/birukdjn/ecommerce.git
cd ecommerceUpdate appsettings.json or use environment variables:
- Database connection string
- External service keys
dotnet ef database updateOption 1: Using Docker
docker-compose up --buildOption 2: Using dotnet run
dotnet restore
dotnet build
dotnet run --project ApiAfter running, Swagger UI is available at http://localhost:5188/swagger or https://localhost:7023/swagger
src/
├── Domain/
│ ├── Common/
│ ├── Constants/
│ ├── Entities/
│ └── Enums/
│
├── Application/
│ ├── DTOs/
│ │ ├── Address/
│ │ ├── Admin/
│ │ ├── ...
│ │ ├── ...
│ │ └── Wallet/
│ ├── Features/
│ │ ├── Products/
│ │ │ ├── Commands/
│ │ │ └── Queries/
│ │ ├── Orders/
│ │ ├── Users/
│ │ ├── ...
│ │ ├── ...
│ │ └── Wallets/
│ ├── Interfaces/
│ ├── Templates
│ │ ├── Email/
│ └── DependencyInjection.cs
│
├── Infrastructure/
│ ├── BackgroundJobs/
│ ├── Configurations/
│ ├── Context/
│ ├── Extensions/
│ ├── Identity/
│ ├── Migrations/
│ ├── Options/
│ ├── Repositories/
│ ├── Services/
│ └── DependencyInjection.cs
│
├── API/
│ ├── Controllers/
│ ├── Middleware/
│ ├── Filters/
│ ├── Extensions/
│ ├── Properties/
│ ├── DependencyInjection.cs
│ ├── Dockerfile
│ ├── appsettings.json
│ └── Program.csBiruk Dejene
- LinkedIn: https://linkedin.com/in/birukdjn
- Portfolio: https://birukdjn.vercel.app