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 Β»
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:
- Administrators oversee the entire network of factories and personnel.
- Managers operate individual facilities, curating product lines and managing workforce logistics.
- Workers maintain real-time inventory levels.
- 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.
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 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.
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.
- 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.
The application follows a strictly decoupled Client-Server Architecture, adhering to RESTful principles.
-
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.
-
Application Layer (Backend): Powered by Node.js & Express, handling routing, JWT authentication, business logic execution, and data serialization.
-
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).
User Action Vue Component REST API Controller Service (Logic) Repository (DAO) JSON Storage
- 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)
- Node.js (v14+) & npm
-
Clone the Repository
git clone https://github.com/bteodora/confectionery-erp-nodejs.git
-
Backend Initialization
cd server npm install npm start # Server listens on port 3000
-
Frontend Initialization
cd client npm install npm run serve # Application live at http://localhost:8080
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