Skip to content

dharshansaitech/FactoryFlow

Repository files navigation

FactoryFlow

An Industry 4.0 MES-style operations console for SMT/PCB assembly plants β€” real-time line status, machine health, work order tracking, and full DMC-level board traceability, styled after Bosch Nexeed, Siemens Opcenter, and Palantir Foundry-class operations consoles.

Next.js React TypeScript Tailwind CSS Prisma Zustand License Status


Demo

Factory Command Center live demo

Live, ticking factory floor β€” line cards, machine tiles, OEE/throughput, and the alert feed all update in real time via a Zustand simulation loop.

Overview

FactoryFlow models a 3-line SMT (Surface-Mount Technology) assembly plant β€” Printer β†’ SPI β†’ Placement β†’ Reflow β†’ AOI β€” and gives plant managers, supervisors, and quality engineers a single pane of glass across plant-wide KPIs, live factory floor status, PCB traceability, warehouse management, and quality/defect tracking.

The domain model β€” DMC codes, SPI inspection pins (height/volume/area), and defect taxonomy β€” is grounded in a real Bosch SMT Solder Paste Inspection (SPI) tool, so the data shapes and workflows reflect an actual production line rather than a generic CRUD demo.

All 8 modules below are fully built and run on typed mock data (src/lib/mock-data/) β€” clone and run with no database setup. The Prisma schema documents the live-data path; see Roadmap.

Features

Module Route Description
Executive Dashboard / Plant-wide KPIs β€” OEE, throughput, yield, WIP, rework, X-Out β€” with animated tiles and trend charts
Factory Command Center /command-center Per-line cards with machine tiles, live alert feed, and activity timeline, driven by a Zustand live-simulation loop
PCB Traceability /traceability DMC/serial/batch search with full production history timeline and SPI/AOI inspection results
WIP Monitoring /wip Live work-in-progress table β€” current station, aging time, bottleneck and hold flags
Rack & Bin Management /racks Warehouse rack/bin occupancy with board-to-bin location lookup
X-Out Tracking /xout X-Out board list with reason codes, defect location, and disposition (scrap/rework) breakdown
Production Analytics /analytics OEE breakdown (availability/performance/quality), throughput, yield, and downtime trend charts
Alert Center /alerts Unified feed of critical/warning/info alerts across the plant

Architecture

FactoryFlow is a Next.js App Router application. The current build ships as a frontend-only system running on typed mock fixtures; the Prisma schema and API design document the production architecture the UI is built to slot into without structural changes.

Browser
 β”œβ”€ Next.js App Router UI  ──►  Component library (dashboard / command-center / layout / ui)
 β”‚        β”‚                              β”‚
 β”‚        └─────────► Zustand store β—„β”€β”€β”€β”€β”˜   (live simulation: tick() every 3s)
 β”‚                          β”‚
 └──────────────► src/lib/mock-data  ◄─.mirrors.─  src/lib/types.ts
                             β”‚
                  (Phase 5+, planned)
                             β–Ό
                  REST API β†’ PostgreSQL (Prisma) β†’ MQTT/WebSocket ingestion β†’ AI Copilot

See docs/ARCHITECTURE.md for the full system diagram (Mermaid), docs/ERD.md for the database design, and docs/API_DESIGN.md for the planned REST contract.

Tech Stack

Layer Choice
Framework Next.js 16 (App Router, TypeScript, Turbopack)
UI shadcn/ui (Base UI primitives), Tailwind CSS v4
Animation Framer Motion
Charts Recharts
State Zustand (live simulation layer)
Data layer Prisma 7 schema (PostgreSQL) β€” current build runs on typed mock fixtures
Icons lucide-react

Design System

A single industrial dark theme drives every surface β€” near-black backgrounds, sharp 4–8px radii, and a 6-color status system used consistently across lines, machines, boards, and alerts:

Status Color Meaning
Running 🟒 #22C55E Normal operation
Completed πŸ”΅ #3B82F6 Finished / shipped
Warning 🟑 #EAB308 Degraded, needs attention
Hold 🟠 #F97316 Paused, awaiting action
Critical πŸ”΄ #EF4444 Fault, halted
Offline βšͺ #6B7280 Not reporting

Screenshots

Executive Dashboard Factory Command Center
Executive Dashboard Factory Command Center
PCB Traceability WIP Monitoring
PCB Traceability WIP Monitoring

Capture instructions: docs/screenshots/README.md

Getting Started

npm install
npm run dev

Open http://localhost:3070.

No environment variables or database are required β€” the app runs entirely on typed mock data in src/lib/mock-data/. The Prisma schema in prisma/schema.prisma documents the production data model; see prisma/seed.ts for how the mock fixtures map to seed rows once a Postgres database is connected.

Scripts

Command Description
npm run dev Start the dev server on port 3070
npm run build Production build
npm run start Start the production server
npm run lint Run ESLint

Project Structure

src/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ (dashboard)/        # Sidebar + topbar shell, all 8 module pages
β”‚   β”‚   β”œβ”€β”€ page.tsx           # Executive Dashboard
β”‚   β”‚   β”œβ”€β”€ command-center/    # Factory Command Center
β”‚   β”‚   β”œβ”€β”€ traceability/       # PCB Traceability
β”‚   β”‚   β”œβ”€β”€ wip/ racks/ xout/ analytics/ alerts/
β”‚   β”‚   └── layout.tsx         # AppSidebar + TopBar shell
β”‚   β”œβ”€β”€ globals.css           # Industrial dark theme tokens
β”‚   └── layout.tsx            # Root layout, fonts
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ dashboard/             # KPI tiles, charts, line status strip
β”‚   β”œβ”€β”€ command-center/        # Line cards, machine tiles, live alert feed, activity timeline
β”‚   β”œβ”€β”€ layout/                 # AppSidebar, TopBar, StatusBadge
β”‚   └── ui/                     # shadcn/ui primitives
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ types.ts               # Domain types mirroring the Prisma schema
β”‚   β”œβ”€β”€ design-tokens.ts       # Status color system + helper mappers
β”‚   β”œβ”€β”€ mock-data/              # Typed fixtures (factories, lines, machines, boards, alerts, events, KPIs)
β”‚   β”œβ”€β”€ format-time.ts
β”‚   └── nav.ts                  # Sidebar navigation config
└── store/
    └── command-center-store.ts  # Zustand live-simulation store

prisma/
β”œβ”€β”€ schema.prisma              # Full PostgreSQL schema (17 models)
└── seed.ts                     # Documented seed stub (mock fixtures β†’ seed rows)

Live Simulation

The Factory Command Center includes a lightweight client-side simulation (Zustand tick() on a 3s interval) that nudges line throughput and machine cycle times to give a "live floor" feel. This is a stand-in for the real-time WebSocket/MQTT ingestion layer planned for Phase 5 β€” see docs/ARCHITECTURE.md.

Roadmap

Phase Focus Status
1 β€” Core Platform Project scaffold, design system, Prisma schema, mock data layer, Executive Dashboard, Command Center βœ… UI complete
2 β€” PCB Traceability DMC/serial/batch search, board history timeline, inspection grid βœ… UI complete
3 β€” WIP & Rack/Bin Management WIP table with aging/bottlenecks, rack/bin warehouse view βœ… UI complete
4 β€” X-Out & Production Analytics X-Out/rework workflow, OEE/defect/throughput analytics βœ… UI complete
5 β€” Real-Time Monitoring REST API routes for all modules, MQTT β†’ API β†’ WebSocket ingestion, Prisma + live Postgres, JWT auth & RBAC, Alert Center actions πŸ”œ Planned
6 β€” AI Manufacturing Copilot Natural-language queries over KPIs/events/alerts/board history πŸ”œ Planned

All UI modules (Phases 1–4) run on typed mock data today. The REST API layer for these modules (see docs/API_DESIGN.md) is part of the Phase 5 backend rollout. See docs/ROADMAP.md for the full breakdown.

Documentation

License

MIT Β© 2026 Dharshan Sai S

About

FactoryFlow is a modern manufacturing operations platform for SMT and PCB assembly environments, providing real-time production monitoring, traceability, WIP tracking, rack management, quality analytics, and factory command center capabilities.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors