An application that implements a Command Query Responsibility Segregation (CQRS) and Event Sourcing framework to implement and manage a shopping basket system using EventFlow framework.
Features
- Event Store and Read Model/Database using EntityFramework Core (InMemory Provider)
- Swashbuckle to generate API documentation + UI to explore and test endpoints
- AutoRest to generate a client library
- Validation done with FluentValidation
Core Requirements
- .NET Core 2.1
# build
dotnet build -c Release -o src/ShoppingBasket.WebApi
# start the app
dotnet src/ShoppingBasket.WebApi/bin/Release/netcoreapp2.1/ShoppingBasket.WebApi.dll
# access
https://localhost:5001/swagger # -- this will open Swagger UI
System is based on the Onion Architecture
CQRS/ES using EventFlow
- Product management is done externally
- Customer account already exists in the system
POST /api/v1/basket
{
"customerId": "eb042700-242e-49ee-9a5b-842a9cabb455"
}
GET /api/v1/basket/{basketId}
POST /api/v1/basket/{basketId}
{
"productName": "Product 1",
"price": 10.99,
"quantity": 2
}
PUT /api/v1/basket/{basketId}
{
"productName": "Product 1",
"quantity": 4
}
DELETE /api/v1/basket/{basketId}
{
"productName": "Product 1"
}
DELETE /api/v1/basket/{basketId}/clear
- API doc is also available via Swagger and testing can be done by Swagger UI (https://localhost:5001/swagger)