Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

βš™οΈ Fabricore β€” B2B SaaS Manufacturing Operations Platform

Fabricore is a production-grade, enterprise-scale B2B SaaS Multi-Tenant Manufacturing Operations Platform. Built from the ground up utilizing Spring Boot 3.2.x, PostgreSQL, and Docker, it serves as an industrial operations center managing multi-tenant factories with high-security constraints, dynamic workforce shift rostering, high-precision decimal stock ledgers, automated payroll engines, hierarchical B2B expense approval pipelines, and consolidated data reporting.

Java Spring Boot PostgreSQL Docker License: MIT


🧠 Core Architectural Paradigms

Traditional B2B industrial management solutions struggle with security isolation, audit compliance, and multi-tenant performance. Fabricore solves these issues at the database and application levels:

  • Transparent B2B Multi-Tenancy: Uses a shared-database, shared-schema architecture. Tenant isolation is resolved dynamically at runtime via TenantContext using a ThreadLocal storage. The tenant identity is extracted from authenticated JWT claims or incoming HTTP headers (X-Tenant-ID). An AspectJ aspect (TenantFilterAspect) intercepts Spring Data JPA repository operations, transparently activating Hibernate's @Filter (tenantFilter) with the dynamic tenant_id context parameter, ensuring absolute isolation between accounts.
  • Double-Auditing & Transaction Logs: Critical operational mutations (stock adjustments, workforce shifts, payroll releases, expense approvals) do not rely on database triggers. They are explicitly logged within transactional boundaries using a custom AuditLogService into a dedicated audit_logs table, storing serialized JSON representations of the old and new states.
  • Stateless Security & Role-Based Access (RBAC): Enforces stateless security through a JWT authentication filter (JwtFilter) validating tokens on every request. Controller endpoints are guarded by method-level @PreAuthorize constraints enforcing strict hierarchies:
    • OWNER: Complete administrative privileges, system configuration, payroll release, and final expense reviews.
    • MANAGER: Mid-tier management capabilities, shifts administration, attendance adjustments, and raw material catalog setups.
    • FLOOR_STAFF: Restricted operational access, allowing material transaction punches (check-in/outs), attendance check-ins, and expense submissions.

πŸš€ Key Features

🏒 B2B Multi-Tenant Lifecycle

  • Tenant Registration: Provision isolated tenant factory boundaries with dedicated configuration.
  • Stateless Authentication: Robust JWT issuance containing tenant boundary and RBAC claims.

πŸ“¦ Material & Inventory Management

  • Raw Material Catalog: Track materials by SKU, unit (KG, LTR, METERS, PCS, etc.), and reorder thresholds.
  • Stock Ledger Transactions: Execute auditable stock movements (STOCK_IN / STOCK_OUT) wrapped in serialization locks to prevent race conditions and negative balances.
  • Soft Deletion: Securely screen out materials from active catalogs while preserving them in historical transaction logs.

πŸ‘₯ Workforce & Shift Rostering

  • Employee Roster: Separate base salary rates for FIXED_MONTHLY and DAILY_WAGE personnel.
  • Shift Timetable: Dynamic shift scheduling with custom start/end times and configurable grace periods.
  • Attendance Punch System: Automated clock-in / clock-out logging with double-punch protection. Integrates grace-period calculation to auto-tag late records.
  • Supervisor Overrides: Secure manual correction of check-in/out timestamps, logged to the transactional audit system.

πŸ’° Payroll & Expense Engine

  • Salary Advances: Request loans that repay automatically by deducting from payroll calculation, capped at 50% of monthly wages.
  • Automated Payroll: Prorates monthly fixed salaries (accounting for absences), computes daily-wage earnings, processes advance deductions, and records drafts.
  • In-Memory PDF Payslips: Renders payslips on the fly using OpenPDF, complete with detailed breakdowns, and streams them as download attachments.
  • Hierarchical Expense Pipeline: Submit-to-Complete workflow (SUBMITTED βž” APPROVED βž” COMPLETED). Sums monthly expenses by department and category.

πŸ“Š Dashboard & Exports

  • Operations Metrics: Compile real-time operations overview data (headcount, payroll costs, approved expenses, low-stock alerts).
  • Consolidated CSV Exports: Generate and stream full system states (overview indicators, raw material inventories, categorized expenses) in a single CSV byte stream.

πŸ–ΌοΈ Application Screenshots

Here is a visual walkthrough of the Fabricore manufacturing operations platform:

🏠 Landing & Portal Home

Home Page

πŸ“Š Enterprise Operations Dashboard

Dashboard

πŸ‘₯ Workforce Rostering & Shift Management

Workforce & Shifts 1 Workforce & Shifts 2

πŸ’° Loans & Payroll Engine

Loans & Payroll

πŸ’³ Expense Approval Pipelines

Expenses Control

πŸ“¦ Material Inventory & Suppliers

Inventory & Suppliers

🐳 Containerized Deployment (Docker Compose)

Docker Services


πŸ› οΈ Tech Stack & Dependencies

Layer Technology
Java Runtime Java 21 / 24 compatible (tested on JDK 24)
Backend Framework Spring Boot 3.2.5, Spring Data JPA, Spring Security
Database Engine PostgreSQL 16 (shared database, shared schema)
Security & Auth JSON Web Tokens (jjwt 0.12.5), AspectJ AOP
Document Generation OpenPDF 1.3.30 (in-memory PDF generator)
Containerization Docker, Docker Compose 3.8
Build Tool & Boilerplate Maven, Lombok 1.18.38

πŸ—οΈ Project Structure

