Skip to content

MadurangaNamal/StockSync

Repository files navigation

StockSync

StockSync is a cloud-native, microservices-based inventory management system built with ASP.NET Core and orchestrated using ASP.NET Core Aspire – Microsoft’s official stack for distributed .NET applications.

This demonstrates modern development practices including service orchestration, observability, resilience, caching, background processing, and containerization.

Architecture Overview

  • Supplier Service (.NET Web API)
    Handles supplier management, JWT authentication/authorization, invoice file management, Hangfire background jobs, and in-memory caching.
    Database: Microsoft SQL Server (via Entity Framework Core)

  • Item Service (.NET Web API)
    Manages inventory items with flexible querying.
    Database: MongoDB

  • Shared Library
    Contains common models, DTOs, user roles, middleware (Serilog logging, global exception handling)

  • Orchestration
    ASP.NET Core Aspire (AppHost + ServiceDefaults)
    Provides service discovery, automatic connection string injection, health checks, OpenTelemetry, and dashboarding.

  • Supporting Infrastructure

    • MinIO (invoice file storage)
    • Hangfire (background job processing using SQL Server storage)

Architecture Diagram

          +-------------------------------+
          |       StockSync AppHost       |
          |   (ASP.NET Core Aspire Host)  |
          +-------------------------------+
                      /         \
                     v           v
      +-----------------------+  +-----------------------+
      |   Supplier Service    |  |    Item Service       |
      |  (.NET Web API)       |  |  (.NET Web API)       |
      | - JWT auth            |  | - Item queries        |
      | - Hangfire jobs       |  | - MongoDB access      |
      | - In-memory cache     |  +-----------------------+
      +-----------------------+               |
              |        |                       v
              |        |               +-------------------+
              |        |               |     MongoDB       |
              |        |               +-------------------+
              |        v
      +-------------------+
      |    SQL Server     |
      | (Supplier data +  |
      |  Hangfire storage)|
      +-------------------+
              |
              v
      +-------------------+
      |      MinIO        |
      | (Invoice storage) |
      +-------------------+

Key Features

  • Microservices architecture with clean separation of concerns
  • JWT-based authentication and role-based authorization (Admin / User)
  • Centralized request/response logging with Serilog
  • Global exception handling
  • Supplier → Item relationship with cached Item details for faster reads
  • Invoice file upload/download/delete handled by the Supplier Service via MinIO
  • Hangfire scheduled jobs for periodic supplier-item synchronization
  • In-memory caching via ASP.NET Core IMemoryCache
  • Full observability via OpenTelemetry (traces, metrics, logs)
  • Automatic health checks and resilience policies (via Aspire ServiceDefaults)
  • Docker containerization
  • Aspire Dashboard for live monitoring of service health and resources

Getting Started (Local Development with Aspire)

Prerequisites

  • .NET 9 SDK
  • Docker Desktop (running in the background – Aspire will start containers automatically)

Run the Entire Application

git clone https://github.com/MadurangaNamal/StockSync.git
cd StockSync

# Run the Aspire AppHost (orchestrates everything)
dotnet run --project StockSync.AppHost

About

StockSync is a microservices-based inventory management application developed with ASP.NET Core Web API. Includes Supplier Service (MS SQL, EF Core) and Item Service (MongoDB). Supports RESTful inter-service communication, Docker Compose orchestration, and scalable architecture for modern, containerized inventory handling.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages