Skip to content

Karanchhunchha/DeviceOS

Repository files navigation

DeviceOS

An IoT Runtime, Cloud Platform, Simulator, and Companion App
Build, test, and manage connected devices β€” without hardware dependencies.

Version License Go Next.js C++ Status


πŸ“˜ Master PRD Β β€’Β  πŸ— Architecture Β β€’Β  πŸ“ Roadmap


Status: Active Development (Alpha)
DeviceOS is an experimental IoT platform under active development. Core runtime, simulator, cloud backend, and dashboard are functional. Flutter companion app and real hardware support are in progress.


πŸŽ‰ End-to-End Milestone Reached! (v0.2.0-beta)
The core infrastructure of DeviceOS is officially ALIVE! We have successfully engineered and verified the complete architecture: BLE Provisioning β†’ Go Cloud Backend β†’ WebSocket Streaming β†’ Live Flutter Digital Twin. The Flutter App can mock ESP32 BLE provisioning to another phone, push telemetry via a Python edge simulator, and instantly render Live Digital Twin sparkline graphs.

Project Status (Against PRD)

Overall Completion: ~55-60%

Phase PRD Scope Status %
Phase 1: Foundation HAL interfaces, BLE GATT provisioning, offline cache βœ… HAL done, βœ… Offline cache done, ⚠️ BLE real hardware pending (mock only) ~80%
Phase 2: Cloud Sync Registry + Shadow API, state sync deltas, CLI commands βœ… Registry/Shadow API done, βœ… State sync done, βœ… CLI commands implemented ~85%
Phase 3: Rollouts & Management Dual-partition OTA on ESP32, Next.js console, rules engine ⚠️ OTA mock flow complete, βœ… Dashboard/console exists, 🚧 Rules engine local mock implemented ~50%
Phase 4: Swarm & Matter Matter/Thread, P2P mesh, edge AI warnings ❌ 0% β€” Not started 0%

What is DeviceOS?

DeviceOS is a production-grade, hardware-independent IoT platform. It allows developers to design, simulate, provision, monitor, and manage connected devices before purchasing any physical hardware.

The platform is built around a core architectural principle:

Hardware is just another transport implementation.

Everything from the provisioning flow, device shadow, telemetry pipeline, and OTA engine runs identically whether backed by a software simulator today or an ESP32 tomorrow.


Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  Flutter App                    β”‚  (Companion)
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                       β”‚ BLE GATT / HTTP (simulated)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚            ProvisioningTransport API            β”‚  (Abstraction Layer)
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                       β”‚
         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
         β”‚                           β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Simulator      β”‚       β”‚  ESP32 / Real HW     β”‚
β”‚  (HTTP local)   β”‚       β”‚  (BLE GATT)          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                           β”‚
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                       β”‚ Wi-Fi / MQTT
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Go Cloud Platform                  β”‚
β”‚  Device Registry Β· Shadow API Β· WebSocket Hub   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                       β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚             Next.js Dashboard                   β”‚
β”‚  Fleet View Β· Provisioning Β· Live Telemetry     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Components

Component Technology Status
C++ Runtime C++17, CMake βœ… Complete
Hardware Abstraction Layer C++ Interfaces βœ… Complete
Device Simulator Go βœ… Complete
Cloud Platform Go, SQLite βœ… Complete
Dashboard Next.js 15, React βœ… Complete
Provisioning Flow (E2E) HTTP β†’ State Machine βœ… Complete
Device Shadow API REST βœ… Complete
OTA Engine (Core) C++ βœ… Complete
Automated Test Suite Go test, Node.js βœ… 18/18 passing
Flutter Companion App Flutter 3 🚧 In Progress
CI/CD Pipeline GitHub Actions πŸ”œ Planned
Digital Twin β€” πŸ”œ Planned

Quick Start

Prerequisites

  • Go 1.22+
  • Node.js 20+
  • CMake 3.20+ (for C++ runtime)

1. Start the Cloud

go run ./cloud/cmd/server
# β†’ Listening on :8080

2. Start the Dashboard

cd dashboard
npm install
npm run dev
# β†’ http://localhost:3000

3. Run the Simulator

