Skip to content

Mesh Network API

TimeNow supports a peer-to-peer mesh network for distributed solar time synchronization — useful in IoT, offline-capable, and resilient deployments.

GET /mesh/peers

List all known mesh peers.

Example

curl http://localhost:8090/mesh/peers

Response

{
  "peers": [
    {
      "id": "node-a3f2",
      "address": "192.168.1.10:8090",
      "last_seen_utc": "2026-04-14T11:59:50Z",
      "status": "online",
      "version": "1.0.0"
    }
  ],
  "count": 1
}

GET /mesh/sync

Trigger a manual sync with all known peers. Each peer exchanges its current solar time data and known peer list.

Example

curl http://localhost:8090/mesh/sync

Response

{
  "synced_peers": 3,
  "failed_peers": 0,
  "duration_ms": 142
}

GET /mesh/status

Get the current mesh network status for this node.

Example

curl http://localhost:8090/mesh/status

Response

{
  "node_id": "node-a3f2",
  "mode": "active",
  "peers_online": 3,
  "peers_total": 4,
  "last_sync_utc": "2026-04-14T11:59:50Z",
  "uptime_s": 86400
}

IoT Use Case

The mesh API is designed for IoT deployments where a cluster of TimeNow nodes needs to stay synchronized without central infrastructure.

# Start in IoT profile
podman-compose --profile iot up --build

In IoT mode: - Only the backend runs (no frontend) - Mesh sync runs automatically every 60 seconds - Minimal memory footprint (~128 MB)