Architecture Guide
Understanding the internal architecture of Nexus OS.
Module Dependency Graph
main.rs
├── cli.rs (argument parsing)
├── config.rs (YAML loading)
├── store.rs (SQLite persistence)
├── commands.rs (agent lifecycle)
│ └── store.rs
├── axis.rs (trust verification)
│ └── store.rs
├── broker.rs (routing engine)
│ ├── store.rs
│ └── config.rs
├── edge.rs (edge deployment)
│ ├── store.rs
│ ├── config.rs
│ └── cloudflare.rs
└── dashboard.rs (web UI)
└── store.rs
Data Flow
- CLI parses user input into a
Cmdenum - Main dispatches to the appropriate module
- Module opens the
Store(SQLite connection) - Store reads/writes data and returns results
- Module formats output for the terminal
Store Design
The Store uses SQLite with these design principles:
- Single file — All data in one
nexus.dbfile - Migrations — Schema created on first open
- No ORM — Direct SQL with rusqlite
- Transactions — Used for multi-step operations
Adding a New Module
- Create
src/new_module.rs - Add tables to
Store::open()migration - Add data types and methods to
store.rs - Add CLI subcommand to
cli.rs - Add dispatch arm to
main.rs - Add dashboard page to
dashboard.rs