go run ./cli/cmd/deviceos simulate --devices 3
# β†’ sim_dev_0001 advertising on port 9001
# β†’ sim_dev_0002 advertising on port 9002
# β†’ sim_dev_0003 advertising on port 9003

4. Provision a Device

Open http://localhost:3000 β†’ BLE Provisioning β†’ Enter port 9001 and credentials β†’ Click Provision Device.

Watch the state machine execute:

BLE_ADVERTISING β†’ PROVISIONING β†’ [BLE OFF] β†’ WIFI_CONNECTING
 β†’ CLOUD_CONNECTING β†’ SHADOW_SYNC β†’ RUNNING

Provisioning State Machine

UNPROVISIONED
     β”‚
BLE_ADVERTISING          ← HTTP server starts on port 900X (simulates BLE GATT)
     β”‚
PROVISIONING             ← Waiting for Wi-Fi credentials from dashboard/app
     β”‚
[StopAdvertising]        ← BLE intentionally shut down by FSM (not a crash)
     β”‚
WIFI_CONNECTING          ← Simulates Wi-Fi join delay
     β”‚
CLOUD_CONNECTING         ← Registers device with cloud registry
     β”‚
SHADOW_SYNC              ← Pulls initial desired state
     β”‚
RUNNING                  ← Telemetry loop starts, publishes every 3-6s

Automated QA

Run the public end-to-end test suite:

# With all 3 services running:
node qa_test.js

Results: 18/18 tests passing

βœ… Cloud :8080 reachable
βœ… Dashboard :3000 serving
βœ… Simulator ports 9001/9002/9003 listening
βœ… CORS preflight returns correct headers
βœ… Provision device β†’ 200 OK
βœ… Cloud shadow created after provisioning
βœ… All 3 devices registered in cloud
βœ… Wrong port β†’ connection refused (expected)
βœ… Invalid JSON β†’ 400 (expected)
βœ… Non-existent device β†’ 404 (expected)
βœ… Live telemetry: temperature changing between polls

πŸ”’ Internal QA Pipeline

DeviceOS has a private, multi-layer automated QA workflow running internally. This pipeline orchestrates:

  • Layer 1 β€” Unit Tests: Go, Dart, and C++ unit tests run in isolation.
  • Layer 2 β€” Integration Tests: Full stack spun up automatically; provisioning, shadow sync, and telemetry flows are tested end-to-end.
  • Layer 3 β€” Regression Suite: BLE mock handshake, WebSocket live-stream, and device shadow delta verification run after every change.
  • Layer 4 β€” Edge Simulation: A scripted Python agent simulates real ESP32 behavior and validates cloud responses.

The internal pipeline tooling and CI configuration are not open-sourced at this time. Contributors and collaborators may request access privately.


Failure Resilience

The simulator models realistic failure conditions:

Failure Behavior
Wi-Fi disconnect Auto-reconnects via CLOUD_CONNECTING
Packet loss Telemetry dropped, loop continues
Power cycle Full reset to UNPROVISIONED
Cloud 409 (re-register) Idempotent β€” INSERT OR IGNORE
Advertising timeout Restart advertising cycle

Repository Structure

DeviceOS/
β”œβ”€β”€ cloud/              # Go cloud platform (API, shadow, registry)
β”œβ”€β”€ cli/                # Go CLI tool + simulator
β”‚   └── simulator/      # State machine + BLE transport abstraction
β”œβ”€β”€ dashboard/          # Next.js dashboard
β”œβ”€β”€ runtime/            # C++ device runtime + HAL
β”œβ”€β”€ sdk/                # C++ developer SDK
β”œβ”€β”€ docs/               # Architecture Decision Records (ADRs)
└── tests/              # Integration tests

Roadmap

  • v0.1.0-alpha β€” Simulation Platform MVP
  • v0.2.0-beta β€” Flutter Companion App (BLE Provisioning + Live Digital Twin) πŸŽ‰
  • v0.3.0 β€” Offline Rules Engine + Enterprise Dashboard
  • v0.4.0 β€” Fleet Management + OTA Deployment Engine
  • v1.0.0 β€” Real ESP32 Hardware Integration

License

MIT Β© 2026 Karan Chhunchha

About

No description, website, or topics provided.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors