ECommerceApp is a modular monolith built with .NET 8 that demonstrates a scalable, maintainable e-commerce system using a modular architecture. The solution is organized into several projects and modules, each with a clear responsibility.
- Modular Monolith Architecture: Orders, Products, Customers, and Business Events modules, each with their own domain, endpoints, persistence, and services.
- Admin UI: ASP.NET Core Razor Pages frontend for administration, with integration and unit tests.
- Integration & Unit Testing: Comprehensive test projects for API modules and Admin UI, using in-memory databases and HTTP stubbing.
- Dependency Injection: All modules and services use DI for decoupled communication.
- Shared Contracts: DTOs and interfaces in a separate project to avoid circular dependencies.
- Logging & Observability: Integrated logging and OpenTelemetry support.
- Swagger UI: API documentation and testing via Swagger.
- Database Migrations: Dedicated migrator project for applying EF Core migrations.
- Docker & Kubernetes: Dockerfiles and k8s manifests for containerized deployment.
- Overview
- Project Structure
- Requirements
- Setup and Installation
- Usage
- Testing
- Logging & Observability
- Contributing
ModularMonolith/
├── ECommerceApp/ # Main API host (wires up modules)
├── ECommerce.Modules.Orders/ # Orders module (domain, endpoints, persistence, services)
├── ECommerce.Modules.Products/ # Products module (domain, endpoints, persistence, services)
├── ECommerce.Modules.Customers/ # Customers module (domain, endpoints, persistence, services)
├── ECommerce.BusinessEvents/ # Business events module
├── ECommerce.Contracts/ # Shared DTOs and interfaces
├── ECommerce.Common/ # Shared result types, utilities
├── ECommerce.AdminUI/ # ASP.NET Core Razor Pages admin UI
├── ECommerce.AdminUI.IntegrationTests/ # Integration tests for Admin UI (HTTP stubbing)
├── ECommerce.AdminUI.Tests/ # Unit tests for Admin UI
├── ECommerceApp.IntegrationTests/ # Integration tests for API modules (in-memory DB)
├── ECommerce.Modules.Orders.Tests/ # Unit tests for Orders module
├── ECommerce.BusinessEvents.Tests/ # Unit tests for Business Events module
├── ECommerce.DatabaseMigrator/ # Standalone EF Core migration runner
├── docs/ # Architecture decision records, Swagger, etc.
├── README.md
└── ...
- .NET 8 SDK
- Docker (for running containers and database)
- (Optional) Kubernetes (for k8s manifests)
- Clone the repository
- Restore dependencies
dotnet restore
- Apply database migrations
dotnet run --project ECommerce.DatabaseMigrator
- Run the application
dotnet run --project ECommerceApp
- Run the Admin UI
dotnet run --project ECommerce.AdminUI
- API Endpoints: Available at
/orders
,/products
,/customers
,/businessevents
(see Swagger UI for details) - Admin UI: Navigate to the running Admin UI app for product, order, and customer management
- Swagger UI: Visit
/swagger
on the API host
- Integration Tests:
ECommerceApp.IntegrationTests
: In-memory DB integration tests for API modulesECommerce.AdminUI.IntegrationTests
: HTTP-stubbed integration tests for Admin UI services
- Unit Tests:
ECommerce.AdminUI.Tests
,ECommerce.Modules.Orders.Tests
,ECommerce.BusinessEvents.Tests
- Run all tests:
dotnet test
- Logging via
ILogger
throughout all modules - OpenTelemetry support in Admin UI
- API and Admin UI log to console by default
This repository contains the application code and development tooling (including the Tiltfile for local Kubernetes development). Production and staging Kubernetes manifests are maintained in a separate infrastructure repository:
- The
Tiltfile
in this repository is used for local development and testing. - It references Kubernetes manifests and resources needed for running the app locally.
- Developers should use the manifests and configuration in this repository for local workflows.
- The infrastructure repository contains the manifests and configuration for production and staging environments.
- These are managed by ArgoCD for GitOps-based deployment.
- Do not point the
Tiltfile
to the infrastructure repository; keep local development resources close to the codebase.
Summary:
- Use this repository for local development and testing with Tilt.
- Use the infrastructure repository for production/staging deployments with ArgoCD.
Contributions are welcome! Please see the docs/
folder for architecture decisions and contribution guidelines.