IMPLEMENTATION DOCS / UNS FRAMEWORK
Components
The 12 documented components of fn-uns, grouped by their role in capturing, processing, and using machine data.
Use this map to choose the components for your use case. The sample quick start runs only the capture pipeline.
On this page 6 sections
Data Pipeline
┌─────────────────────────────────────────────────────────────┐
│ CAPTURE │
│ uns-sim ──→ MQTT Broker ──→ uns-framework ──→ Valkey Cache │
└──────────────────────────────────┬──────────────────────────┘
│
┌──────────────────────────────────┼──────────────────────────┐
│ PROCESS │ │
│ uns-cache ← reads ─────────────┤ │
│ uns-log ← reads ───────────────┤ │
│ uns-state ← reads ─────────────┘ │
│ │ │
│ ▼ │
│ uns-stoppage ← reads uns_state table │
│ uns-productivity ← reads Valkey /program topics │
│ uns-input ← receives HTTP POST from operators │
└──────────────────────────────────┬──────────────────────────┘
│
┌──────────────────────────────────┼──────────────────────────┐
│ REPORT │ │
│ uns-kpi ← reads all PostgreSQL tables ──→ JSON KPI response│
└──────────────────────────────────┬──────────────────────────┘
│
┌──────────────────────────────────┼──────────────────────────┐
│ AI │ │
│ uns-ai ← reads Valkey + all PostgreSQL tables │
│ → calls AI provider (OpenAI / Anthropic) │
│ → publishes results to MQTT │
│ → stores audit trail in PostgreSQL │
└─────────────────────────────────────────────────────────────┘
Capture Layer
| Component | Language | Type | Purpose |
|---|---|---|---|
| uns-sim | Node.js | MQTT publisher | Simulates 4 CNC machines across 2 areas |
| uns-framework | Go | MQTT subscriber | Caches all UNS topics to Valkey |
Processing Layer
| Component | Language | Type | Purpose |
|---|---|---|---|
| uns-cache | Node.js | HTTP | Reads cached topics with change detection |
| uns-log | Go | HTTP | Logs change snapshots to PostgreSQL |
| uns-historian | Go | MQTT | Logs every value change to PostgreSQL in real-time |
| uns-state | Go | HTTP | Tracks machine state durations |
| uns-stoppage | Node.js | HTTP | Classifies stoppage reasons |
| uns-productivity | Go | HTTP | Tracks production runs and throughput |
| uns-input | Node.js | HTTP | Manual operator data entry |
Reporting Layer
| Component | Language | Type | Purpose |
|---|---|---|---|
| uns-kpi | Go | HTTP | Computes manufacturing KPIs from all data |
| uns-dashboard | Grafana | Dashboards | 5 dashboards for real-time manufacturing visibility |
AI Layer
| Component | Language | Type | Purpose |
|---|---|---|---|
| uns-ai | Node.js | HTTP | AI-powered analysis: anomaly detection, shift summaries, smart alerting, predictive maintenance |
Shared Patterns
All functions follow consistent patterns:
| Pattern | Description |
|---|---|
| Valkey config | Runtime configuration stored in fnkit:config:*, cached 30s |
| Auto-create tables | PostgreSQL tables created on first run, no migrations |
| UNS path parsing | Hierarchy (enterprise/site/area/machine) extracted from topic path |
| JSON responses | All HTTP functions return structured JSON |
| Docker containers | Each function runs in its own container on fnkit-network |
| Independent deploy | Update one function without affecting others |
See Code Patterns for implementation details.