Skip to content

API module — Fastify + WebSocket, status: 🟢 ACTIVE. The only active backend of the system: the legacy olimpico-live-backend/ (Nitro/Nuxt) has been completely removed.

Stack

ComponentVersion
FrameworkFastify ^5.3.0
WebSocketws (native Server) ^8.18.x
Documentation@fastify/swagger (Swagger UI at /docs)
LanguageTypeScript (tsx runner)
DatabaseMongoDB + Mongoose ^9.7.3
RuntimeNode.js ^22

REST API

EndpointFeatureWhat it does
GET /api/devicesDevice listReturns all connected iPads with status and heartbeat
POST /api/devices/heartbeatHeartbeatRecords an iPad's heartbeat (every 30s), updates lastSeen
PUT /api/devices/:idRename deviceChanges the display name of an iPad
DELETE /api/devices/:idDelete deviceRemoves an iPad from the list
GET /api/linksStreaming link listReturns all channels/stream URLs
POST /api/linksCreate linkAdds a new stream URL with name and assigned slot
PUT /api/links/:idEdit linkUpdates name, URL, slot of a link
DELETE /api/links/:idDelete linkRemoves a link
PUT /api/links/:id/activateActivate link on slotAssigns a link to a slot (main/feed/alt), updates all devices in real time
PUT /api/links/:id/blockBlock/unblock linkBlocks a link (prevents activation), or unblocks it
POST /api/links/pingPing stream URLChecks whether a stream URL is reachable (HEAD request), shows response time or error
GET /api/eventsEvent listReturns all scheduled events
POST /api/eventsCreate eventCreates a new event with name, date, slot URL
PUT /api/events/:idEdit eventUpdates the details of an event
DELETE /api/events/:idDelete eventRemoves an event
POST /api/events/:id/pushPush eventSends an event to all devices (updates active links)
GET /api/licenseLicense statusShows current license: client, expiry, days remaining
DELETE /api/licenseRevoke licenseRemoves the license key from the server
GET /docsSwagger UIInteractive API documentation

WebSocket

ChannelFeatureWhat it does
/ws/regiaControl Room connectionBidirectional channel for the operator panel
/ws/device/:idiPad connectionEach iPad connects with its own ID
broadcastActiveStreamsSynchronized streamsSends current stream URLs to all devices
link:activateActivate linkAssigns a URL to a slot and propagates it to all devices
link:deactivateFree slotRemoves a link from the slot, frees the stream
link:blockBlock linkPrevents a link from being used
device:renameRename devicePropagates the new name to all clients
device:resetReset streamsSends a command to a single device to restart all streams
device:slot:controlRemote slot controlStops/starts/restarts a specific slot (main/feed/alt) on a single device
device:heartbeatHeartbeatKeeps the connection to the device alive
links:syncLink synchronizationPropagates the updated link list to all clients

Infrastructure

FeatureWhat it does
License HMACValidates the license key on every startup — without a valid key the server does not start
SSL/TLSOptional HTTPS with Let's Encrypt or self-signed certificate
CORSEnables cross-origin requests for Control Room UI and app
MongoDBPersistent database for devices, links, events
Swagger DocsInteractive API documentation at /docs
Auto-restart PM2Automatic restart every night at 3:00 AM to clear memory
Graceful shutdownConfigurable timeout for clean connection shutdown

Development

bash
npm run dev     # tsx watch → Fastify on :3002
npm run build   # TypeScript build → dist/
npm start       # Start the build

Future evolution

  • Microservices → Decomposition into independent services (auth, tablet, link, stream, metadata) after production

© 2026 Zerolatency — All Rights Reserved