概要
Digital Public Infrastructure (DPI) for Agriculture
システム・インフラできること
- Resilient sensor monitoring (soil moisture, soil temperature, air temperature, humidity, rainfall)
- Pluggable storage backends — in-memory, SQLite, and ClickHouse
- Web dashboard for device and dispatcher management
- Mutual TLS between all components via a custom binary RPC protocol
計測したスター増加
- 24時間
- 0
- 7日間
- 0
- 15日間
- 0
- 1か月
- 履歴を収集中
期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。
README.md
オリジナルersha-os
Open-source Digital Public Infrastructure (DPI) for Smart Agriculture Monitoring
A platform that helps governments, cooperatives, and farmers monitor farms in real time. It connects low-power sensor devices in the field to a central backend through regional gateways, with a web dashboard for device management and monitoring.
Built to scale to nations.
Key Features
- Resilient sensor monitoring (soil moisture, soil temperature, air temperature, humidity, rainfall)
- Pluggable storage backends — in-memory, SQLite, and ClickHouse
- Web dashboard for device and dispatcher management
- Mutual TLS between all components via a custom binary RPC protocol
- H3 geospatial indexing for device and dispatcher locations
- Scalable: single farm → regional → national deployment
- Fully open-source and hardware-agnostic
Architecture
The platform has three tiers:
- Edge — Sensor devices running
ersha-edgeon bare-metal MCUs collect readings and send them as compact Postcard-encoded binary frames over TCP. - Dispatch — Regional gateways running
ersha-dispatchreceive sensor data, buffer it locally (SQLite), and batch-upload to the central backend over a custom RPC implementation inersha-rpcsecured via TLS. - Central —
ersha-primestores device/dispatcher registries and sensor readings, exposes an HTTP API and web dashboard for managing the device/dispatcher registry, stores device statuses and sensor readings in ClickHouse for further analysis.
ClickHouse is used for time-series analytics in production, with Grafana for visualization.
Workspace Overview
ersha-os
├── ersha-core # Shared domain types and logic
├── ersha-rpc # Binary RPC framing layer with TLS
├── ersha-edge # Embedded SDK for sensor devices (no_std)
├── ersha-dispatch # Ingestion gateway service
├── ersha-prime # Core backend & device registry
├── ersha-tls # TLS certificate generation & management
├── ersha-registry # Elm web dashboard (SPA)
└── ersha-dispatchers-harness # Integration test harness
Crates
ersha-core
Shared domain types used across all crates.
- Device, dispatcher, and sensor models with ULID identifiers
- Sensor metric types: soil moisture, soil/air temperature, humidity, rainfall
- Alert system with severity levels (Critical, Warning, Info) and typed alert categories
- H3 geospatial cell types for location indexing
- Batch upload request/response structures
See ersha-core/README.md for details.
ersha-rpc
Transport-agnostic binary RPC layer.
- Postcard serialization with length-delimited framing
- Client/server abstractions with request/response correlation via ULID message IDs
- TLS support through
ersha-tls(Rustls)
See ersha-rpc/README.md for details.
ersha-edge
Embedded SDK for sensor devices. #![no_std] compatible.
- Async-first design using the Embassy runtime
Sensortrait — implementread()andsampling_rate(), the framework handles the restTransporttrait — abstracts the network layer (WiFi TCP implemented)- Engine orchestrates sensor collection and upload
- Sensor macro for automatic Embassy task generation
See ersha-edge/README.md for details.
Initial implementation — we have mostly relied on mocking instead of software running on actual MCUs
ersha-dispatch
Regional ingestion gateway that sits between edge devices and the central backend.
- Edge receivers: TCP and a mock for testing
- Storage backends: in-memory and SQLite
- Buffers sensor readings and device status locally
- Batches and uploads to
ersha-primevia RPC over TLS - Generates alerts for critical battery levels and sensor failures
- HTTP health endpoint for monitoring
See ersha-dispatch/README.md for details.
ersha-prime
Central backend service.
- Registries: Device, Dispatcher, Reading, and DeviceStatus — each with in-memory, SQLite, and ClickHouse implementations
- HTTP API for device and dispatcher registration, listing, and management
- RPC server (port 9000, mTLS) — handles dispatcher hello, batch upload, alerts, status, and disconnection
- Serves the Elm registry UI as an embedded SPA
See ersha-prime/README.md for details.
ersha-tls
TLS certificate generation and management.
- Generates a local root CA
- Creates and signs server/client certificates
- Integrates with Rustls for mutual TLS across all services
See ersha-tls/README.md for details.
ersha-registry
Elm single-page application for device and dispatcher management.
- Dashboard with summary stats (total devices, active dispatchers, system health)
- Device and dispatcher list views
- Registration forms for devices (with sensor configuration) and dispatchers
- Detail modals for individual devices and dispatchers
- Compiled and embedded into the
ersha-primebinary
ersha-dispatchers-harness
Integration test and simulation harness.
- Spawns multiple dispatcher processes against a running
ersha-prime - Generates realistic sensor data and device status updates
- Uses H3 cells across Ethiopia for dispatcher locations
- Configurable reading/status intervals and device counts
See ersha-dispatchers-harness/README.md for details.
Quick Start
just docker-bootstrap
This generates TLS certificates, builds the Docker images, and starts the full stack:
| Service | Port | Description |
|---|---|---|
ersha-prime |
8080 (HTTP), 9000 (RPC) | Backend + web dashboard |
clickhouse |
8123, 9000 | Time-series storage |
ersha-harness |
— | Simulated dispatchers and devices |
grafana |
3000 | Visualization dashboards |
Open http://localhost:8080 for the registry dashboard.
Development
The project uses Nix for development environment management:
nix develop
This provides Rust (stable), Elm, Node.js, and all required tooling.
Roadmap
The following features are planned but not yet implemented:
- LoRaWAN transport — the
Transporttrait is designed for this, but only WiFi/TCP exists today - Alert delivery — SMS, Telegram, and WhatsApp notification channels (alerts are currently logged server-side)
- Hardware reference designs — reference implementations for specific sensor boards
License
Licensed under the terms of the MIT License. See LICENSE for details.
関連プロジェクトを探す
読み込み中…