You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FactoryFlow Phase 1 reads from typed mock fixtures (src/lib/mock-data/) directly in server/client components — there is no API layer yet. This document specifies the REST contract that Phase 2+ implements as Next.js Route Handlers (src/app/api/**/route.ts), backed by Prisma (see ERD.md).
Conventions
Base path: /api/v1
Auth: Bearer JWT (issued at login), role-checked per route against RoleName
Pagination: ?page=1&pageSize=25 → { data: [...], page, pageSize, total }
Filtering: query params map to model fields, e.g. ?lineId=line-smt-02&status=OPEN
Errors: { error: { code, message } } with standard HTTP status codes
Timestamps: ISO 8601, UTC on the wire; rendered in the factory's timezone
Mutations return the updated resource
Module Routes
Executive Dashboard
Method
Route
Description
GET
/api/v1/factories/:factoryId/kpis
Current KPISummary (OEE, throughput, yield, WIP, rework, X-Out, efficiency)
GET
/api/v1/factories/:factoryId/kpis/trends
KPITrends — throughput/yield/WIP series + per-line utilization
Factory Command Center
Method
Route
Description
GET
/api/v1/factories/:factoryId/lines
All ProductionLines with current status/throughput/OEE