by AutomataNexus | 2026-02-28 18:40:23+00:00
Hey HN, I'm Andrew. I built Aegis-DB — a database that handles SQL, key-value, document, time series, graph, and event streaming in a single Rust binary. It's been running in production on 50+ Raspberry Pi edge controllers across commercial buildings for months.

*The real story:* I built an entire building automation ecosystem from scratch. NexusBMS is the central platform (won an InfluxDB hackathon with it — runs InfluxDB 3.0 OSS alongside Aegis-DB). 16+ facilities including Taylor University, Element Labs, Byrna Ammunition, St. Jude Catholic School, Heritage Point Retirement Facilities (two cities), and more. Over 120 pieces of equipment — air handlers, boilers, cooling towers, pumps, DOAS units, natatorium pool units, exhaust fans, greenhouses.

The edge controllers are 50+ Raspberry Pi 4/5s running my custom NexusEdge software — Rust hardware daemons for I2C, BACnet, and Modbus communications, direct HVAC equipment control via analog outputs, 24V triacs, 0-10V inputs, 10K/1K thermistor inputs, and dry contact inputs. Custom control logic per equipment type. Pi 5s have Hailo NPU chips running larger ML models for predictive maintenance, Pi 4s run smaller AxonML Rust inference models (my own ML framework — also open source).

Each Pi runs Aegis-DB locally for sensor data collection, time series storage, equipment state, and real-time alert streaming. Those edge instances replicate to the central Aegis-DB server using CRDTs for conflict-free synchronization. OTA rolling updates push new versions across the fleet without downtime.

The edge deployment is what drove the design, but Aegis-DB isn't just for Pis. It's the primary database for my PWAs, mobile apps, and server-side services too. The central NexusBMS server runs it. My laptop runs it for development. It's a general-purpose multi-paradigm database that happens to also scale down to a Raspberry Pi — which is a harder constraint to satisfy than scaling up.

*What it actually is:*

- Full SQL engine with hand-written parser, cost-based planner, B-tree/hash indexes, MVCC, WAL
- KV store (12.3M reads/sec engine-level)
- Document store with JSON path queries and collection indexes
- Time series with Gorilla compression (Facebook's algorithm)
- Graph engine with adjacency lists, label indexes, traversal
- Pub/sub streaming with CDC (before/after images)
- Raft consensus + CRDTs (GCounter, PNCounter, ORSet, LWWRegister, LWWMap) for clustering
- OTA rolling updates with automatic rollback
- Multi-database isolation — each application gets its own namespace

*What makes it different from SurrealDB / other multi-model databases:*

- *Compliance engine.* Built-in GDPR, HIPAA, CCPA, SOC 2, FERPA support. Not checkboxes — actual API endpoints for data subject requests, consent management, breach notification. GDPR Article 17 right to erasure issues cryptographic deletion certificates. HIPAA PHI column-level data classification with query limits.
- *Edge-first design.* Runs on a Raspberry Pi at ~50 MB RSS. CRDTs enable conflict-free edge-to-central replication. OTA updates across a fleet of nodes.
- *Security from day one.* TLS (rustls), Argon2id password hashing, RBAC with 25+ permissions, OAuth2/OIDC, LDAP/AD, MFA (TOTP), HashiCorp Vault integration, rate limiting, cryptographic audit log verification.

*Performance (engine-level, single node):*

- SQL inserts: 223K rows/sec
- KV reads: 12.3M ops/sec
- KV writes: 3.97M ops/sec
- Fund transfers: 758K TPS (7x SpacetimeDB at zero contention, 24x at high contention)

*Honest limitations:*

- SQL doesn't match Postgres — no CTEs yet, limited window functions, no stored procedures
- Graph queries are traversal-based, not a full Cypher/SPARQL implementation
- The document query language is simpler than MongoDB's

*License:* BSL 1.1 (free for everything except reselling as a hosted DBaaS). Converts to Apache 2.0 in 2030.

13 Rust crates, ~60K LOC, 634 tests. Happy to answer questions about the edge deployment architecture, the CRDT replication, compliance features, or anything else.