Skip to content

Edison0621/erp-microservice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🏒 Enterprise ERP System

.NET 10 Build Tests License

Microservices Event Sourcing DDD Kubernetes SignalR ML.NET TimescaleDB

πŸš€ A production-ready, cloud-native ERP system built with .NET 10, Domain-Driven Design, and enterprise-grade patterns

Quick Start β€’ Features β€’ Architecture β€’ Deployment β€’ Contributing


πŸ’‘ Why Another ERP?

❌ Most Open-Source ERPs βœ… This Project
Legacy monoliths 15+ Microservices with independent deployment
Outdated tech stacks .NET 10, Dapr, Kubernetes-ready
Oversimplified demos Real-world complexity: Event Sourcing, MRP, Multi-tenancy
Vendor lock-in 100% Open Source, MIT Licensed

✨ Features

πŸ’° Finance & Accounting

  • βœ… Double-Entry General Ledger
  • βœ… Chart of Accounts (hierarchical)
  • βœ… Trial Balance & Financial Reports
  • βœ… Accounts Payable / Receivable
  • βœ… Auto Journal Entries from Operations
  • βœ… Assets Management & Depreciation

πŸ“¦ Supply Chain

  • βœ… Multi-Warehouse Inventory
  • βœ… Real-time Stock Reservations
  • βœ… Purchase Order Lifecycle
  • βœ… Goods Receipt & Quality Control
  • βœ… Material Requirements Planning (MRP)

πŸ›’ Sales & CRM

  • βœ… Order-to-Cash Workflow
  • βœ… Customer 360 View & CRM
  • βœ… Opportunity & Pipeline Management
  • βœ… Shipment Tracking
  • βœ… Invoice Generation
  • βœ… Sales Analytics Dashboard

🏭 Manufacturing & Projects

  • βœ… Production Orders & BOM
  • βœ… Work-in-Progress Tracking
  • βœ… Production Efficiency Reports
  • βœ… Project Management & Tasks
  • βœ… Timesheets & Resource Planning
  • βœ… Asset Maintenance

πŸ‘₯ Human Resources

  • βœ… Employee Lifecycle
  • βœ… Organization Structure
  • βœ… Payroll Processing & Payslips
  • βœ… Identity & Access Control (RBAC)
  • βœ… Role-based Permissions

πŸ“Š BI & Reporting

  • βœ… Executive Dashboard
  • βœ… Sales Trend Analysis
  • βœ… Inventory Valuation Reports
  • βœ… Financial Summary (P&L)
  • βœ… Production Efficiency Metrics

πŸ“ˆ AI & Real-time Analytics (New!)

  • βœ… Real-time Live Dashboards (SignalR/WebSockets)
    • Live inventory movements
    • Flash sales alerts
    • System health monitoring
  • βœ… AI-Driven Demand Forecasting (ML.NET)
    • Singular Spectrum Analysis (SSA) for seasonality detection
    • Confidence intervals (95%)
  • βœ… High-Performance Time-Series (TimescaleDB)
    • Cash flow trending
    • IoT sensor data ingestion (simulated)

πŸ—οΈ Architecture

graph TB
    subgraph "🌐 Gateway Layer"
        GW[YARP API Gateway]
    end
    
    subgraph "πŸ“Š Core Business Services"
        FIN[πŸ’° Finance]
        INV[πŸ“¦ Inventory]
        SALES[πŸ›’ Sales]
        PROC[πŸ“‹ Procurement]
        PROD[🏭 Production]
        CRM[🀝 CRM]
        PROJ[πŸ“… Projects]
    end
    
    subgraph "πŸ”§ Supporting Services"
        HR[πŸ‘₯ HR]
        PAY[πŸ’Έ Payroll]
        ASSET[🏒 Assets]
        ID[πŸ” Identity]
        MD[πŸ“ MasterData]
        MRP[πŸ“ˆ MRP]
        RPT[πŸ“Š Reporting]
    end
    
    subgraph "βš™οΈ Platform Services"
        AUTO[πŸ€– Automation]
        QUAL[βœ… Quality]
        MAINT[πŸ”§ Maintenance]
        SET[βš™οΈ Settings]
        ANA[πŸ“‰ Analytics]
    end
    
    subgraph "πŸ› οΈ Infrastructure"
        PG[(PostgreSQL)]
        TSDB[(TimescaleDB)]
        REDIS[(Redis)]
        DAPR{Dapr Sidecar}
    end
    
    GW --> FIN & INV & SALES & PROC & PROD & CRM & PROJ
    GW --> HR & PAY & ASSET & ID & MD & MRP & RPT
    GW -.->|SignalR / WebSocket| ANA
    
    FIN & INV & SALES & CRM & PROJ -.->|Event Bus| DAPR
    DAPR -.-> AUTO & ANA
    
    FIN & INV & SALES --> PG
    ANA --> TSDB
    ID --> REDIS
