Enterprise ERP Platform
Built for Setuna Plastik — Solo-Developed, Production-Deployed
Core Mechanics
A new packaging and bottle manufacturing company needed a complete ERP system tailored exactly to their needs — covering procurement, production planning, inventory with lot tracking, quality control, sales pipeline, and financial reporting. Off-the-shelf and existing solutions lacked the bespoke depth required for their unique manufacturing processes.
Project Impact & Scope
Architecture & Solution
Designed and built the entire system solo. The 83-model Prisma schema covers every business entity from raw material lots through production orders to customer invoices. The stock engine (599 lines) implements FEFO/FIFO picking strategies with automatic multi-lot splitting, atomic AVAILABLE-to-RESERVED transitions, and 8 movement types (receipt, issue, transfer, adjustment, scrap, return, production input/output) all within single database transactions. Azure AD SSO uses the tenant-wide OID claim instead of the app-specific SUB for stable identity. A session versioning mechanism lets admins invalidate all active sessions instantly. The BOM (Bill of Materials) editor uses React Flow for visual tree construction.
Monolithic Next.js — deliberate choice at this scale. Prisma provides type-safe access across 83 models with PostgreSQL on Render. The stock engine runs all movements inside prisma.$transaction() for atomicity. RBAC enforces a module-by-action matrix at middleware level with a SuperAdmin env fallback for lockout recovery. Sequence generator produces typed document numbers (PO-001, SM-001, RES-001). React Flow powers the visual BOM editor. Recharts handles dashboard analytics.
Critical Challenges
- 01Designing 83 interconnected models without circular dependencies — the schema alone is 2,263 lines of Prisma
- 02Building a stock engine that handles FEFO/FIFO lot picking with atomic reservation transactions across multiple warehouses
- 03Implementing Azure AD SSO with OID-based identity, session versioning, and 1-minute permission refresh intervals
- 04Creating an RBAC system granular enough for 18 modules with 4 actions each while keeping middleware enforcement performant
Screenshots

ERP Dashboard — KPIs, Kanban boards, and calendar

Warehouse & Inventory — Stock tracking and movements

Production Dashboard — Manufacturing orders and KPIs

Bill of Materials — Product tree editor

Reports — Analytics and data visualization