Car Option Store is a domain-driven, high-performance e-commerce and warehouse inventory management platform specialized for vehicle accessories and technical automotive options (such as Android infotainment consoles, power tailgate releases, cruise control kits, and power window modules).
In the automotive aftermarket, customer hesitation stems primarily from compatibility risks (wiring harness variance across vehicle trims and model years), while merchants struggle with real-time stock reconciliation across retail and wholesale partner channels.
Architected on ASP.NET Core 10 following Clean Architecture and Domain-Driven Design (DDD) in a Modular Monolith fashion, the platform encapsulates catalog browsing, faceted vehicle matching, transactional inventory ledgers, and multi-tier pricing into strictly decoupled, independently maintainable modules.
The Problem
Automotive aftermarket e-commerce presents unique domain challenges that generic shop engines cannot accommodate:
1. Technical Compatibility & Wiring Harness Risks: Vehicle accessories must accurately match specific chassis codes, model years, and connector standards. Incompatible orders cause high return rates, customer dissatisfaction, and potential vehicle electrical hazards.
2. Dual-Market Dynamics (Retail vs. B2B Wholesale): Sellers cater to both direct vehicle owners (B2C) and regional installers/dealerships (B2B). Each requires segregated discount policies, credit limits, and promotional schedules.
3. Strict Inventory Tracking & Multi-Document Ledgers: Stock movements demand full audit trails (inward shipments, purchase allocations, damaged returns) with running balance reconciliation rather than simple integer increments.
4. Spaghetti Monolith Maintenance: In legacy e-commerce systems, inventory or discount logic adjustments frequently cascade into unexpected failures within catalog and checkout pipelines.
The Solution
Car Option Store resolves these operational hurdles through an enterprise Modular Monolith architecture:
• 6 Decoupled Bounded Contexts:
- ShopManagement: Products catalog, categories, custom marketing sliders, and order checkout flows.
- InventoryManagement: Comprehensive warehouse ledger, live stock balances, inward/outward documentation, and threshold monitoring.
- DiscountManagement: Computational discount engine distinguishing Customer Discounts from Colleague (Wholesale) Discounts.
- FilterManagement: Faceted dynamic attributes mapped directly to vehicle brands, models, and body trims.
- CommentManagement: Threaded reviews, rating summaries, and administrative moderation.
- AccountManagement: Cookie-based authentication, user identities, and granular operational permissions.
• Anti-Corruption Layer (ACL): Isolated bridges (such as InventoryAcl and AccountAcl) mediate cross-module communication, preventing domain model leaks.
• Optimized CQRS Read Layer (01_LampshadeQuery): Server-side compiled read projections deliver sub-50ms catalog rendering without heavyweight entity tracking.
• Fine-Grained Permission Security: 40+ atomic permission codes validated via declarative attributes and in-memory cookie claims.
System Flow & Architecture
Constructed following Domain-Driven Design (DDD) and Clean Architecture within a Modular Monolith:
- Presentation Layer (Razor Pages & Web API): High-speed server-rendered storefront and administrative dashboards, accompanied by specialized Web API endpoints.
- Configuration Layer: Module-specific bootstrappers encapsulating dependency injection registration and preventing cross-module coupling.
- Application & Contracts Layer: Commands, use-case handlers, DTOs, and interface contracts separated from infrastructure mechanics.
- Infrastructure Layer: EF Core with isolated DbContexts per domain context and SQLite persistence.
01
🛒
Storefront & Vehicle Match
Customer selects car brand, model & trim to browse compatible parts & accessories.
02
🔍
Faceted Search & Compatibility
Dynamic faceted attributes filter out non-fitting options (wiring harnesses, frames).
03
💰
Tiered Pricing & Discounts
Real-time calculation of retail customer promos and B2B wholesale colleague rates.
04
📦
Inventory Ledger & ACL
Isolated inventory ledger updates stock via Anti-Corruption Layer upon checkout.
05
📊
Admin Operations & Analytics
Permission-guarded dashboard with sales charts, inventory audits & order fulfillment.
Technical Challenges & Solutions
Cross-Module Isolation & Inventory Anti-Corruption Layer (ACL)
Challenge
During customer checkout, stock had to be validated and decremented immediately, but letting the Shop module query the Inventory DbContext directly would compromise domain boundaries.
Solution
Engineered an Anti-Corruption Layer (IInventoryAcl) serving as an isolation contract. Stock operations communicate exclusively through explicit application interfaces.
Impact: 100% loose coupling with zero circular dependencies, allowing the Inventory module to be extracted into a standalone microservice at any time.
Dual-Tier Pricing Engine (Retail Promo vs. B2B Wholesale)
Challenge
The platform had to compute baseline prices, time-limited consumer promotions, and authenticated colleague wholesale discounts simultaneously without introducing query latency.
Solution
Modeled separate CustomerDiscount and ColleagueDiscount aggregates, joining their pricing logic dynamically in the CQRS read model with memory caching.
Impact: Instant pricing computation across hundreds of items under 30ms, eliminating discount collision risks.
In-Memory Permission Validation for 40+ Operational Codes
Challenge
Securing 40+ administrative operations across multiple sub-panels risked severe database overhead if authorization queries were executed on every HTTP request.
Solution
Implemented numeric permission constants enforced via NeedsPermissionAttribute and SecurityPageFilter. Permissions are securely serialized into cookie claims on login and checked in-memory in <1ms.
Impact: Airtight method-level authorization with zero database roundtrips on secured page requests.
Results & Metrics
• High-speed catalog loading with sub-45ms response latency via CQRS read optimization.
• 100% modular isolation across 6 bounded contexts with independent DbContexts and ACL boundaries.
• Seamless dual B2C & B2B capabilities with automated retail and wholesale colleague discounts.
• Automated warehouse ledger providing audit-grade stock movement tracking.
• In-memory validation of 40+ permission codes executing in under 1 millisecond.