# frangoteam/fuxa architecture

> Architecture diagram of the GitHub repository frangoteam/fuxa, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/frangoteam/fuxa
- Repository: https://github.com/frangoteam/fuxa

## Overview

1. **What this repo is**
   - FUXA is a full-stack industrial SCADA/HMI platform with three execution forms: a browser-based app, an Electron desktop package, and a headless portable/server mode.
   - The architecture is centered on a Node.js backend plus an Angular frontend, with shared runtime logic in the server and the bulk of the UI/editor in the client.

2. **Top-level deployment boundary**
   - `server/` is the main runtime host and API layer.
   - `client/` is the Angular SPA that provides the editor, dashboards, and admin screens.
   - `app/electron/` packages the same product as a desktop application.
   - `app/headless/` provides a non-GUI executable wrapper for embedded/server deployments.
   - Docker and `compose.yml` are first-class deployment paths, with persistent volumes for app data, database/history, logs, and images.

3. **Frontend subsystem: editor + runtime UI**
   - The Angular app is not just a thin UI; it contains the project editor, runtime views, administration screens, and many reusable HMI widgets.
   - Key areas include:
     - `editor/` for building views, layouts, charts, cards, scripts, and widget configuration.
     - `gauges/`, `fuxa-view/`, `view/`, `cards-view/`, `iframe/`, and `maps/` for runtime visualization.
     - `device/`, `alarms/`, `reports/`, `scripts/`, `users/`, `plugins/`, and `settings`-related screens for administration.
   - Shared Angular services in `_services/` act as the client-side integration layer to backend APIs and runtime updates.

4. **Backend runtime: central orchestration layer**
   - `server/main.js` and `server/runtime/` form the core application engine.
   - This layer owns:
     - project loading/saving
     - authentication and authorization
     - device orchestration
     - alarms and notifications
     - historian/data acquisition
     - scheduler and scripts
     - plugin management
     - reporting jobs
   - `server/api/` exposes the HTTP API surface consumed by the Angular app and integrations.

5. **Device acquisition subsystem**
   - Industrial connectivity is implemented as pluggable runtime drivers under `server/runtime/devices/`.
   - Supported protocols/devices include Modbus, S7, OPC-UA, BACnet, MQTT, Ethernet/IP, ODBC, ADS, GPIO, WebCam, MELSEC, Redis, HTTP request, and a template/device abstraction.
   - The client mirrors this with protocol-specific tag/property editors under `client/src/app/device/tag-property/`, so protocol choice is a major boundary in the model.

6. **Data path: from devices to UI/history**
   - The main flow is: device drivers read/write tags → runtime stores current values and events → client views render live data and trends.
   - Historian components under `server/runtime/storage/` persist DAQ data to SQLite and optional time-series backends such as InfluxDB, QuestDB, and TDengine.
   - The client charts, tables, gauges, and HMI widgets consume these values through the backend services rather than talking directly to devices.

7. **Project/model persistence**
   - Projects are treated as first-class artifacts and appear to be stored as project files plus server-managed storage state.
   - `server/runtime/project/` and `server/api/projects/` manage project lifecycle.
   - The repo includes demo/default project files (`server/project.default.json`, `server/project.demo.fuxap`, `client/src/assets/project.demo.fuxap`) that show the project is portable and file-backed as well as service-backed.

8. **Operations and control plane**
   - `server/api/auth`, `users`, `apikeys`, and JWT helper code define the security boundary.
   - `command`, `diagnose`, `alarms`, `scheduler`, `scripts`, and `reports` are separate runtime control domains exposed through APIs and reflected in dedicated UI sections.
   - The architecture is therefore split between “data acquisition” and “operations/control” rather than being only a visualization app.

9. **Alarm, notification, and scheduler pipeline**
   - Alarms are handled in `server/runtime/alarms/` and surfaced through the UI alarm screens.
   - Notifications live in `server/runtime/notificator/` and connect alarm/runtime events to user-facing alerts.
   - Scheduler logic exists both server-side and in the client editor, indicating scheduled jobs/actions are designed as a runtime capability with editable configuration.

10. **Scripts and automation**
   - `server/runtime/scripts/` executes automation logic, while the Angular `scripts/` area provides editing, permissions, and scheduling screens.
   - This makes scripts another runtime subsystem, not just a UI feature.
   - The repo also includes a Node-RED integration, which extends automation flows with FUXA-specific nodes for reading/writing tags, opening views/cards, sending messages, and manipulating devices.

11. **Extensibility and resource model**
   - `server/runtime/plugins/` and `client/src/app/plugins/` form the plugin boundary.
   - `server/runtime/resources/` and `client/src/app/resources/` manage reusable assets such as images, widgets, and kiosk-related content.
   - The presence of SVG editor assets and shape libraries indicates the UI is heavily asset-driven and extensible through custom widgets/shapes.

