← Writing

From device to system: communication, backend, and dashboard for an embedded AI product

2026-01-07 project · rust · nurse · product


🟠 In this final article, I connect the embedded AI device to the real world. I describe how inference results leave the MCU, travel through MQTT and HTTP, land in a Rust backend, and become visible through a web dashboard.

This is the layer where a TinyML prototype turns into an actual end-to-end product.


    From inference to communication: Wi-Fi, MQTT, and reliability

Once inference works reliably on-device, the next challenge is not accuracy — it’s communication.

The MCU operates in an unstable environment:

Because of that, the device communication layer is built around a few principles:

Why MQTT

MQTT is a natural fit for embedded AI devices:

The device publishes inference results as compact messages:

If Wi-Fi drops, the MCU buffers messages and reconnects automatically. Inference never blocks on network I/O — this separation is critical for real-time behavior.


    Backend architecture: Rust, Actix Web, and data ingestion

On the server side, the backend acts as the central nervous system of the product.

Its responsibilities:

Rust + Actix Web was a deliberate choice:

MQTT ingestion as a background task

The MQTT listener runs as a dedicated async task inside the backend process:

Because MQTT and HTTP are decoupled, ingestion continues even if no users are connected.

This pattern avoids the classic IoT anti-pattern of “HTTP from devices”.


    API layer and authorization model

The HTTP API exposes structured access to collected data.

Key design decisions:

In Actix Web this maps cleanly to scoped routes:

Middleware enforces authorization centrally, not per-handler — this keeps business logic clean and auditable.


    Backend as a deployment unit

The backend is built and deployed as a minimal container.

The Docker setup follows a multi-stage pattern:

This yields:

Docker Compose ties everything together:

At this point, the system can be deployed locally or on a single VPS without modification.


    Frontend dashboard: making data visible

Raw inference data is useless without interpretation.

The dashboard provides:

The frontend is a React SPA served as static assets via Nginx.

Routing is handled client-side:

Because the backend serves the frontend assets directly, the system behaves as a single cohesive application from the user’s perspective.


    System boundaries and responsibilities

At this stage, the architecture has clear boundaries:

Each layer can evolve independently without breaking the others — this is what turns a demo into a maintainable product.


    Closing thoughts

This project deliberately spans:

The key insight is simple but often missed:

An embedded AI model is only valuable when it is part of a system.

By treating communication, backend, and UI as first-class engineering problems, the device stops being “just a model on a chip” and becomes a real, deployable AI product.

This concludes the end-to-end pipeline — from camera frames and INT8 tensors to dashboards and users.