← Docs Hub

Architecture Overview

Frontend, Gateway, MCP servers, Factory Simulation

System Overview

OpenShopFloor consists of four main layers that work together to provide a complete manufacturing AI platform:

// Architecture Overview
Browser (Next.js SPA)
OSF Gateway (Express + Node-RED)
├── Auth, Chat, Agents, Flows
├── Node-RED Editor (embedded)
MCP Servers (7 domains)
├── Factory (port 8020) — ERP, OEE, MRP, Capacity, TMS, SGM, Assembly, Energy
├── UNS (port 8025) — Live MQTT machine data
├── KG (port 8035) — Knowledge Graph, semantic search, charts
├── History (port 8030) — Time-series analytics
Factory Simulation (PostgreSQL databases)

Frontend (Next.js)

The frontend is a statically exported Next.js application hosted on Cloudflare Pages. It provides:

  • AI Chat — Conversational interface with SSE streaming
  • Agent Hub — Browse, run, and manage built-in and community agents
  • Flow Editor — Embedded Node-RED editor (iframe)
  • Challenges — Gamified factory optimization tasks
  • Documentation — This wiki and the MCP tool reference
Info
Since the frontend uses output: "export", all routes are statically generated at build time. Dynamic routes use generateStaticParams().

Gateway (Express)

The OSF Gateway is the backend API server running as a Kubernetes deployment. It handles:

  • Authentication — JWT-based auth with email/password registration
  • Chat API — Streams LLM responses with MCP tool calls via SSE
  • Agent Runner — Executes built-in and code agents in V8 sandboxes
  • Flow Engine — Executes Node-RED flows with the custom OSF engine
  • MCP Proxy — Routes tool calls to the appropriate MCP server
  • Node-RED — Embeds the Node-RED editor for visual flow building
  • Code Agents — GitHub integration, webhook sync, isolated-vm execution

The gateway runs as a single Express process with Node-RED embedded at the /flows path. Authentication uses JWT tokens via Bearer headers, API keys, or the osf_editor_token cookie for the Node-RED iframe.

MCP Servers

Multiple MCP servers expose factory data via the Model Context Protocol:

factory-sim:8020

Factory Simulator — ERP, OEE, capacity, MRP, maintenance, energy, stock, purchasing, subcontracting, TMS, SGM (injection molding), assembly, pre-assembly, and test field. Prefix: factory_, tms_,sgm_, montage_

mqtt-uns:8025

UNS (Unified Namespace) — live machine data via MQTT, topic search, alerts, cross-machine comparisons. Prefix: uns_

kg-server:8035

Knowledge Graph — Neo4j graph queries, impact analysis, semantic search (vector embeddings), chart generation, delivery snapshots. Prefix: kg_

historian:8030

Time-series analytics — trends, comparisons, aggregations, anomaly detection. Prefix: history_

Tip
See the MCP Tools Reference for a complete list of all 118 tools with parameters.

Factory Simulation

The factory simulation provides realistic manufacturing data. It simulates:

  • CNC Machines — 5 CNC turning/milling centers with real-time OEE, availability, and performance data
  • Injection Molding (SGM) — 3 injection molding machines with cycle times and quality data
  • Assembly Lines — Final assembly with station-level tracking
  • Pre-Assembly — Sub-assembly operations
  • Test Field — End-of-line testing with pass/fail data

Data is stored in PostgreSQL databases and updated by simulation routines. The simulation runs continuously, generating realistic production events, machine states, quality data, and order progress.

Info
See the Factory Simulation article for details on the data model and machine types.

LLM Integration

OSF uses locally hosted LLMs for all AI operations. Two model servers are available:

  • Port 5001 — Larger model for moderation, synthesis, and debate tasks
  • Port 5002 — qwen2.5-14b for specialist tasks (agents, flow nodes)

The chat API and flow engine route requests to the appropriate model based on the task type. All LLM calls include the user's MCP tool results as context.

Deployment

The platform runs on Kubernetes with the following setup:

  • Frontend — Cloudflare Pages (static export)
  • Gateway — K8s Deployment in namespace osf
  • MCP Servers — K8s Deployments in namespace demo
  • LLM Servers — GPU-attached pods
Tip
Want to run OSF locally? See the Self-Hosting Guide.

This site uses a cookie to remember your preferences. Analytics are anonymous and cookie-free. Privacy Policy