Loading

🎨 Design Patterns

Pattern Implementation
Event Sourcing Complete audit trail, temporal queries
CQRS Separate read/write models with MediatR
Domain-Driven Design Aggregates, Value Objects, Domain Events
Saga Pattern Distributed transactions via Dapr
Outbox Pattern Reliable event publishing with EF Core
Specification Pattern Reusable query logic
Result Pattern Railway-oriented error handling

πŸ›‘οΈ Enterprise Building Blocks

Our shared kernel provides production-ready cross-cutting concerns:

ErpSystem.BuildingBlocks/
β”œβ”€β”€ Behaviors/          # MediatR pipeline (Validation, Logging, Idempotency, Audit, Performance)
β”œβ”€β”€ CQRS/               # ICommand, IQuery, Handler abstractions
β”œβ”€β”€ Common/             # Result<T> pattern, Error types
β”œβ”€β”€ Domain/             # Specifications, Domain Event Dispatcher
β”œβ”€β”€ Outbox/             # Transactional Outbox with EF Core
β”œβ”€β”€ MultiTenancy/       # SaaS tenant isolation (query filters + interceptors)
β”œβ”€β”€ Resilience/         # Polly V8 (Retry, Circuit Breaker, Timeout)
β”œβ”€β”€ Caching/            # Distributed cache extensions (GetOrSet)
β”œβ”€β”€ Auditing/           # Automatic audit logging
└── Middleware/         # CorrelationId, RequestLogging, GlobalException

πŸš€ Quick Start

Prerequisites

Tool Version
.NET SDK 10.0+
Docker Latest
PostgreSQL 16+

Run Locally

# 1. Clone
git clone https://github.com/Edison0621/erp-microservice.git
cd erp-microservice

# 2. Build & Test
dotnet build src/ErpSystem.sln
dotnet test src/ErpSystem.sln

# 3. Run a service (e.g., Finance)
cd src/Services/Finance/ErpSystem.Finance
dotnet run

Run with Docker

# Build all images
docker build -t erp-system/finance:latest --build-arg SERVICE_NAME=Finance .

# Or use Docker Compose
docker-compose up -d

☸️ Deployment

Kubernetes with Helm

# Install the chart
helm install erp-system deploy/helm/erp-system \
  --set postgresql.auth.password=your-secure-password \
  --set ingress.host=erp.yourcompany.com

# Verify
kubectl get pods -n erp-system

Deployment Stack

