FactoryPulse

React TypeScript FastAPI MQTT InfluxDB PostgreSQL Docker

FactoryPulse industrial monitoring hero

FactoryPulse is a full-stack industrial production monitoring system built as a case study. It turns simulated machine telemetry into a browser-based HMI dashboard with live status, remote commands, alarms, OEE analytics, downtime explanations, reporting, auditability, and a realistic industrial integration path through MQTT and OPC UA.

The project is intentionally shaped around one question:

How would a traditional onboard HMI evolve into a secure, web-based production monitoring system without losing the operational discipline required around industrial machines?

Why This Exists

Industrial machines are complex systems made of PLCs, sensors, drives, safety devices, robots, and local HMI panels. Operators can usually see what is happening at the machine, but customers increasingly want remote production visibility:

FactoryPulse answers that with a web-service architecture instead of a static HMI screen. The result is not just a dashboard; it is a small model of how industrial telemetry, web APIs, analytics, authorization, audit trails, and integration boundaries fit together.

Experience At A Glance

Area What it demonstrates
Operations Live machine status, production progress, OEE, remote commands, active alarms
Analytics Downtime reasons, shift KPIs, production/process trends, custom date-range reports
Configuration Threshold alert rules and notification targets persisted in PostgreSQL
System MQTT, InfluxDB, PostgreSQL, OPC UA adapter, WebSocket clients, machine freshness

Demo Video

The demo video is generated from real dashboard screenshots and gives a quick overview of the main views: Operations, Analytics, Configuration, and System Health.

Operations

Operations view

System Story

Machine Simulator / OPC UA Adapter
              |
         MQTT Broker
              |
        FastAPI Backend
        /      |      \
 WebSocket   InfluxDB  PostgreSQL
    |
React Dashboard

The simulator behaves like machine-side control software publishing telemetry, events, and command results. MQTT carries those messages into the backend. FastAPI exposes REST endpoints and authenticated WebSockets. InfluxDB stores high-frequency telemetry for charts and analytics. PostgreSQL stores audit records, command history, alarm events, notification attempts, and persistent configuration.

The OPC UA adapter is included as a production integration boundary: in a real machine deployment it would poll PLC node IDs and translate them into the same MQTT topic model used by the dashboard.

For deeper architecture and theory, see TECHNICAL_NOTES.md.

Project Structure

factorypulse/
├── backend/              FastAPI service, REST/WebSocket API, auth, analytics, audit persistence
├── frontend/             React + TypeScript dashboard built with Tailwind CSS and Plotly charts
├── simulator/            Machine telemetry simulator and MQTT command-response worker
├── opcua-adapter/        OPC UA integration boundary, currently running in simulated status mode
├── mosquitto/            Local MQTT broker configuration
├── docs/                 Hero image, demo video, and dashboard screenshots
├── scripts/              Smoke test
├── docker-compose.yml    Full local stack: API, UI, MQTT, InfluxDB, PostgreSQL, simulator, adapter
└── TECHNICAL_NOTES.md    Architecture, theory, safety notes, and production-readiness details

What The Project Shows

Simulator Behavior

The simulator is intentionally more than random data. It models three machine types with different production personalities:

Machine Behavior profile
CUTTER-01 Faster cycle time, medium output, temperature and pressure alarms
PACKER-02 Higher units per cycle, packaging-style throughput, low-pressure and emergency-stop alarms
ROBOT-03 Slower precision movement, lower reject probability, robot-cell style alarms

Each simulated machine publishes telemetry once per second to MQTT:

factory/machines/{machine_id}/telemetry
factory/machines/{machine_id}/events
factory/machines/{machine_id}/command-results

The simulator tracks machine state over time:

Recipes change behavior:

Remote commands are processed through MQTT and answered by the simulator. The backend validates commands first, then the simulator applies accepted actions such as start, stop, reset alarm, acknowledge alarm, target changes, and recipe changes.

Analytics Model

FactoryPulse uses analytics that map to practical production questions rather than decorative charts:

Question Dashboard answer
How healthy is the selected machine? OEE, availability, performance, quality, reject rate, downtime
What happened this shift? Shift output, average OEE, total downtime, per-machine comparison
Why did downtime happen? Alarm-based downtime reasons and affected machines
What happened in a selected period? Date-range production report with CSV export
Is telemetry fresh? System view reports machine freshness and infrastructure health

OEE is calculated from telemetry samples:

The reporting view combines telemetry downtime from InfluxDB with alarm-event downtime from PostgreSQL so the dashboard can show both process performance and operational reasons.

Alerts And Notifications

FactoryPulse separates machine alarms from threshold alerts:

Alert rules are configurable from the dashboard and persisted in PostgreSQL. When a threshold is breached, the backend opens an alert, writes an event, records an audit entry, and creates notification attempts.

Notification targets can be:

Recent notification attempts are visible in the Configuration view so the user can see what would have been sent, to whom, and whether delivery succeeded.

Design Choices Worth Noticing

Run

docker compose up --build

Then open:

InfluxDB credentials:

PostgreSQL credentials:

Demo Users

Username Password Role Capabilities
operator // create password Operator View dashboard, acknowledge alarms
supervisor // create password Supervisor Change targets, recipes, alert rules, notification targets
maintenance // create password Maintenance Start, stop, acknowledge, reset alarms
admin // create password Admin All remote commands and configuration

Guided Demo

  1. Sign in as maintenance.
  2. Open Operations and inspect live machine status.
  3. Select a machine and use Demo Alarm.
  4. Acknowledge and reset the alarm.
  5. Open Analytics and inspect downtime reasons and trend charts.
  6. Run a production report for the last 8 hours and export CSV.
  7. Sign in as supervisor.
  8. Open Configuration and toggle an alert rule or add a simulated notification target.
  9. Open System and confirm MQTT, InfluxDB, PostgreSQL, OPC UA, WebSocket, and machine freshness.

Test

Backend unit tests:

docker compose run --rm backend python -m unittest discover -s tests

Running-stack smoke test:

python3 scripts/smoke_test.py

The smoke test checks login, protected endpoints, system health, demo alarm authorization, notification recording, and production reporting.

Screenshots

Operations

Operations view

Analytics

Analytics view

Configuration

Configuration view

System Health

System view

Production Readiness

FactoryPulse is designed around separable production concerns, so the local demo can be explained as a path toward a real industrial deployment.

Simulator vs real machines:

MQTT and OPC UA roles:

Auth, audit, and safety constraints:

Known Limitations

Future Work