Repository navigation
Design: Hub Core v2
Status: design accepted 2026-11-18, changed by the owner's later decisions (2026-11-19/20): only Buddy's WebSocket dialect, and the agent link is the Prusa Connect SDK's protocol (sections 2 and 3). Steps 1, 2 and 4 are built and run on a test hub; nothing below is in a release yet. The target design is in the repository's docs/design. The full plan, with the reasons and the code it replaces, is in the repository: hub-core-v2.md.
The hub's core is rebuilt around one idea: every machine is a device that says what it can do. A 3D printer, a laser, a label printer, a scale and a camera all speak the same contract to the hub. The pages show a button because the device declared that command and its current state accepts it, not because a page knows the brand.
The design came out of reading Prusa's own Connect server (prusa3d/prusa-connect) side by side with ours. We read it to learn from its design; none of its code or text is copied (its licence does not allow that), and Maker Connect stays its own project: makerspaces, Spaces and members, lasers, labels, materials and door access are ours and stay.
flowchart LR
subgraph Machines
MINI["Prusa MINI<br/>Buddy firmware"]
subgraph Pi["Agent on a Pi"]
MA["Marlin printer"]
LA["GRBL laser"]
LB["DYMO label printers"]
SC["USB scale"]
end
end
subgraph Hub
DR["Prusa driver<br/>(two dialects)"]
CORE["Device contract<br/>commands as records"]
EV["One event stream"]
AZ["Actions within a Space"]
DB[("Postgres +<br/>TimescaleDB")]
API["/api/v1<br/>OpenAPI"]
end
UI["Web pages, apps,<br/>scripts"]
MINI -->|"6.3 HTTP or 6.4+ WebSocket"| DR --> CORE
Pi -->|"agent link v2:<br/>POST up, SSE down"| CORE
CORE --> EV --> DB
AZ --- API
EV --> API --> UI
A device has:
- an identity: vendor, model, firmware label, serial;
- capabilities: the commands it accepts, each with typed arguments (unit, bounds). The set a device offers is what its driver can do, narrowed by its model profile and by what the device itself reports. When the set changes, its version number goes up, so pages know to redraw;
- states, and for each state which commands it accepts;
- a state tree (temperatures, progress, position, weight, …) that changes by small patches;
- commands that end in a result: done, refused by the device (with the device's own reason), failed, or outcome unknown. A command is never reported as done when nobody saw it happen.
Firmware versions are labels; the hub never compares them to decide what to do. What a device can do comes from its capabilities.
| Kind | Commands | Port |
|---|---|---|
| 3D printer | Prusa's own command names and states, same meanings | hub (Prusa), agent (Marlin) |
| Laser | frame, set and go to origin, unlock, read settings, start, stop | agent, LaserFoundry |
| Label printer | print, and feed where the reference has it | agent: labelle, the LabelWriter 450, the 320 |
| Scale | none, only state (weight, stable) | agent |
| Camera | snapshot, stream | hub (RTSP), agent (USB) |
The main rule does not change. The contract lives inside Maker Connect. What reaches a machine is still made by a port that follows its one reference to the letter (Buddy, OctoPrint, labelle, LaserFoundry). A command the reference has no call for is not offered at all. Our own limits stay in the hub and in the pages, never on the wire.
The laser rule stays. A laser starts only from a person on its page, never from the queue or from an API token.
One Prusa driver in the hub, for Buddy 6.4 and later: registration, then the WebSocket /p/ws, as Prusa's own self-hosted Prusa Connect serves it. Buddy 6.3.0's HTTP protocol is not served (decision 2026-11-19). Tried on a real MINI on Buddy 8.0.2.
The agent keeps every port and its reference as they are. What changed is the link to the hub: every device on the agent is its own Prusa Connect printer, linked as the Prusa Connect SDK does it (registration by code over /p/register, then telemetry, events and commands over the WebSocket /p/ws), a port of the SDK itself (decision 2026-11-19). One agent serves a label printer, a second one and a Marlin printer at once. What the SDK has no word for is an extension, written part by part in prusa-sdk-extension.md.
Everything that happens is one kind of event, with a number, a type, a time, the Space, the source and who caused it (a person, a token, the agent, the queue, the device). Facts (online, offline, job started, job ended, command settled, permission changed, material moved) are stored. There is one live stream, /api/v1/events. Each listener sees only the devices it may see. After a dropped connection the page sends the last number it had, and gets the current state plus everything it missed.
Every command is written down before it is sent: who asked, what, with which arguments; whether it was allowed and by which permission; when it was sent; how it ended. If the hub restarts, open commands become outcome unknown and are never sent again by themselves. File transfers to printers are tracked the same way. This is the base for job history with costs (Roadmap).
- Every command needs a named action (view, move, heat, send G-code, start a job, start the laser, manage members, …).
- Today's levels (view, use, operate, manage) stay as presets in the Space's permissions page.
- Damaging actions (raw G-code, starting a laser, a firmware update) are never part of a preset: they are given by name, to a person, on a device. Owning a Space is not the same as having had the laser course.
- Lists, counts and the event stream only ever contain what you may see, filtered in the database.
- Spaces are kept apart twice: by the hub's own queries, and by the database itself (row-level security), so a forgotten filter still shows nothing of another Space. See Multi-Tenant Hub.
- Door access stays separate: a door badge never gives machine permissions, and machine permissions never open doors.
The whole store moves from SQLite to Postgres, with TimescaleDB for history:
- temperatures and other values are kept as samples, with averages per minute and per hour, compressed after a week;
- gaps (hub restarted, agent offline) are stored, so a chart shows a gap instead of a straight line;
- default retention: raw samples 30 days, minute averages a year, hour averages forever; events a year; command records and the audit log forever.
It was tried on a Raspberry Pi with 1 GB of memory (armhf) in Docker, within a 384 MB limit. On 64-bit hosts TimescaleDB installs from packages; that is the advised host for a makerspace.
-
/api/v1is the hub's public API, and the web pages use only that API. - For 3D printers it serves the same paths and fields as Prusa's Connect server, so tools made for that server work with the hub. We write that description ourselves, from how their server behaves.
- Lasers, labels, queue, farm, materials, cameras, members and permissions follow the same style.
- The description (OpenAPI) is generated from the code, so it cannot drift. Every change to it is checked, and a change that can break a client is listed in a changelog.
- The Spoolman-compatible API moves to
/spoolman/api/v1. Point a Spoolman client athttp://your-hub/spoolman.
The pages stay rendered by the hub; no rewrite into a separate JavaScript app. Page by page, everything a page reads or changes goes through the public API. Every page then gets the same habits: loading, empty, error and not allowed each say so in words, an unknown value is never shown as 0, and a button that cannot be pressed says why.
One step at a time; each ends with every test and audit green.
| # | Step | Status |
|---|---|---|
| 1 | Device contract, its test kit, and the registries (commands, states, events, actions, error codes, values) | built |
| 2 | Store on Postgres, Spaces kept apart in the database | built |
| 3 | Permissions as actions, the event stream, history in TimescaleDB | |
| 4 | Commands as records, agent link v2 | agent link built (Prusa Connect SDK) |
| 5 | Prusa driver on the contract: Buddy's WebSocket only | hub side built, tried on a MINI |
| 6 | The API: OpenAPI, the Prusa paths, ours, Spoolman's new path | |
| 7 | The pages on the API |
Later: the MK3 comes as a port of PrusaLink on its WebSocket branch (#78); Klipper waits. Nobody runs the hub in production yet, so old data is not carried over.
Guides
- Getting Started
- The Agent
- Updates
- Klipper
- Lasers
- Label Printers
- Cameras
- Materials
- Machine Profiles
- Supported Machines
Design
- House Style
- Hub Core v2
- Devices in a Tree
- Multi-Tenant Hub
- Consumables and Stock
- Print Farm
- Door Access
- Door Controller
- The Website
- Stream Deck (idea, WIP)
- Roadmap
Code