A .NET 10 RESTful API for an e-commerce platform built with a clean architecture using Wolverine for messaging and Marten for persistence (PostgreSQL).
- .NET 10 / ASP.NET Core
- Wolverine — message bus / CQRS handler dispatch
- Marten — document/event store on PostgreSQL
- Scalar — OpenAPI UI
- JWT Bearer authentication
src/
├── API/ # Controllers, Program.cs, config
├── Application/ # Commands, queries, DTOs, requests
├── Domain/ # Entities and domain logic
└── Infrastructure/ # Handlers, Marten setup, DI wiring
- .NET 10 SDK
- PostgreSQL running locally (default port 5432)
-
Create the database:
CREATE DATABASE ecommerce_db;
-
Update connection string in
src/API/appsettings.jsonif needed:"ConnectionStrings": { "DefaultConnection": "Host=localhost;Port=5432;Database=ecommerce_db;Username=postgres;Password=yourpassword" }
-
Update the JWT key in
appsettings.json:"Jwt": { "Key": "your-super-secret-key-min-32-chars!!" }
-
Run the API:
dotnet run --project src/API
-
Open the API docs at:
https://localhost:7283/scalar
| Resource | Methods |
|---|---|
| Catalog | GET, POST, PUT, DELETE products |
| Customers | GET, POST, PUT customers |
| Orders | GET, POST orders; confirm/ship/deliver/cancel |
| Inventory | GET, POST inventory adjustments |
| Payments | POST, GET payments |
| Setting | Description |
|---|---|
DefaultConnection |
PostgreSQL connection string |
Jwt:Key |
Secret key for JWT signing (≥32 chars) |
Jwt:ExpiryMinutes |
Token lifetime (default: 60) |