Fabricore/
β”œβ”€β”€ src/
β”‚   └── main/
β”‚       β”œβ”€β”€ java/com/mfgops/
β”‚       β”‚   β”œβ”€β”€ auth/                 # Tenant auth, users, and JWT filtering
β”‚       β”‚   β”œβ”€β”€ common/               # Shared utilities, exceptions, and audit logs
β”‚       β”‚   β”œβ”€β”€ config/               # Security config and JPA aspects
β”‚       β”‚   β”œβ”€β”€ dashboard/            # Dashboard stats and CSV exporters
β”‚       β”‚   β”œβ”€β”€ expense/              # Expense tracking, lifecycle workflow
β”‚       β”‚   β”œβ”€β”€ inventory/            # Materials catalog and stock transactions
β”‚       β”‚   β”œβ”€β”€ payroll/              # Advance loans and payroll generation
β”‚       β”‚   β”œβ”€β”€ tenant/               # Multi-tenancy contexts and JPA filters
β”‚       β”‚   β”œβ”€β”€ workforce/            # Employee rosters, shifts, and attendance
β”‚       β”‚   └── FabricoreApplication.java
β”‚       └── resources/
β”‚           β”œβ”€β”€ static/               # Embedded frontend client app
β”‚           β”‚   β”œβ”€β”€ js/
β”‚           β”‚   β”œβ”€β”€ app.css
β”‚           β”‚   └── index.html
β”‚           └── application.properties
β”œβ”€β”€ Dockerfile                        # Multi-stage Eclipse-Temurin JDK 21 build
β”œβ”€β”€ docker-compose.yml                # PostgreSQL db + Backend orchestrator
β”œβ”€β”€ pom.xml                           # Maven project config & dependencies
└── schema.sql                        # Baseline PostgreSQL schema migrations

πŸ“‹ Prerequisites

  • Java JDK 21 or later β€” oracle.com/java
  • Docker Desktop or Docker Daemon β€” docker.com
  • Git
  • Maven 3.9+ (optional, only needed for local native development)

⚑ Quick Start & Run Operations

Option A: Isolated Docker Compose Orchestration (Recommended)

This approach compiles, builds, migrates, and boots the entire platform using a multi-stage compilation flow.

  1. Ensure your local Docker Daemon is running.
  2. Boot the services from the project's root folder:
    docker compose up --build -d
  3. The database schema will automatically migrate using the baseline schema.sql.
  4. The REST API and frontend will be accessible directly on: http://localhost:8080
  5. To open the frontend directly in your default browser via PowerShell, run:
    Start-Process "http://localhost:8080"
  6. To stop and shut down the active services gracefully:
    docker compose down
  7. To shut down AND wipe the database clean (erases the persistent PostgreSQL data volume to start fresh):
    docker compose down -v

Option B: Local Native Maven Development

To run the Spring Boot application natively on your local machine:

  1. Ensure you have a PostgreSQL server running locally.
  2. Create a database named fabricore and configure your credentials inside application.properties:
    spring.datasource.url=jdbc:postgresql://localhost:5432/fabricore
    spring.datasource.username=postgres
    spring.datasource.password=postgres
  3. Compile and start the backend application via Maven:
    mvn clean spring-boot:run
  4. The application will start on port 8080 (endpoints base path /api).

🌐 Unified API Response Wrapper

All REST endpoints return responses wrapped inside a unified JSON object format:

{
  "success": true,
  "message": "Operations message description",
  "data": { ... },
  "errors": null
}

Note

For the complete, detailed endpoints mapping, request/response payload schemas, required RBAC roles, and authentication cURL examples, please refer to the Complete REST API Directory in ADDITIONAL_INFO.md.


πŸ§ͺ Running Tests

Fabricore includes a full test suite built on spring-boot-starter-test and spring-security-test to validate controller endpoint security, multi-tenant database aspects, and business logic calculations.

Run the test suite using Maven:

mvn test

🀝 Contributing

Contributions are welcome! Please follow these guidelines:

  1. Fork the repository.
  2. Create a feature branch: git checkout -b feature/your-feature
  3. Commit your changes: git commit -m 'Add some feature'
  4. Push to the branch: git push origin feature/your-feature
  5. Open a Pull Request.

Guidelines

  • Follow standard Spring Boot and Java coding style.
  • Maintain documentation integrity. Ensure new API endpoints or schema modifications are documented.
  • All unit and integration tests must pass prior to merging.

πŸ“„ License

This project is licensed under the MIT License β€” see the LICENSE file for details.


πŸ‘¨β€πŸ’» About

Ankesh Kumar

Built to demonstrate a production-grade, enterprise-scale B2B SaaS multi-tenant architecture, showcasing secure tenant isolation (using AspectJ & Hibernate filters), transaction-locked stock management, and automated manufacturing operational workflows.


Connect


πŸ™ Acknowledgements

  • Spring Framework β€” Dynamic IoC, Spring Data JPA, and declarative security filters.
  • PostgreSQL β€” High-reliability relational transaction storage.
  • OpenPDF β€” High-performance, lightweight PDF binary generation library.
  • JSON Web Tokens (jjwt) β€” Secure, stateless token assertions.
  • AspectJ β€” Aspect-oriented programming utilized to inject dynamic tenant isolation filters.
  • Lombok β€” Boilerplate reduction.

πŸ“Š Project Status

🟒 Active

  • Version: 0.0.1-SNAPSHOT
  • Target JDK: Java 21 / 24 compatible
  • API Base Path: /api
  • Default Port: 8080

Secure tenant isolation. Auditable stock ledgers. Real-time industrial operations. βš™οΈ

Built with love

About

Multi-tenant manufacturing operations SaaS for production planning, inventory tracking, workflow automation, and factory management.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages