ProjectsEnterprise Multi-Branch Inventory & Resource Planning (ERP) Platform
Software Development

Enterprise Multi-Branch Inventory & Resource Planning (ERP) Platform

A cloud-native, multi-tenant enterprise ERP platform engineered with Spring Boot 3, MongoDB Sharding, Redis Redlock, and RabbitMQ, unifying 72 distribution branches with real-time inventory synchronization, automated stochastic reordering, and sub-80ms POS checkout.

Comprehensive Case Study

Detailed Project Overview

Executive Overview & Industry Context

Enterprise retail chains, wholesale distributors, and multi-warehouse logistics providers face immense operational friction when managing inventory, procurement, and billing across distributed branch networks. Fragmented legacy software stacks—where point-of-sale (POS) terminals, warehouse management systems (WMS), and enterprise accounting tools operate in disconnected silos—frequently suffer from inventory phantom stock, overselling during promotional flash sales, stockouts of high-velocity goods, and delayed financial reporting.

To eliminate these vulnerabilities, Rubrich Technologies engineered the Enterprise Multi-Branch Inventory & Resource Planning (ERP) Platform. Built on a high-concurrency microservices architecture featuring distributed state locks, real-time event streaming, and automated supply chain optimization algorithms, the platform centralizes procurement, multi-warehouse stock replenishment, and multi-state tax compliance across 72 retail branches and 6 regional distribution hubs. The deployment unlocked 99.98% stock accuracy, reduced inter-branch transit times by 42%, and delivered ₹1.82 Crores in annual working capital savings.


Mathematical Inventory Optimization & Safety Stock Modeling

Maintaining optimal branch stock requires balancing the carrying cost of holding excess goods against the catastrophic revenue and customer churn costs associated with stockouts. The platform implements dynamic stochastic inventory models that compute reorder thresholds in real time based on demand variance and supplier lead times.

1. Stochastic Reorder Point (ROP) with Lead Time Variability

Rather than relying on static reorder minimums, the system continuously recalculates the Reorder Point () using Gaussian lead-time and demand probability distributions:

Where represents average daily sales velocity, is average supplier delivery lead time in days, is demand variance, is supplier transit variance, and is the inverse normal distribution factor corresponding to the configured cycle service level (e.g., for a 98% non-stockout guarantee).

2. Multi-Tier Economic Order Quantity (EOQ) with Total Holding Cost

To optimize procurement lot sizes and volume discounting tiers, the platform evaluates the classic Economic Order Quantity () alongside annual inventory holding and ordering carrying costs:

Here denotes annual demand volume, is fixed order procurement cost per PO, is unit annual holding cost, is capital carrying interest rate (typically 18-24%), and represents wholesale unit purchase cost. When suppliers offer tier discounts, the platform evaluates across price breaks to select the cost-minimizing procurement quantity.


Core System Architecture & Data Flow

The platform utilizes a decoupled, event-driven microservices architecture communicating over high-speed gRPC channels and resilient message brokers:

System LayerCore ComponentProtocol & TransportLatency SLAOperational Scope
Point of Sale (POS)Offline-First React 19 / Tauri ClientIndexedDB / Local SQLite< 10 msOffline barcode scanning, cash drawer actuation, GST billing, and receipt generation.
Edge API GatewayKong Gateway / Envoy ProxyHTTP/2 & gRPC over TLS 1.3< 2 msToken validation, branch IP whitelisting, load balancing, and rate limiting.
Inventory ServiceGo (Golang) Microservice ClustergRPC & Redlock Distributed Locks< 5 msAtomic SKU reservation, inter-branch transfers, and batch lot tracking.
Order & POS HubNode.js Enterprise ServicesAsynchronous Event Streaming< 8 msInvoicing, sales ledger updates, customer loyalty points, and cash reconciliation.
Replenishment AIPython Analytical MicroserviceScheduled Async Batches< 15 minEvaluates stochastic formulas, forecast curves, and automated PO generation.
Central DatabaseSharded PostgreSQL with TimescaleDBTCP Connection Pooling (PgBouncer)< 12 msMaster product catalogs, transactional ledgers, GST tax archives, and audit logs.

Technology Selection Rationale

Infrastructure DomainTechnology ChosenStrategic Engineering Justification
Inventory MicroserviceGo (Golang) 1.23Ultra-fast execution, low memory overhead, native goroutines for high-concurrency reservation locking.
Distributed LockingRedis (Redlock Protocol)Sub-millisecond distributed locks preventing double-allocation of limited SKU inventory during simultaneous sales.
Branch POS TerminalsReact 19 + Tauri + SQLiteNative OS performance, offline billing capability during ISP outages, and automatic background sync upon reconnection.
Core DatabasePostgreSQL 16 with CitusDistributed relational tables partitioned by branch ID and fiscal year, supporting complex transactional joins.
Event StreamingRabbitMQ with Quorum QueuesGuaranteed message delivery, dead-letter routing, and priority queues for time-sensitive stock replenishment alerts.

Critical Engineering Modules & Technical Innovations

1. Distributed Concurrency Control via Redlock

To guarantee that two cashiers at different retail branches or online shoppers cannot simultaneously purchase the last available unit of a high-demand SKU, the inventory microservice implements an atomic Redlock distributed locking algorithm:

// Go: High-Concurrency Stock Reservation with Distributed Lock
func (s *InventoryService) ReserveStock(ctx context.Context, branchID string, sku string, qty int) (*ReservationResult, error) {
    lockKey := fmt.Sprintf("lock:inventory:%s:%s", branchID, sku)
    mutex := s.redisCluster.NewMutex(lockKey, redsync.WithExpiry(3*time.Second))

    if err := mutex.LockContext(ctx); err != nil {
        return nil, fmt.Errorf("failed to acquire distributed lock: %w", err)
    }
    defer mutex.UnlockContext(ctx)

    // Verify available stock in database
    var availableStock int
    query := `SELECT (total_stock - reserved_stock) FROM branch_inventories WHERE branch_id = $1 AND sku = $2`
    err := s.db.QueryRowContext(ctx, query, branchID, sku).Scan(&availableStock)
    if err != nil {
        return nil, err
    }

    if availableStock < qty {
        return nil, ErrInsufficientInventory
    }

    // Atomically increment reserved stock
    updateQuery := `UPDATE branch_inventories SET reserved_stock = reserved_stock + $1 WHERE branch_id = $2 AND sku = $3`
    _, err = s.db.ExecContext(ctx, updateQuery, qty, branchID, sku)
    if err != nil {
        return nil, err
    }

    return &ReservationResult{Status: "RESERVED", Sku: sku, ReservedQty: qty}, nil
}

2. Multi-Hop Inter-Branch Stock Transfer (IBST) Telemetry

When an individual branch exhausts stock of a high-margin product, the platform avoids costly supplier reorders by querying neighboring branches within a 25-kilometer radius. If a neighboring store holds excess safety stock (), the engine generates an automated Inter-Branch Stock Transfer (IBST) order, generating QR-coded dispatch manifests and tracking transit status in real time.


High-Concurrency Stress Testing & Production Benchmarks

The ERP platform was benchmarked under synthetic peak holiday shopping conditions across 72 simulated retail branches submitting concurrent billing and inventory updates:

Performance Benchmarks Across Distributed Operational Loads

Concurrent POS TerminalsInvoicing Rate (Bills/sec)Average Gateway LatencyP99 Database Query TimeLock Contention FailuresSystem Availability
100 Terminals120 bills/sec14 ms28 ms0100.0%
500 Terminals580 bills/sec19 ms42 ms0100.0%
1,000 Terminals1,150 bills/sec32 ms74 ms099.99%
2,500 Terminals (Peak)2,420 bills/sec68 ms145 ms099.98%

Distributed Sharding & Branch Fault Isolation

The database architecture partitions operational workloads geographically to guarantee complete operational continuity even during catastrophic network severances:

Failure Mode SimulatedArchitectural Failover MechanismRecovery Time (RTO)Data Integrity (RPO)
Regional Distribution Hub OutageAutomated routing failover shifts store fulfillment to secondary backup hub.< 45 seconds0 lost transactions
Branch ISP Fiber SeverancePOS terminals enter local SQLite offline mode; store operations continue uninterrupted.0 seconds (Instant)100% offline data buffered
Redis Cluster Master CrashSentinel consensus elects standby replica node and re-synchronizes locks.< 1.2 secondsZero phantom inventory allocations

Project Delivery Milestones & Structured Workflow

The enterprise ERP deployment spanned 5 distinct delivery phases over 18 weeks:

Phase 1: Requirements Engineering & Data Modeling (Weeks 1-3)

  • Mapped 18,000 unique SKUs across 72 physical branches, categorizing products into velocity classes (Fast, Medium, Slow).
  • Designed the sharded PostgreSQL schema, indexing strategies, and automated daily partition lifecycles.

Phase 2: Core Microservices & Distributed Lock Architecture (Weeks 4-7)

  • Developed the high-throughput Go inventory microservice with Redlock concurrency guarantees.
  • Integrated RabbitMQ message queues for event-driven invoice processing, stock adjustments, and supplier purchase orders.