12. **Integration surface**
   - `server/api/` is the public backend surface for the SPA and external automation clients.
   - Node-RED custom nodes in `node-red/node-red-contrib-fuxa/` and the mirrored copies under `server/integrations/node-red/` expose FUXA operations to flow-based automation.
   - There is also support for external DB connectivity via ODBC and time-series databases for historians.

13. **Packaging and build ecosystem**
   - The repo is organized for multiple packaging targets: Docker images, Electron desktop builds, headless binaries, and source install.
   - The Angular build output is embedded into server/app packaging, so the frontend is a compiled artifact served by the backend/desktop shell.
   - Documentation is maintained as MkDocs content under `docs/`, and GitHub Actions automate docs, Docker, Electron, and headless packaging.

14. **How to draw the architecture**
   - A good diagram should show:
     - Client/editor SPA on the left
     - Node.js server/runtime in the center
     - Industrial devices/protocol drivers on the right
     - Persistent stores below the runtime
     - Optional integrations like Node-RED, plugins, and external time-series/ODBC databases around the runtime
   - The key arrows are: user configuration flows from SPA to server; live tag/alarm/data flows from devices to runtime to SPA; persistence flows from runtime to project files/databases; automation flows from scripts/scheduler/Node-RED back into devices and UI.

Main entry points: [`server/main.js`](https://github.com/frangoteam/fuxa/blob/master/server/main.js) (Server host), [`client/src/app`](https://github.com/frangoteam/fuxa/tree/master/client/src/app) (Angular app), [`server/api`](https://github.com/frangoteam/fuxa/tree/master/server/api) (HTTP API), [`server/runtime/project`](https://github.com/frangoteam/fuxa/tree/master/server/runtime/project) (Project store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client SPA"]
  node_client_app["Angular app<br/>SPA shell"]
  node_client_editor["Editor"]
  node_client_runtime["Runtime UI<br/>HMI views"]
  node_client_gauges["Widgets"]
  node_client_device_ui["Device config<br/>protocol editors"]
  node_client_ops["Ops screens<br/>admin modules"]
  node_client_services["API services<br/>integration layer"]
end

subgraph group_server["Server Runtime"]
  node_server_main["Server host<br/>Node entrypoint<br/>[main.js]"]
  node_server_api["HTTP API<br/>REST surface"]
  node_server_project["Project store<br/>project lifecycle"]
  node_server_auth["Security<br/>authn/authz"]
  node_server_devices["Drivers<br/>protocol runtime"]
  node_server_alarms["Alarms<br/>event pipeline"]
  node_server_storage[("Historian<br/>DAQ storage")]
  node_server_scheduler["Scheduler<br/>job orchestration"]
  node_server_scripts["Scripts<br/>automation runtime"]
  node_server_plugins["Plugins<br/>extensibility"]
  node_server_reports["Reports<br/>report jobs<br/>[report.js]"]
  node_server_notifications["Notifications<br/>alert delivery"]
end

subgraph group_integrations["Integrations"]
  node_node_red["Node-RED<br/>flow integration"]
  node_desktop_headless["Desktop/headless<br/>packaging wrappers"]
end

subgraph group_persistence["Persistence"]
  node_project_files["Project files<br/>portable artifacts<br/>[project.demo.fuxap]"]
  node_hist_backends[("DB backends<br/>external stores")]
end

node_client_app -->|"contains"| node_client_editor
node_client_app -->|"contains"| node_client_runtime
node_client_app -->|"uses"| node_client_gauges
node_client_app -->|"contains"| node_client_device_ui
node_client_app -->|"contains"| node_client_ops
node_client_app -->|"calls"| node_client_services
node_client_services -->|"requests"| node_server_api
node_server_main -->|"hosts"| node_server_api
node_server_main -->|"manages"| node_server_project
node_server_main -->|"orchestrates"| node_server_devices
node_server_main -->|"runs"| node_server_alarms
node_server_main -->|"persists"| node_server_storage
node_server_main -->|"schedules"| node_server_scheduler
node_server_main -->|"executes"| node_server_scripts
node_server_main -->|"extends"| node_server_plugins
node_server_main -->|"generates"| node_server_reports
node_server_alarms -->|"triggers"| node_server_notifications
node_server_devices -->|"writes"| node_server_storage
node_server_storage -->|"stores in"| node_hist_backends
node_server_project -->|"loads/saves"| node_project_files
node_node_red -->|"integrates with"| node_server_api
node_node_red -->|"controls"| node_server_devices
node_desktop_headless -->|"wraps"| node_server_main
node_client_editor -->|"edits"| node_server_project
node_client_ops -->|"administers"| node_server_api

click node_client_app "https://github.com/frangoteam/fuxa/tree/master/client/src/app"
click node_client_editor "https://github.com/frangoteam/fuxa/tree/master/client/src/app/editor"
click node_client_runtime "https://github.com/frangoteam/fuxa/tree/master/client/src/app/view"
click node_client_gauges "https://github.com/frangoteam/fuxa/tree/master/client/src/app/gauges"
click node_client_device_ui "https://github.com/frangoteam/fuxa/tree/master/client/src/app/device"
click node_client_ops "https://github.com/frangoteam/fuxa/tree/master/client/src/app/alarms"
click node_client_services "https://github.com/frangoteam/fuxa/tree/master/client/src/app/_services"
click node_server_main "https://github.com/frangoteam/fuxa/blob/master/server/main.js"
click node_server_api "https://github.com/frangoteam/fuxa/tree/master/server/api"
click node_server_project "https://github.com/frangoteam/fuxa/tree/master/server/runtime/project"
click node_server_auth "https://github.com/frangoteam/fuxa/tree/master/server/api/auth"
click node_server_devices "https://github.com/frangoteam/fuxa/tree/master/server/runtime/devices"
click node_server_alarms "https://github.com/frangoteam/fuxa/tree/master/server/runtime/alarms"
click node_server_storage "https://github.com/frangoteam/fuxa/tree/master/server/runtime/storage"
click node_server_scheduler "https://github.com/frangoteam/fuxa/tree/master/server/runtime/scheduler"
click node_server_scripts "https://github.com/frangoteam/fuxa/tree/master/server/runtime/scripts"
click node_server_plugins "https://github.com/frangoteam/fuxa/tree/master/server/runtime/plugins"
click node_server_reports "https://github.com/frangoteam/fuxa/blob/master/server/runtime/jobs/report.js"
click node_server_notifications "https://github.com/frangoteam/fuxa/tree/master/server/runtime/notificator"
click node_node_red "https://github.com/frangoteam/fuxa/tree/master/node-red/node-red-contrib-fuxa"
click node_desktop_headless "https://github.com/frangoteam/fuxa/tree/master/app"
click node_project_files "https://github.com/frangoteam/fuxa/blob/master/server/project.demo.fuxap"
click node_hist_backends "https://github.com/frangoteam/fuxa/tree/master/server/runtime/storage/sqlite"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_client_app,node_client_editor,node_client_runtime,node_client_gauges,node_client_device_ui,node_client_ops,node_client_services toneBlue
class node_server_main,node_server_api,node_server_project,node_server_auth,node_server_devices,node_server_alarms,node_server_storage,node_server_scheduler,node_server_scripts,node_server_plugins,node_server_reports,node_server_notifications toneAmber
class node_node_red,node_desktop_headless toneMint
class node_project_files,node_hist_backends toneRose
```

## Components

### Client SPA

Angular frontend for editor, runtime views, and admin screens.

- [Angular app](https://github.com/frangoteam/fuxa/tree/master/client/src/app): SPA shell · Main browser application hosting editor, dashboards, and admin UI. · `client/src/app`
- [Editor](https://github.com/frangoteam/fuxa/tree/master/client/src/app/editor): view/model editor · Builds views, layouts, charts, widgets, scripts, and setup flows. · `client/src/app/editor`
- [Runtime UI](https://github.com/frangoteam/fuxa/tree/master/client/src/app/view): HMI views · Live operator screens and reusable visualization surfaces. · `client/src/app/view`
- [Widgets](https://github.com/frangoteam/fuxa/tree/master/client/src/app/gauges): HMI widgets · Reusable gauges, tables, charts, shapes, iframes, and controls. · `client/src/app/gauges`
- [Device config](https://github.com/frangoteam/fuxa/tree/master/client/src/app/device): protocol editors · Client-side protocol-specific device and tag configuration screens. · `client/src/app/device`
- [Ops screens](https://github.com/frangoteam/fuxa/tree/master/client/src/app/alarms): admin modules · Alarms, users, reports, scripts, plugins, resources, maps, notifications, logs, and settings. · `client/src/app/alarms`
- [API services](https://github.com/frangoteam/fuxa/tree/master/client/src/app/_services): integration layer · Angular services that call backend APIs and stream runtime updates. · `client/src/app/_services`

### Server Runtime

Node.js backend, APIs, and operational runtime.

- [Server host](https://github.com/frangoteam/fuxa/blob/master/server/main.js): Node entrypoint · Main application process and runtime bootstrap. · `server/main.js`
- [HTTP API](https://github.com/frangoteam/fuxa/tree/master/server/api): REST surface · API boundary consumed by the SPA, Node-RED, and external clients. · `server/api`
- [Project store](https://github.com/frangoteam/fuxa/tree/master/server/runtime/project): project lifecycle · Loads, saves, and serves project artifacts and defaults. · `server/runtime/project`
- [Security](https://github.com/frangoteam/fuxa/tree/master/server/api/auth): authn/authz · JWT, API keys, users, and authorization controls. · `server/api/auth`
- [Drivers](https://github.com/frangoteam/fuxa/tree/master/server/runtime/devices): protocol runtime · Pluggable industrial device drivers for acquisition and control. · `server/runtime/devices`
- [Alarms](https://github.com/frangoteam/fuxa/tree/master/server/runtime/alarms): event pipeline · Alarm detection, storage, acknowledgment, and notification flow. · `server/runtime/alarms`
- [Historian](https://github.com/frangoteam/fuxa/tree/master/server/runtime/storage): DAQ storage · Current-value and historical persistence across SQLite and time-series backends. · `server/runtime/storage`
- [Scheduler](https://github.com/frangoteam/fuxa/tree/master/server/runtime/scheduler): job orchestration · Scheduled actions and periodic automation jobs. · `server/runtime/scheduler`
- [Scripts](https://github.com/frangoteam/fuxa/tree/master/server/runtime/scripts): automation runtime · Executes server-side automation and script logic. · `server/runtime/scripts`
- [Plugins](https://github.com/frangoteam/fuxa/tree/master/server/runtime/plugins): extensibility · Plugin loading and npm-backed runtime extensions. · `server/runtime/plugins`
- [Reports](https://github.com/frangoteam/fuxa/blob/master/server/runtime/jobs/report.js): report jobs · Report generation and report-related services. · `server/runtime/jobs/report.js`
- [Notifications](https://github.com/frangoteam/fuxa/tree/master/server/runtime/notificator): alert delivery · Notification fan-out connected to alarms and runtime events. · `server/runtime/notificator`

### Integrations

External automation and packaging entrypoints.

- [Node-RED](https://github.com/frangoteam/fuxa/tree/master/node-red/node-red-contrib-fuxa): flow integration · Custom nodes expose FUXA data, devices, views, and messages to flows. · `node-red/node-red-contrib-fuxa`
- [Desktop/headless](https://github.com/frangoteam/fuxa/tree/master/app): packaging wrappers · Electron desktop packaging and headless server wrapper. · `app`

### Persistence

Project files and historian backends.

- [Project files](https://github.com/frangoteam/fuxa/blob/master/server/project.demo.fuxap): portable artifacts · Demo/default project files used as portable and service-backed project state. · `server/project.demo.fuxap`
- [DB backends](https://github.com/frangoteam/fuxa/tree/master/server/runtime/storage/sqlite): external stores · SQLite plus optional InfluxDB, QuestDB, TDengine, and ODBC-connected stores. · `server/runtime/storage/sqlite`

## Connections

- Angular app → Editor: contains · The SPA exposes the project editor and configuration workflows.
- Angular app → Runtime UI: contains · The SPA serves operator runtime views and dashboards.
- Angular app → Widgets: uses · Runtime views are assembled from reusable HMI widgets.
- Angular app → Device config: contains · Protocol-specific device and tag editors live in the client.
- Angular app → Ops screens: contains · Administrative screens cover alarms, users, reports, scripts, and more.
- Angular app → API services: calls · Client services bridge Angular screens to backend APIs and updates.
- API services → HTTP API: requests · The SPA uses the HTTP API for CRUD, runtime control, and live data.
- Server host → HTTP API: hosts · Main runtime process exposes the API surface.
- Server host → Project store: manages · Server bootstrap loads and persists project state.
- Server host → Drivers: orchestrates · Runtime coordinates device drivers and tag I/O.
- Server host → Alarms: runs · Alarm evaluation and event handling are central runtime duties.
- Server host → Historian: persists · Runtime writes current values and historian data to storage.
- Server host → Scheduler: schedules · Periodic jobs and timed actions are executed by the runtime.
- Server host → Scripts: executes · Automation scripts run inside the server runtime.
- Server host → Plugins: extends · Plugins augment the runtime and integrations.
- Server host → Reports: generates · Reporting jobs are produced by the server runtime.
- Alarms → Notifications: triggers · Alarm events feed the notification pipeline.
- Drivers → Historian: writes · Driver reads and writes populate live and historical data.
- Historian → DB backends: stores in · Historian data is persisted to SQLite or external time-series/databases.
- Project store → Project files: loads/saves · Projects are file-backed as portable artifacts.
- Node-RED → HTTP API: integrates with · Node-RED custom nodes call into FUXA services and data.
- Node-RED → Drivers: controls · Flows can read, write, and manipulate devices and tags.
- Desktop/headless → Server host: wraps · Electron and headless modes package the same server-centered product.
- Editor → Project store: edits · Editor workflows define and save project artifacts.
- Ops screens → HTTP API: administers · Operational screens manage alarms, users, scripts, reports, and settings via API.
