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.
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
TenantContextusing aThreadLocalstorage. 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 dynamictenant_idcontext 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
AuditLogServiceinto a dedicatedaudit_logstable, 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@PreAuthorizeconstraints 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.
- Tenant Registration: Provision isolated tenant factory boundaries with dedicated configuration.
- Stateless Authentication: Robust JWT issuance containing tenant boundary and RBAC claims.
- 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.
- Employee Roster: Separate base salary rates for
FIXED_MONTHLYandDAILY_WAGEpersonnel. - 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.
- 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.
- 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.
Here is a visual walkthrough of the Fabricore manufacturing operations platform:
| 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 |
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
- 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)
This approach compiles, builds, migrates, and boots the entire platform using a multi-stage compilation flow.
- Ensure your local Docker Daemon is running.
- Boot the services from the project's root folder:
docker compose up --build -d
- The database schema will automatically migrate using the baseline schema.sql.
- The REST API and frontend will be accessible directly on:
http://localhost:8080 - To open the frontend directly in your default browser via PowerShell, run:
Start-Process "http://localhost:8080"
- To stop and shut down the active services gracefully:
docker compose down
- To shut down AND wipe the database clean (erases the persistent PostgreSQL data volume to start fresh):
docker compose down -v
To run the Spring Boot application natively on your local machine:
- Ensure you have a PostgreSQL server running locally.
- Create a database named
fabricoreand configure your credentials inside application.properties:spring.datasource.url=jdbc:postgresql://localhost:5432/fabricore spring.datasource.username=postgres spring.datasource.password=postgres
- Compile and start the backend application via Maven:
mvn clean spring-boot:run
- The application will start on port
8080(endpoints base path/api).
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.
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 testContributions are welcome! Please follow these guidelines:
- Fork the repository.
- Create a feature branch:
git checkout -b feature/your-feature - Commit your changes:
git commit -m 'Add some feature' - Push to the branch:
git push origin feature/your-feature - Open a Pull Request.
- 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.
This project is licensed under the MIT License β see the LICENSE file for details.
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.
- π GitHub: @AnkeshGG
- πΌ LinkedIn: Ankesh Kumar
- 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.
π’ 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. βοΈ