Phase 3: Frontend POS Engineering & Offline Barcode Integration (Weeks 8-10)

  • Built the touch-optimized POS user interface in React 19 and Tauri with offline-first local SQLite caching.
  • Integrated thermal receipt printing, barcode scanner protocols, and electronic cash drawer drivers.

Phase 4: Government Tax Gateway & Enterprise Reporting (Weeks 11-13)

  • Built automated GST e-Invoicing and real-time E-Way bill generation modules directly connected to government NIC servers.
  • Created executive BI dashboards providing real-time P&L views, inventory turnover ratios, and supplier lead-time scorecards.

Phase 5: UAT, Penetration Testing & 72-Branch Phased Rollout (Weeks 14-18)

  • Conducted simulated stress drills and penetration testing across all branch VPN connections.
  • Executed phased deployment across retail branches with 24/7 hyper-care support and live staff training.

Measurable Business Outcomes & Operational Return on Investment

  • ₹1.82 Crores Annual Working Capital Savings: Automated stochastic and reordering eliminated overstocked slow-moving inventory by 31%, freeing substantial cash reserves.
  • 99.98% Stock Accuracy: Real-time distributed locking completely eradicated phantom stock occurrences across all physical and e-commerce sales channels.
  • 42% Reduction in Stockouts: Automated inter-branch transfers (IBST) satisfied customer orders using nearby retail inventories rather than turning away sales.
  • Sub-Second POS Checkout Experience: Cashier scanning and billing latency dropped to under 1.2 seconds per customer, eliminating long holiday checkout queues.
Technology Stack

Tools & Technologies

Java 21 (Spring Boot 3.3)Vite + React 19MongoDB 7.0 (Sharded Cluster)Redis 7.4 (Redlock Distributed Locks)RabbitMQDocker & KubernetesTailwind CSS & Shadcn UIJasperReports & OpenPDFPrometheus & GrafanaNIC GST / E-Way Bill APIs

The Objective

Design and deploy an enterprise-wide cloud ERP platform to replace fragmented legacy desktop systems, eliminating phantom stock, automating purchase requisitioning via stochastic formulas, and accelerating customer checkout across 72 distribution centers.

Key Features

  • Stochastic Reorder Point (ROP) Engine: Dynamic safety stock optimization recalculating replenishment thresholds across 72 branches using Gaussian lead-time variance models.
  • Multi-Tier Economic Order Quantity (EOQ): Automated lot-sizing balancing bulk supplier price discounts against annual carrying and holding costs.
  • Distributed Stock Reservation via Redlock: Sub-millisecond distributed locks across multi-region Redis clusters preventing double-allocation and phantom inventory.
  • Offline-First Branch POS Client: React 19 and Tauri point-of-sale desktop application with local SQLite caching, sustaining uninterrupted checkout during ISP fiber cuts.
  • Inter-Branch Stock Transfer (IBST) Telemetry: Automated lateral stock balancing dispatching surplus goods between nearby retail branches within a 25km radius.
  • Real-Time National Tax Gateway: Sub-second automated GST e-Invoicing and real-time E-Way bill generation directly connected to national NIC servers.
  • Sharded High-Concurrency Relational Architecture: PostgreSQL partitioned by branch ID and fiscal year, sustaining 2,400+ simultaneous checkout transactions per second.
  • Executive Multi-Branch BI Suite: Live dashboards tracking inventory turnover ratios, gross margins, supplier delivery scorecards, and cash-drawer reconciliations.

Advanced Methodologies

Stochastic Reorder Point (ROP) & Safety Stock Dynamic Forecasting
Multi-Tier Economic Order Quantity (EOQ) Capital Optimization
Distributed Mutex Locking via Redis Redlock for Zero Overselling
MongoDB Compound Sharding Architecture for Local Branch Latency Isolation
Asynchronous Event-Driven Messaging with RabbitMQ AMQP Protocols
Automated Real-Time GST E-Way Bill Generation & Digital Cryptographic Signing

Implementation Workflow

1
Phase 1: Supply Chain Process Mapping, Domain Modeling & MongoDB Shard Key Architecture.
2
Phase 2: Spring Boot 3 Microservices, Redis Redlock Integration & RabbitMQ Event Fabric.
3
Phase 3: High-Speed POS Frontend Development, Offline Caching & Barcode Scanner Integration.
4
Phase 4: NIC GST E-Way Bill Automation, JasperReports PDF Engine & Executive Analytics.
5
Phase 5: High-Concurrency Stress Testing, VAPT Auditing & Phased 72-Branch Rollout.
Key Metrics

Project Outcomes

100%
Quality Assurance
4 Months
Delivery Time
0.05%
Error Rate
Let's Work Together

Ready to Start Your Project?

Partner with Rubrich Technologies for mission-critical deployments in enterprise software and research analytics.