This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Simple IoT is a Go-based IoT platform with an Elm frontend that enables distributed sensor data collection, telemetry, configuration, and device management. The system runs the same application in both cloud and edge instances, automatically synchronizing data between them using NATS messaging.
# Source environment setup (required for all operations)
source envsetup.sh
# Initial setup - installs frontend deps and configures Elm
siot_setup
# Install frontend dependencies only
siot_install_frontend_deps# Build everything (frontend + backend)
siot_build
# Build frontend only (Elm SPA)
siot_build_frontend
# Build backend only (Go binary)
siot_build_backend
# Cross-compile for ARM
siot_build_arm
siot_build_arm64# Start development mode with hot reloading (both frontend and backend)
siot_watch
# Run the application locally
siot_run [arguments]
# Run complete test suite (frontend + backend + linting)
siot_test
# Test individual components
siot_test_frontend
go test -race ./...# Backend linting (uses golangci-lint with revive and goimports)
golangci-lint run
# Frontend linting and review
cd frontend && npx elm-review
cd frontend && npx elm-test- Nodes: Core data structures containing arrays of Points
- Points: Individual data values with timestamps and metadata
- Graph Structure: Data organized as a DAG (directed acyclic graph)
- Clients: Independent components that implement specific functionality
- NATS Messaging: All data flows through embedded NATS message bus
cmd/siot/- Main application entry pointserver/- Server core functionality and HTTP APIclient/- Client implementations (most functionality lives here)api/- HTTP API handlers and routingdata/- Core data structures (Node, Point, etc.)store/- SQLite storage layerfrontend/- Elm-based web UImodbus/- Modbus protocol implementationnetwork/- Network management utilities
Most functionality is implemented as clients that:
- Subscribe to relevant node changes via NATS
- Process data and implement business logic
- Publish point updates back to the system
- Are managed by the ClientManager system
Common client types: SerialDev, CanBus, Rule, Db, SignalGenerator, Sync, Metrics, Modbus, OneWire, Shelly, Particle, etc.
- Elm SPA: Single-page application using elm-spa framework
- Components: Node-specific UI components in
Components/directory - API: Communication with backend via HTTP and WebSocket
- Build: Uses elm-watch for hot reloading during development
- Setup:
source envsetup.sh && siot_setup - Development:
siot_watch(starts hot reloading for both frontend and backend) - Testing:
siot_testbefore submitting changes - Code Quality: All code must pass
golangci-lint runandelm-review
- Always source
envsetup.shbefore running build commands - Frontend build generates compressed
elm.js.gzfile - SQLite database stores all application data
- System supports TLS with certificates via
siot_mkcertandsiot_run_tls - Protocol buffers used for efficient data serialization (
siot_protobuf) - Cross-platform support (Linux, macOS, Windows with ARM variants)
- Embedded systems focus - minimal dependencies and binary size optimization