sfsEdgeStore

Architecture

System architecture overview of sfsEdgeStore.

Lightweight Edge Architecture

┌─────────────────────────────────────────────────────────────┐
│                      Edge Node (Resource-Constrained)       │
│                                                             │
│  ┌───────────────────────────────────────────────────────┐ │
│  │              EdgeX Foundry                             │ │
│  │  (Data Collection, Device Management)                  │ │
│  └────────────────────┬──────────────────────────────────┘ │
│                       │ MQTT                              │
│                       ▼                                   │
│  ┌───────────────────────────────────────────────────────┐ │
│  │         sfsEdgeStore (Lightweight Adapter)             │ │
│  │  ┌──────────────┐  ┌──────────────┐  ┌──────────┐  │ │
│  │  │  MQTT Client  │→ │  Data Queue  │→ │  sfsDb   │  │ │
│  │  └──────────────┘  └──────────────┘  └──────────┘  │ │
│  │  ┌──────────────┐  ┌──────────────┐                  │ │
│  │  │  HTTP Server  │  │  Monitoring  │                  │ │
│  │  └──────────────┘  └──────────────┘                  │ │
│  └───────────────────────────────────────────────────────┘ │
│                       │ HTTP API                         │
└───────────────────────┼─────────────────────────────────────┘
                        ▼
                  External Query/Monitoring

Core Components

1. MQTT Client (core/mqtt/)

Subscribes to EdgeX Foundry event topics and receives IoT sensor data.

2. Data Queue (queue/)

Reliable message buffering between MQTT ingestion and database storage.

3. Database (core/database/)

Efficient data storage using sfsDb (LevelDB wrapper).

4. HTTP Server (server/)

RESTful API for data querying and system management.

5. Monitoring (monitor/)

System metrics collection and alerting.

6. Alert System (alert/)

Threshold-based alerting with multiple notification channels.

7. Analyzer (analyzer/)

Data analysis engine for anomaly detection and trend analysis.

8. Resource Monitor (resource/)

System resource tracking and protection.

9. Data Retention (retention/)

Automatic cleanup of expired data.

10. Data Sync (cloudsync/sync/) (Enterprise)

Cloud synchronization for distributed deployments.

Design Principles

  1. Small and Beautiful - Does one thing, does it perfectly
  2. Edge First - All features prioritize edge scenarios
  3. Data Sovereignty - Data stays local. No cloud dependency, no cross-border transfer.
  4. Zero Dependencies - Only depends on sfsDb, no heavy components
  5. High Availability - Power-failure recovery, data retry, local storage

Why Local-First Matters

Unlike cloud-based IoT solutions, sfsEdgeStore stores all data on the edge device:

Technology Stack

Component Technology
Language Go 1.21+
Database sfsDb (LevelDB wrapper)
Message Queue MQTT (Paho)
Web Framework Go net/http
Frontend Vanilla JS + Bootstrap + ECharts