deploy/
β”œβ”€β”€ k8s/                        # Raw Kubernetes manifests
β”‚   β”œβ”€β”€ namespace.yaml
β”‚   β”œβ”€β”€ configmap.yaml
β”‚   β”œβ”€β”€ secrets.yaml
β”‚   β”œβ”€β”€ ingress.yaml
β”‚   └── services/*.yaml         # Per-service deployments
└── helm/erp-system/            # Helm Chart
    β”œβ”€β”€ Chart.yaml
    β”œβ”€β”€ values.yaml
    └── templates/

πŸ“– Full Guide: docs/deployment.md


πŸ“ Project Structure

erp-microservice/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ BuildingBlocks/             # 🧱 Shared kernel (enterprise patterns)
β”‚   β”œβ”€β”€ Gateways/ErpSystem.Gateway/ # 🌐 YARP reverse proxy
β”‚   β”œβ”€β”€ Services/
β”‚   β”‚   β”œβ”€β”€ Finance/                # πŸ’° General Ledger, AP/AR
β”‚   β”‚   β”œβ”€β”€ Inventory/              # πŸ“¦ Stock management
β”‚   β”‚   β”œβ”€β”€ Sales/                  # πŸ›’ Order processing
β”‚   β”‚   β”œβ”€β”€ Procurement/            # πŸ“‹ Purchase orders
β”‚   β”‚   β”œβ”€β”€ Production/             # 🏭 Manufacturing
β”‚   β”‚   β”œβ”€β”€ CRM/                    # 🀝 Customer Relationship Management
β”‚   β”‚   β”œβ”€β”€ Projects/               # πŸ“… Project Management
β”‚   β”‚   β”œβ”€β”€ HR/                     # πŸ‘₯ Employee management
β”‚   β”‚   β”œβ”€β”€ Payroll/                # πŸ’Έ Payroll & Compensation
β”‚   β”‚   β”œβ”€β”€ Assets/                 # 🏒 Asset Lifecycle Management
β”‚   β”‚   β”œβ”€β”€ Identity/               # πŸ” Auth & RBAC
β”‚   β”‚   β”œβ”€β”€ MasterData/             # πŸ“ Materials, Customers, Suppliers
β”‚   β”‚   β”œβ”€β”€ Mrp/                    # πŸ“ˆ Material Requirements Planning
β”‚   β”‚   β”œβ”€β”€ Reporting/              # πŸ“Š BI Dashboard & Reports
β”‚   β”‚   β”œβ”€β”€ Quality/                # βœ… QC & Inspection
β”‚   β”‚   β”œβ”€β”€ Analytics/              # πŸ“‰ Time-series analytics
β”‚   β”‚   β”œβ”€β”€ Automation/             # πŸ€– Workflow engine
β”‚   β”‚   β”œβ”€β”€ Maintenance/            # πŸ”§ Asset maintenance
β”‚   β”‚   └── Settings/               # βš™οΈ System configuration
β”‚   └── Web/ErpSystem.Web/          # πŸ–₯️ React frontend
β”œβ”€β”€ tests/
β”‚   └── ErpSystem.IntegrationTests/ # βœ… 21 passing tests
└── deploy/
    β”œβ”€β”€ k8s/                        # Kubernetes manifests
    └── helm/erp-system/            # Helm chart

πŸ§ͺ Testing

# Run all tests
dotnet test src/ErpSystem.sln

# Run specific module
dotnet test --filter "GLTests"

# With coverage
dotnet test /p:CollectCoverage=true

Current Status: βœ… 21 tests passing


πŸ›£οΈ Roadmap

Phase Status Description
Phase 1 βœ… Complete Core Infrastructure & Event Sourcing
Phase 2 βœ… Complete Finance Module (General Ledger)
Phase 3 βœ… Complete Inventory & Procurement
Phase 4 βœ… Complete MRP (Material Requirements Planning)
Phase 5 βœ… Complete Enterprise BuildingBlocks
Phase 6 βœ… Complete Reporting & BI Dashboard
Phase 7 βœ… Complete Kubernetes & Helm Charts
Phase 8 βœ… Complete CRM & Customer Portal
Phase 9 βœ… Complete Project Management & Timesheets
Phase 10 βœ… Complete Payroll & Compensation
Phase 11 βœ… Complete Asset Lifecycle Management
Phase 12 βœ… Complete Real-time Notifications (SignalR)
Phase 13 βœ… Complete AI-Driven Demand Forecasting (ML.NET)

🀝 Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

# Fork β†’ Clone β†’ Branch β†’ Code β†’ Test β†’ PR
git checkout -b feature/amazing-feature
git commit -m "feat: add amazing feature"
git push origin feature/amazing-feature

πŸ“„ License

This project is licensed under the MIT License - see LICENSE for details.


⭐ Star this repo if you find it useful!

Built with ❀️ using .NET 10, DDD, and modern cloud-native patterns

Report Bug Β· Request Feature Β· Discussions

About

A production-ready, cloud-native ERP system built with modern .NET and DDD principles

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors