The E-commerce Management API is a study project designed to apply and deepen knowledge of software architecture principles and patterns. This project focuses on implementing core functionalities of real-world e-commerce systems, including product management, user management, order processing, and payment handling.
Key principles and patterns applied in the project include:
- Domain-Driven Design (DDD)
- Clean Architecture
- CQRS (Command Query Responsibility Segregation)
- SOLID Principles
Although this is a study project, significant effort has been dedicated to ensuring the system is as close as possible to a production-ready e-commerce application.
The project includes an abstraction layer that emulates the behavior of real-world payment gateways. While no actual payment gateways are integrated and no real payments or charges are created, the abstraction mimics how payment processing works, including webhooks and transaction handling.
Click here to learn more about the API features and to see additional documentation.
You must have docker installed
- Clone and enter the repository
git clone [email protected]:ImVictorM/ECommerceManagement.git && cd ECommerceManagement
-
Create a
.env
file at the root to configure environment variables for Docker. Use the.env-example
file as a reference. -
Build and run the containers
docker-compose up -d --build
- Run the migrations
dotnet ef database update -p .\src\Infrastructure -s .\src\WebApi --connection "Host=localhost;Port=8010;Username=postgres;Password=postgres;Database=ecommerce-management;Trust Server Certificate=true;"
You must have dotnet and postgres installed
- Clone and enter the repository
git clone [email protected]:ImVictorM/ECommerceManagement.git && cd ECommerceManagement
- Configure the file
src/WebApi/appsettings.json
. Update theDbConnectionSettings
section with your database credentials as follows:
{
"DbConnectionSettings": {
"Host": "localhost",
"Port": "5432",
"Database": "ecommerce-management",
"Username": "your-username",
"Password": "your-password"
}
}
- Restore the dependencies
dotnet restore ECommerceManagement.sln
- Run the migrations
dotnet ef database update -p .\src\Infrastructure -s .\src\WebApi --connection "Host=localhost;Port=8010;Username=postgres;Password=postgres;Database=ecommerce-management;Trust Server Certificate=true;"
- Run the WebApi project
dotnet run --project ./src/WebApi
Note: The integration tests use TestContainer and Respawn to manage test databases dynamically using Docker containers. Ensure Docker is running on your system to execute integration tests successfully.
Command to run all tests:
dotnet test ECommerceManagement.sln
Command to run the unit tests:
Replace
{layer_name}
with the specific layer you want to test, such asDomain
,Application
, orSharedKernel
.
dotnet test ./tests/UnitTests/{layer_name}.UnitTests
Command to run the integration tests:
dotnet test ./tests/IntegrationTests
I separated this section to share some cool (and free) stuff I found when studying and creating this project.
Amichai Mantiband Playlist on Clean Architecture + DDD
Specifications by Eric Evans and Martin Fowler
Polymorphism in Entity Framework
CQRS and MediatR in ASP.NET Core
How Payment is Done using the Mercado Pago Service
Webhooks and Security