A high-performance, zero-trust distributed framework in Rust. Orchestrates ephemeral WASI P2 components and native containers with unified identity (DPoP), JIT secrets (Vault), and multi-model persistence (SurrealDB). Built for high-density, memory-safe computing in FinTech and DefTech.
๐ Nexus
Next-Generation Distributed Framework for Ephemeral, High-Density Computing.
Nexus is a high-performance distributed backend framework designed for the transition from heavyweight containerization to granular, secure execution paradigms. It provides a unified Hybrid Runtime that orchestrates traditional OCI containers (Docker) alongside ultra-lightweight WebAssembly (WASI P2) components
๐ The Core Proposition
Nexus addresses "infrastructure fatigue" by offering a platform where security, networking, and persistence are handled by a hardened native gateway, while business logic resides in isolated, scale-to-zero sandboxes.
๐ Hybrid Execution Model
Nexus is not "WASM-only". It is a bridge for enterprise migration:
- WASM Layer: For high-density, ephemeral tasks with microsecond cold starts.
- Container Layer: For legacy services (Java, Python, Go) or heavy stateful workloads.
- Unified Ingress: A single Axum-based gateway manages routing, security, and telemetry for both layers
๐ Documentation
A deep-dive series of engineering articles exploring the internal design, philosophy, and technical decisions behind the NEXUS ecosystem.
- ๐ ๏ธ Building NEXUS (Part 1): Errors as Infrastructure โ An architectural
- ๐ Building NEXUS (Part 2): Observability as a Contract โ A deep dive into
๐ High-Level Architecture
Nexus synthesizes the best of the Rust ecosystem with frontier WASM standards.
graph TB
Client([Client]) -- DPoP / JWT --> Gateway[Axum API Gateway]
subgraph Runtime [Nexus Hybrid Runtime] direction LR subgraph WASM_Layer [High-Density WASM] Spin[Fermyon Spin / WASI P2] Logic[Stateless Business Logic] end
subgraph Legacy_Layer [Native Containers] Docker[Docker / OCI Services] Services[Java / Python / Go] end end
Gateway -- Wasm RPC --> WASM_Layer Gateway -- Proxy --> Legacy_Layer
subgraph Infrastructure [Hardened Core] DB[(SurrealDB)] Vault[(HashiCorp Vault)] OTel[OpenTelemetry Mesh] end
Runtime -.-> Infrastructure
๐ "Fortress-First" Security & Compliance
Nexus assumes a zero-trust environment. Security is baked into the architecture, not "bolted on" later.
- Identity Binding (RFC 9449 DPoP): Prevents token replay attacks. Every JWT must be accompanied by a cryptographic
- JIT Secret Injection: Secrets are never stored in ENV variables. The gateway fetches credentials from HashiCorp
- Capability-Based Isolation: WASM components operate in a formal sandbox with zero ambient authority โ no file or
- Row-Level Security (RLS): Built-in SurrealDB graph traversal enforces strict multi-tenant isolation at the data
๐ Developer Experience: The cargo x Engine
Nexus eliminates operational friction through an integrated Internal Developer Platform (IDP):
| Command | Action | |:---------------------|:-----------------------------------------------------------------| | cargo setup | Installs WASM toolchains and generates cryptographic keys. | | cargo x add <name> | Scaffolds a new WASI component or Docker service from templates. | | cargo dev up | Launches the backing stack (Vault, SurrealDB, Redis, OTel). | | cargo codegen | Automatically synchronizes WIT bindings and DB migrations. | | cargo serve | Starts the hybrid runtime with instant hot-reloading. |
๐ Performance & ROI
By moving logic from Docker to WASM, Nexus enables a fundamental shift in cloud economics:
- Density: Run 10,000+ components on a single server, compared to ~100 Docker containers.
- Latency: Cold starts in < 1ms, eliminating the "serverless tax."
- Footprint: Binary sizes reduced from 500MB+ to < 5MB.
- TCO: Infrastructure cost reduction of up to 80% for high-scale microservice deployments.
๐ Workspace Structure
nexus/
โโโ clients/ # Dioxus-based GUI and CLI clients
โโโ components/ # WASI P2 stateless business logic (The "WASM" way)
โโโ services/ # Native microservices & API Gateway (The "Native" way)
โโโ crates/ # Core SDKs: nx-http, nx-error, nx-database, etc.
โโโ tooling/ # The xtask engine and codegen templates
โโโ ops/ # Infrastructure-as-Code (Compose, Vault, OTel configs)
๐ Observability Mesh
Nexus integrates a full OpenTelemetry stack out-of-the-box. When you run cargo dev up, you get:
- Jaeger: Distributed tracing across the Gateway, WASM, and Docker layers.
- Loki: Centralized log aggregation for ephemeral components.
- Prometheus: Real-time metrics for system health and cold-start monitoring.
๐ Getting Started
git clone https://github.com/AnatoliiShliakhto/nexus.git
cd nexus
1. Install required WASM targets and auxiliary tools
cargo setup
2. Generate DB migrations and compile components to WASI P2
cargo codegen
cargo dist components
3. Compose up the infrastructure stack in Docker
cargo dev up
4. Bootstrap the database schema
cargo ops migrate up
5. Launch the local Spin development server
cargo serve
๐ License
Dual-licensed under MIT and the Apache 2.0.