How simplcommerce/simplcommerce works
Project type and purpose
• This is a full‑stack “modulith” e‑commerce system (SimplCommerce) built on ASP.NET Core.
• Its purpose is to provide a highly modular monolithic architecture where each e‑commerce domain (Catalog, Orders, Payments, CMS, etc.) is implemented as a discrete module that the central WebHost loads at runtime.
File structure
• Top level:
• src/SimplCommerce.WebHost – the ASP.NET Core host application, IdentityServer configuration, EF Core migrations, static file serving, Angular‑based admin UI.
• src/SimplCommerce.Infrastructure – shared abstractions, repositories, model base classes, module loader, scheduling, validation.
• src/Modules – one folder per domain module (Core, Catalog, Orders, Payments, Tax, Shipping, Inventory, Notifications, etc.). Each module contains Areas/[Feature]/Controllers, ViewModels, Views, Models, Services, Data (custom EF model builders), module.json and bundleconfig.json.
• A test/ folder for unit and integration tests.
• Build scripts, Dockerfiles, CI/CD pipelines, sample SQL seeds under src/Database.
README for additional insights
• Tech stack: ASP.NET Core, EF Core, ASP.NET Identity, Angular 1.x, MediatR for domain events.
• Deployment options: SQL Server or PostgreSQL, Docker, AWS Elastic Beanstalk, Azure Pipelines.
a. Main components
• WebHost (ASP.NET Core application)
• Infrastructure library
• Domain Modules (Core, Catalog, Orders, Payments, CMS, etc.)
• Database (SQL Server, PostgreSQL, MySQL, SQLite)
• Front‑end: Angular 1.x admin UI and MVC/Razor storefront views
• External services: Email (SendGrid/SMTP), Storage (Amazon S3/Azure Blob/Local), Hangfire (background jobs), SignalR (real‑time notifications)
b. Relationships and interactions
• WebHost loads Infrastructure + all Domain Modules on startup via IModuleInitializer and DynamicModelBuilder
• Each Module contributes EF model fragments (CustomModelBuilder) to a single DbContext
• HTTP requests to WebHost → routed to module controllers via ASP.NET Core routing (Areas)
• Angular UI invokes RESTful APIs exposed by module controllers
• Domain events (MediatR) propagate inside modules; handlers in other modules respond (e.g., Inventory listens to OrderCreated events)
• Background tasks (Hangfire) scheduled from modules or host
• Infrastructure utilities and cross‑cutting concerns (logging, caching, scheduling) used by all modules
• External dependencies (S3/Azure Blob) invoked by storage modules; email modules call SendGrid or SMTP
c. Architectural patterns and design principles
• Modular Monolith (“modulith”) with plugin‑style loading
• Onion/Clean architecture: modules define Services → Controllers → ViewModels, depend on Infrastructure abstractions via DI
• EF Core model composition via ICustomModelBuilder in each module
• Domain events (publisher/subscriber) implemented using MediatR
• Separation of concerns between UI assets (Angular, CSS, JS bundles) and server logic
d. Key technologies/frameworks
• ASP.NET Core 8 → WebHost, Controllers, Middleware, DI
• Entity Framework Core → DbContext, Migrations, SQL database
• ASP.NET Identity Core → authentication, user management
• Angular 1.x → admin SPA UI, RESTful services via $http
• MediatR → domain event bus
• Hangfire → background/recurring jobs
• SignalR → real‑time notifications