Inventorify

Project 1 of 2

Enterprise invoice & inventory management — Clean Architecture, DDD, CQRS with MediatR

Architecture Overview

Clean Architecture + Vertical Slice Architecture

Hybrid

Inventorify is engineered as a deliberate hybrid of Clean Architecture and Vertical Slice Architecture. Clean Architecture enforces strict dependency inversion following SOLID principles — isolating domain logic entirely from infrastructure, persistence, and delivery concerns. Vertical Slice Architecture organizes the application by business feature rather than by technical layer, ensuring each slice — invoice processing, inventory tracking, stock valuation — is independently cohesive, fully testable, and immediately navigable.

This is a purposeful engineering trade-off: the domain is protected by Clean Architecture’s dependency rules while day-to-day feature development happens vertically — each feature self-contained, independently testable, and minimally coupled to the rest of the system. The result is a codebase that is both architecturally rigorous and practically navigable at enterprise scale.

Architecture Pillars

Dependency Inversion

Application and domain layers depend exclusively on abstractions following the Dependency Inversion Principle. Infrastructure details are registered at the composition root — never referenced by domain logic.

CQRS with MediatR

Commands and queries are fully separated through MediatR handlers, enabling independent optimization of read models and write pipelines without compromising integrity.

Vertical Feature Slices

Each feature — handler, validator, model, and query — is colocated in a dedicated slice for maximum cohesion, minimal cross-feature coupling, and adherence to the Single Responsibility Principle.

Rich Domain Model (DDD)

Aggregates, value objects, and domain events model business rules explicitly using Domain-Driven Design — not thin data transfer containers.

Technology Stack

Architecture & Patterns

Clean Architecture
Vertical Slice
CQRS
DDD
Repository Pattern
Result Pattern

Messaging & Pipeline

MediatR
Pipeline Behaviors
Validation Behavior
Logging Behavior
Transaction Behavior

Data & Persistence

EF Core
SQL Server
Fluent API Config
Interceptors
Audit Trails
Soft Delete

Security

JWT Authentication
ASP.NET Core Identity
Refresh Tokens
Permission-based RBAC
Policy Providers

Validation & Quality

FluentValidation
ProblemDetails
xUnit
NSubstitute
NetArchTest

Cross-Cutting Concerns

Serilog
HybridCache
Rate Limiting
Health Checks
Swagger / OpenAPI

System Design

Inventorify is designed as a domain-driven system where invoice and inventory aggregates are explicitly modeled following DDD principles, each owning its invariants and communicating through well-defined contracts. Domain events propagate state changes across aggregate boundaries without introducing tight coupling — inventory adjustments trigger automatically when invoices are confirmed, preserving transactional consistency at the domain level.

The CQRS pattern separates read and write responsibilities cleanly. Write-side commands flow through MediatR handlers with pipeline behaviors for validation (FluentValidation), structured logging (Serilog), and transaction management — applied consistently across every feature slice. Read-side queries return optimized projections via EF Core without loading full aggregate graphs — each read model shaped precisely for the API consumer or Blazor UI component that needs it.

The Dependency Inversion Principle is enforced throughout every layer: application logic depends exclusively on abstractions defined in the domain, and infrastructure implementations — EF Core with SQL Server, MailKit email services, HybridCache — are injected at the composition root. This ensures the entire domain and application layer can be tested in complete isolation from any persistence or external infrastructure dependency.

Explore Inventorify’s Complete Architecture

Full production source code, Clean Architecture documentation, and comprehensive course materials delivered upon release.

Backend Release: May 10, 2026