Architecture Overview
How Subway is built — crates, layers, topology.
Layer architecture#
Agent Application
Subway API (AgentNode)← subway-core
P2P Networking← subway-p2p
libp2p + QUIC + Noise← transport + encryption
Workspace crates#
| Crate | Purpose |
|---|---|
subway-core | AgentNode — connect, send, RPC, pub/sub |
subway-p2p | Standalone libp2p networking layer |
subway-proto | Protobuf message definitions |
subway-bridge | REST + WebSocket bridge for non-Rust clients |
subway-cli | subway command-line tool |
subway-relay-server | Relay server implementation |
subway-relay | Relay binary and configuration |
All crates live in the subway monorepo — any Rust project can depend on subway-core directly.
Network topology#
- Agents register a name with the relay on startup
- Relay resolves names to PeerIDs
- Messages travel peer-to-peer when possible
- Relay provides circuit relay for NAT traversal
- Relay cannot read message contents