8000
Skip to content

bteodora/confectionery-erp-nodejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

139 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Confectionery ERP Logo

Confectionery ERP Platform

Distributed Supply Chain & Retail Management System

Node.js Express Vue.js REST JSON DB

A centralized, multi-tenant digital ecosystem engineered to orchestrate the lifecycle of chocolate production, facility management, inventory logistics, and consumer engagement.

πŸ“„ View Domain Specification (PDF) Β»
πŸ› Architecture Β» Β· ✨ Key Features Β»



1. Project Overview

Confectionery ERP is a sophisticated web-based platform designed to digitize the operations of a distributed manufacturing network. Unlike standard e-commerce solutions, this system introduces a complex hierarchical management structure (RBAC) that models real-world business constraints.

The system solves the problem of decentralized inventory and sales management by providing a unified interface where:

  1. Administrators oversee the entire network of factories and personnel.
  2. Managers operate individual facilities, curating product lines and managing workforce logistics.
  3. Workers maintain real-time inventory levels.
  4. Customers engage in a gamified purchasing experience with loyalty rewards.

This solution is engineered to operate without a traditional RDBMS, utilizing a custom high-performance JSON persistence layer to ensure data portability and integrity in constrained environments.


2. Key Engineering Features

Multi-Tiered Role-Based Access Control (RBAC)

The system implements a rigid hierarchy with distinct capability scopes:

  • Administrator: Global system control, factory instantiation, manager appointment, and "suspicious user" auditing (Fraud Detection).
  • Manager: Facility-level administration, worker recruitment, inventory cataloging, and comment moderation.
  • Worker: Operational execution, specifically regarding atomic stock level adjustments.
  • Customer: End-user interaction, transactional purchasing, and loyalty tier progression.

Factory & Inventory Lifecycle

  • Factory Instantiation: Administrators commission new facilities, assigning unique metadata and managerial staff.
  • Geospatial Intelligence: Integration with OpenLayers provides interactive map visualizations for factory locations, allowing location-based filtering.
  • Inventory Control: Real-time stock validation ensures concurrency safety during high-traffic purchasing events.

Algorithmic Loyalty System

The system features a proprietary algorithm for customer retention and gamification:

  • Point Accumulation: Points = (Order Price / 1000) * 133
  • Dynamic Tiers: Users automatically graduate between Bronze, Silver, and Gold tiers based on point thresholds, unlocking progressive discount algorithms.
  • Churn Prevention: Cancellation logic triggers penalty algorithms (Lost Points = Price * 4), discouraging frivolous ordering.

Security & Fraud Detection

  • Suspicious Activity Detection: The system implements a sliding window algorithm to flag users who cancel >5 orders within 30 days.
  • Content Moderation: A "Human-in-the-loop" pattern ensures customer reviews remain hidden until explicitly approved by the facility manager.

3. Architecture and Design

The application follows a strictly decoupled Client-Server Architecture, adhering to RESTful principles.

High-Level Components

  1. Presentation Layer (Frontend): Built with Vue.js, providing a reactive Single Page Application (SPA) experience. It utilizes Axios for asynchronous communication and component-based design for modularity.

  2. Application Layer (Backend): Powered by Node.js & Express, handling routing, JWT authentication, business logic execution, and data serialization.

  3. Persistence Layer (JSON Engine): In compliance with specific architectural constraints, the system utilizes a custom file-based storage engine. A Repository Design Pattern abstracts file I/O operations, ensuring that the business logic remains agnostic to the storage medium (allowing for easy future migration to MongoDB/Postgres).

Data Flow

User Action $\rightarrow$ Vue Component $\rightarrow$ REST API $\rightarrow$ Controller $\rightarrow$ Service (Logic) $\rightarrow$ Repository (DAO) $\rightarrow$ JSON Storage


4. Technology Stack

  • Runtime: Node.js (Non-blocking I/O for concurrency)
  • Framework: Express.js (Middleware & Routing)
  • Frontend: Vue.js 3 (Composition API)
  • Mapping: OpenLayers (Geospatial Rendering)
  • Security: JWT (Stateless Authentication)

5. Installation and Setup

Prerequisites

  • Node.js (v14+) & npm

Deployment Steps

  1. Clone the Repository

    git clone https://github.com/bteodora/confectionery-erp-nodejs.git
  2. Backend Initialization

    cd server
    npm install
    npm start
    # Server listens on port 3000
  3. Frontend Initialization

    cd client
    npm install
    npm run serve
    # Application live at http://localhost:8080

6. Project Structure

The directory structure promotes separation of concerns (SoC).

/
β”œβ”€β”€ client/                 # Vue.js SPA
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/     # Atomic UI Elements
β”‚   β”‚   β”œβ”€β”€ views/          # Page layouts
β”‚   β”‚   β”œβ”€β”€ services/       # API Connectors (Axios)
β”‚   β”‚   └── router/         # Navigation Guards
β”œβ”€β”€ server/                 # Express API
β”‚   β”œβ”€β”€ data/               # JSON Database (The "Storage")
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ controllers/    # Endpoint Logic
β”‚   β”‚   β”œβ”€β”€ services/       # Business Rules
β”‚   β”‚   β”œβ”€β”€ repositories/   # Data Access Layer
β”‚   β”‚   └── models/         # DTOs
└── README.md

About

Full-stack B2B/B2C ERP solution for confectionery manufacturing. Features multi-tenant RBAC, geospatial inventory tracking, and algorithmic loyalty systems built with Node.js & Vue.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

0