Skip to content

austinchima/MySupplyChain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

110 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MySupplyChain Portfolio Showcase

CI .NET License: MIT

A supply chain management system engineered as an enterprise architecture case study. This project demonstrates production-level software engineering patterns using ASP.NET Core 10, Clean Architecture, CQRS + MediatR, React 19, PostgreSQL, Adminer, and ML.NET SSA time series forecasting.

Note: This is an engineering case study and portfolio piece, not a commercial SaaS product.

Architecture

High-Level System Design

graph TD
    Client[React 19 SPA<br/>Tailwind CSS] -->|REST API / JWT| API[ASP.NET Core 10 API]
    
    subgraph "Backend System"
        API -->|CQRS Commands & Queries| MediatR[MediatR Pipeline]
        MediatR -->|Read Path| Queries[Query Handlers]
        MediatR -->|Write Path| Commands[Command Handlers]
        
        Commands -->|Writes| EF[EF Core ORM]
        Queries -->|Reads| EF
        
        Commands -.->|Events| Channel[Event Ingestion Channel]
        Channel -.->|Background processing| Worker[Allocation Processing Worker]
        Worker -->|Updates Materialized Views| EF
        
        ML[ML.NET SSA Forecaster]
        Queries -->|Forecast Requests| ML
        Worker -->|Training Data| ML
    end
    
    EF -->|TCP/IP| DB[(PostgreSQL 16)]
Loading

Component-Level Write Flow

sequenceDiagram
    participant UI as React UI
    participant API as API Controller
    participant MediatR as MediatR
    participant Handler as Command Handler
    participant DB as PostgreSQL
    participant Channel as Ingestion Channel
    participant Worker as Background Worker

    UI->>API: HTTP POST /api/orders
    API->>MediatR: Send(CreateOrderCommand)
    MediatR->>Handler: Handle(Command)
    Handler->>DB: SaveChangesAsync()
    DB-->>Handler: Success
    Handler->>Channel: Publish(OrderCreatedEvent)
    Handler-->>MediatR: Return Order ID
    MediatR-->>API: 
    API-->>UI: 200 OK

    %% Background Processing
    Channel-->>Worker: Consume(OrderCreatedEvent)
    Worker->>DB: Update Materialized Allocation Views
Loading

Project Structure

MySupplyChain/
├── MySupplyChain.UI              # React 19 SPA, Tailwind CSS, Glassmorphism UI
├── MySupplyChain.Domain          # Entities, enums, value objects (zero dependencies)
├── MySupplyChain.Application     # CQRS handlers, interfaces, DTOs (depends on Domain)
├── MySupplyChain.Infrastructure  # EF Core, ML.NET, JWT auth (implements Application interfaces)
├── MySupplyChain.API             # Controllers, middleware, Swagger (composition root)
├── MySupplyChain.ModelTrainer    # Offline SSA model training console app
├── MySupplyChain.Tests           # 27 unit + integration tests (xUnit, FluentAssertions)
├── MySupplyChain.Benchmarks     # BenchmarkDotNet performance suite (SSA, CQRS, CSV parsing)
└── graphify-out/                 # Standard AST knowledge graph metadata and visualization

Key Design Decisions

Decision Rationale
Clean Architecture Enforces dependency inversion — Domain has zero dependencies, Infrastructure implements Application interfaces
CQRS + MediatR Separates read/write paths, enables pipeline behaviors (validation, logging)
SSA Forecasting Singular Spectrum Analysis captures seasonality + trend without manual feature engineering
Modern UI/UX React frontend with custom Tailwind CSS, SVG visualizations, and real-time status filtering
JWT Auth Production-grade JWT + ASP.NET Identity with strict password policies and secure data isolation
PostgreSQL Database Modern, open-source performance with native JSON support and UTC-strict timestamp enforcement

Recent Engineering Updates

The system has been hardened with features focusing on data integrity and security:

  • High-Fidelity Ingestion Engine: Developed a robust CSV parser with advanced field mapping (Product details, Customer entities, Order grouping). Implemented automated data cleaning and feature engineering to handle skewed production data.
  • Security Hardening: Enforced strong ASP.NET Identity password policies and implemented secure data management workflows, including multi-step word confirmation gates for irreversible data purges.
  • PostgreSQL Compatibility: Resolved low-level DateTimeKind conflicts by enforcing explicit UTC-normalization across the entire ingestion pipeline to satisfy PostgreSQL timestamp with time zone requirements.
  • Responsive React UI: Refactored the dashboard for 100% responsiveness, featuring custom SVG demand charts, real-time logistics tracking, and modular modal architectures.

ML.NET Demand Forecasting

The forecasting engine uses Singular Spectrum Analysis (SSA) via Microsoft.ML.TimeSeries to decompose historical sales into trend, seasonality, and noise components.

Features:

  • Unit-Based Predictions: Trains on physical quantity sold per day to predict exact unit demand.
  • Confidence Intervals: Provides 95% upper/lower bounds to assist in risk-averse reordering.
  • Model Metrics: Exposes RMSE and MAE directly in the UI for model transparency.
  • Per-Product SSA: Trains individual models per SKU to capture unique demand patterns.

Data Ingestion & Feature Engineering

The system features a sophisticated ingestion engine designed for real-world data variability:

  • Advanced Mapping: Map custom CSV columns to Products, Prices, Customers, and Order IDs.
  • Normalization: Automated whitespace trimming and string normalization for SKU matching.
  • Outlier Clamping: Automated handling of negative quantities and prices to prevent forecasting bias.
  • Relational Integrity: Intelligent batch-creation of products and customers during sales history imports.

Quick Start

Prerequisites

Option 1: Docker Compose (recommended)

docker compose up --build

The stack automatically boots:

  • ASP.NET Core API at http://localhost:5000/swagger
  • React Frontend UI concurrently
  • PostgreSQL Database
  • Adminer Database Client at http://localhost:8080

Tech Stack

Layer Technology
Frontend React 19, Vite, Tailwind CSS, SVG Visualizations
Runtime .NET 10 / ASP.NET Core 10
ORM Entity Framework Core 10
Database PostgreSQL 16 / Adminer
Auth JWT Bearer + ASP.NET Core Identity
ML ML.NET 5.0 (SSA Time Series)
CQRS MediatR 14
Testing xUnit + FluentAssertions + WebApplicationFactory (27 tests)
Benchmarks BenchmarkDotNet (SSA forecasting, CQRS handlers, CSV parsing)
Containerization Docker + Docker Compose

License

MIT

About

ML-powered supply chain management system built with .NET 10, Clean Architecture, and ML.NET for intelligent demand forecasting and automated reordering.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors