falberthen/EcommerceDDD
关于
一个实验性全栈应用,展示领域驱动设计、微服务、事件溯源、CQRS 和 Angular。
网站与应用开发实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文🛒 EcommerceDDD
An experimental full-stack application showcasing cutting-edge technologies and architectural patterns for building scalable e-commerce systems.
⭐ If you find this project useful, please consider giving it a star! It helps others discover the project.
🏗️ Architecture
High-Level Overview
Detailed Architecture
📁 Project Structure
├── Core # Building blocks and abstractions
├── Core.Infrastructure # Shared infrastructure implementations
│
├── Crosscutting
│ ├── ServiceClients # Kiota-generated HTTP clients
│ ├── ApiGateway # Ocelot API Gateway
│ ├── SignalR # Real-time communication
│ └── IdentityServer # Authentication & authorization
│
├── Services
│ ├── CustomerManagement
│ ├── InventoryManagement
│ ├── OrderProcessing
│ ├── PaymentProcessing
│ ├── ProductCatalog
│ ├── QuoteManagement
│ └── ShipmentProcessing
│
├── SPA # Angular frontend
└── docker-compose # Container orchestration
| Layer | |
|---|---|
| Core | Defines building blocks and abstractions used across all projects, such as the aggregate root, value object and repository contracts, shaped around event sourcing with Marten. |
| Core.Infrastructure | Shared infrastructure abstractions and implementations for all microservices, such as authentication, messaging with Wolverine (inbox/outbox) and event sourcing with Marten. |
| Crosscutting | Projects that cross-cut all microservices: IdentityServer, API Gateway, SignalR for real-time order updates, and ServiceClients with Kiota-generated HTTP clients. |
| Services | Backend microservices, each self-contained with its own API, Application, Domain and Infrastructure, with use cases sliced by feature inside Application. |
| SPA | Lightweight Angular-based Single Page Application. |
Microservice Structure
Each microservice is self-contained with its own API, Application, Domain and Infrastructure, with use cases sliced by feature inside Application.
├── EcommerceDDD.ProductCatalog
│ ├── API # RESTful endpoints
│ ├── Application # Use cases, commands & queries
│ ├── Domain # Aggregates, entities, domain events
│ └── Infrastructure # Data persistence & external integrations
🔗 Service Communication
External Communication (SPA → Backend)
- The API Gateway routes requests to the microservices with Ocelot, and Koalesce merges their OpenAPI documents into a single spec.
- Kiota generates typed TypeScript clients from this unified spec.
- The Angular SPA communicates through the API Gateway using the clients.
- Order status updates are pushed by the SignalR hub, which the SPA also reaches through the API Gateway.
Internal Communication (Service-to-Service)
- Synchronous: microservices call each other directly using Kiota-generated typed HTTP clients.
- Asynchronous: messaging runs on Wolverine.
PaymentProcessingandShipmentProcessingpublish integration events to thepaymentsandshipmentsKafka topics through the durable outbox.OrderProcessingis the only consumer, through the durable inbox, since theOrderSagais orchestrated there. The saga's domain events travel over durable local queues.
🛠️ Tech Stack
Backend
| Technology | Version |
|---|---|
| .NET | 10 |
| C# | 12 |
| Koalesce | 1.0.0-beta.10 |
| Ocelot | 25.0.0 |
| Marten | 9.30.0 |
| WolverineFx (Marten + Kafka) | 6.30.3 |
| Confluent Kafka | 2.15.0 |
| Entity Framework Core | 10.0.11 |
| Npgsql (PostgreSQL) | 10.0.3 |
| Duende IdentityServer | 8.0.6 |
| ASP.NET Data Protection | 10.0.11 |
| Microsoft Kiota | 2.0.0 |
| OpenTelemetry | 1.18.0 |
| xUnit | 2.9.3 |
| NSubstitute | 6.2.0 |
| Swashbuckle.AspNetCore.SwaggerUI | 10.2.3 |
| FluentResults | 4.0.0 |
| Mailpit (local e-mail inbox) | 1.31.2 |
Frontend
| Technology | Version |
|---|---|
| angular | 21.1.3 |
| typescript | 5.9.3 |
| jest | 30.2.0 |
| @ng-bootstrap/ng-bootstrap | 20.0.0 |
| bootstrap | 5.3.5 |
| @fortawesome/angular-fontawesome | 4.0.0 |
| ngx-toastr | 19.0.0 |
🔌 Getting Started
Running with Docker
Backend only — starts all microservices, databases, Kafka, and infrastructure:
docker compose up
Backend + Frontend — also builds and serves the Angular SPA at http://localhost:4200:
docker compose --profile frontend up
💡 Tip: You can also set
docker-compose.dcprojas the startup project in Visual Studio for debugging.
📧 E-mails: new accounts must confirm their e-mail before signing in, but no real e-mail is sent. Every confirmation and password-reset message lands in the Mailpit inbox at
http://localhost:8025.
🔍 Local tools: kafka-ui at
localhost:8080, pgAdmin atlocalhost:8081and the Aspire dashboard atlocalhost:18888.
Running the SPA locally (with hot-reload)
If you prefer running the frontend outside Docker for development, start the backend with docker compose up, then:
cd src/EcommerceDDD.Spa
npm install
ng serve
The app will be available at http://localhost:4200.
Advanced: Regenerating Kiota Clients
Tool services are defined in docker-compose.override.yml, which Docker Compose loads automatically alongside docker-compose.yml. After the main stack is running, use one of the commands below:
| Command | What it generates |
|---|---|
docker compose --profile tools run regenerate-clients |
Both backend and frontend clients |
docker compose --profile tools run regenerate-backend-clients |
Backend C# clients only (ServiceClients/Kiota/) |
docker compose --profile tools run regenerate-frontend-clients |
Frontend TypeScript client only (EcommerceDDD.Spa/src/app/clients/) |
📧 Support & Contributing
- Issues: Report bugs or request features via GitHub Issues.
- Contributing: Contributions are welcome! Please read CONTRIBUTING.md before submitting PRs.
📄 License
This project is licensed under the terms of the LICENSE file.
Made with ❤️ by Felipe Henrique
探索相关项目
加载中…