How waeel1937/full-stack-go-sveltekit-sqlite-template works
This is a full-stack industrial IoT edge template: connectors or a demo producer publish sensor readings, the backend aggregates them locally and evaluates threshold rules, then persists results and serves the UI through REST and SSE. The frontend supports live dashboard data, alerts, and rule management; documented capabilities also include Keycloak authentication, Prometheus metrics, and selective cloud sync. Source excerpts establish startup wiring and selected calls; other relationships below are based on the README architecture, not unsampled implementation details.
Main entry points: bus.go Event Bus · api.js Frontend API Store · sqlite.go SQLite Store · http.go HTTP API
Components 22
Sensor Ingestion
- Modbus TCP
edge-app/internal/connector/modbus.go - OPC-UA
edge-app/internal/connector/opcua.go - Demo Producer
edge-app/cmd/edge-app/main.go
Edge Processing
- Event Bus
edge-app/internal/core/bus.go - Window Aggregator
edge-app/internal/aggregator/aggregator.go - Raw Capture
edge-app/internal/aggregator/raw_capture.go - Ring Buffer
edge-app/internal/storage/ringbuffer/buffer.go - Rule Engine
edge-app/internal/rules/rules.go - SQLite Store
edge-app/internal/storage/sqlite.go - Aggregate Persister
edge-app/internal/aggregator/persist.go
Backend Services
- Cloud Sync
edge-app/internal/sync/cloud.go - HTTP API
edge-app/internal/api/http.go - Prometheus Metrics
edge-app/internal/metrics/prometheus.go - gRPC Streaming
edge-app/internal/api
User Interface
- Frontend API Store
frontend/src/lib/stores/api.js - App Shell
frontend/src/routes/+layout.svelte - Dashboard
frontend/src/routes/+page.svelte - Alerts View
frontend/src/routes/alerts/+page.svelte - Rules View
frontend/src/routes/rules/+page.svelte
Other components
- Operator
- Cloud Endpoint
- Keycloak
config/keycloak/edge-realm.json
Connections 27
- Operator → App Shell: uses
README.md - Modbus TCP → Event Bus: publishes metrics
README.md - OPC-UA → Event Bus: publishes metrics
README.md - Demo Producer → Event Bus: publishes metrics
edge-app/cmd/edge-app/main.go - Event Bus → Window Aggregator: fans out metrics
README.md - Event Bus → Raw Capture: fans out metrics
README.md - Raw Capture → Ring Buffer: captures samples
- Window Aggregator → Event Bus: publishes aggregates
README.md - Event Bus → Aggregate Persister: delivers aggregates
README.md - Aggregate Persister → SQLite Store: writes aggregates
README.md - Event Bus → Rule Engine: delivers aggregates
README.md - Rule Engine → Event Bus: publishes alerts
edge-app/internal/rules/rules.go - Rule Engine → SQLite Store: loads and saves rules
edge-app/internal/rules/rules.go - SQLite Store → Cloud Sync: supplies aggregates
README.md - Cloud Sync → Cloud Endpoint: posts summaries
README.md - Event Bus → HTTP API: streams events
edge-app/internal/api/http.go - SQLite Store → HTTP API: serves aggregate queries
README.md - HTTP API → Keycloak: fetches signing keys
edge-app/internal/api/http.go - Frontend API Store → HTTP API: requests REST and SSE
README.md - Frontend API Store → Keycloak: authenticates users
README.md - App Shell → Frontend API Store: starts stream
frontend/src/routes/+layout.svelte - Dashboard → Frontend API Store: reads live data
README.md - Alerts View → Frontend API Store: reads alert state
README.md - Rules View → Frontend API Store: manages rules
frontend/src/routes/rules/+page.svelte - Operator → Rules View: configures thresholds
README.md - Operator → Alerts View: reviews alerts
README.md - Operator → Dashboard: views live metrics
README.md