Nexus is a next-generation application runtime that combines:
- π₯ Native Performance β Compiled Zig, no JIT/GC overhead
- π WebAssembly-First β Run WASM modules natively alongside Zig code
- π Secure by Default β Capability-based security model
- π Developer Experience β Ergonomic APIs inspired by Node.js
- π― Polyglot Execution β Run code from any language via WASM
Think Node.js, but written in Zig, 10x faster, and with first-class WASM support.
| Feature | Node.js | Deno | Bun | Nexus |
|---|---|---|---|---|
| Language | JavaScript | JavaScript | JavaScript | Zig |
| Performance | JIT (~50k req/s) | JIT (~80k req/s) | JIT (~120k req/s) | Native AOT (500k+ req/s) |
| Memory | GC (~50MB idle) | GC (~60MB idle) | GC (~40MB idle) | Manual (~5MB idle) |
| Binary Size | ~50MB | ~100MB | ~50MB | ~5MB |
| Cold Start | ~50ms | ~30ms | ~10ms | <5ms |
| WASM Support | Addon | First-class | Good | Native first-class |
| Systems Access | Limited | Sandboxed | Full | Full native |
| Package Manager | npm | Built-in | Built-in | ZIM integration |
# Clone the repository
git clone https://github.com/ghostkellz/nexus.git
cd nexus
# Build from source
zig build
# Run Nexus
./zig-out/bin/nexus --versionhello.zig:
const nexus = @import("nexus");
pub fn main() !void {
const server = try nexus.http.Server.init(.{
.port = 3000,
});
defer server.deinit();
try server.route("GET", "/", handleRequest);
nexus.console.log("Server running on http://localhost:3000");
try server.listen();
}
fn handleRequest(req: *nexus.http.Request, res: *nexus.http.Response) !void {
try res.json(.{
.message = "Hello from Nexus!",
.performance = "10x better than Node.js",
});
}Run it:
nexus run hello.zigBenchmark it:
# Nexus
wrk -t12 -c400 -d30s http://localhost:3000
# Expected: 500k+ req/sec
# Node.js equivalent
node hello.js
wrk -t12 -c400 -d30s http://localhost:3000
# Typical: 50k req/sec// Nexus: Native compiled Zig
const data = try nexus.fs.readFile("large.json"); // ~5000 MB/s
// Node.js: V8 JIT
const data = await fs.readFile("large.json"); // ~500 MB/sconst nexus = @import("nexus");
pub fn main() !void {
// Load WASM module from any language (Rust, Go, C++, etc.)
const image_processor = try nexus.wasm.load("./image-resize.wasm");
defer image_processor.deinit();
// Call WASM function with zero-copy where possible
const result = try image_processor.call("resize", .{
.width = 800,
.height = 600,
.quality = 85,
});
nexus.console.log("Processed image: {}", .{result});
}// Import Zig native code
const zig_lib = @import("./native-lib.zig");
// Import Rust compiled to WASM
const rust_crypto = @import("./crypto.wasm");
// Import Go compiled to WASM
const go_parser = @import("./parser.wasm");
pub fn main() !void {
const data = zig_lib.fetchData();
const encrypted = try rust_crypto.call("encrypt", .{data});
const parsed = try go_parser.call("parse", .{encrypted});
// Best of all languages in one runtime!
}# Explicit permissions required
nexus run app.zig --allow-read=/data --allow-net=api.example.com
# WASM modules are sandboxed by default
nexus run app.zig --allow-wasm=./untrusted.wasm# Compile to WASM for Cloudflare Workers
nexus build --target=wasm32-wasi
# Deploy to any edge platform
# - Cloudflare Workers
# - Fastly Compute@Edge
# - Deno Deploy
# - AWS LambdaNexus integrates seamlessly with ZIM (Zig Infrastructure Manager):
# Initialize project
nexus init my-app
cd my-app
# Add dependencies
nexus add http-server --git gh/nexus/[email protected]
nexus add db-driver --registry nexus.dev --version ^2.3.0
# Add WASM dependency
nexus add image-resize --wasm https://cdn.example.com/image-resize.wasm
# Install dependencies
nexus install
# Run project
nexus run src/main.zignexus.toml:
[project]
name = "my-app"
version = "1.0.0"
runtime = "[email protected]"
[dependencies]
http-server = { git = "gh/nexus/http-server", tag = "v1.0.0" }
db-driver = { registry = "nexus.dev", version = "^2.3.0" }
[wasm-dependencies]
image-resize = { url = "https://cdn.example.com/image-resize.wasm", hash = "sha256:..." }Nexus is built on three core pillars:
- Single-threaded async I/O
- Built on epoll/kqueue/IOCP
- <100ΞΌs latency (p99)
- Optional worker threads
- Native Zig modules β
.zigfiles compiled to native code - WASM modules β
.wasmfiles executed in sandbox - Dynamic libraries β
.so/.dylib/.dllvia FFI - Content-addressed caching
nexus:runtimeβ Event loop, process controlnexus:fsβ File system operationsnexus:netβ TCP/UDP/HTTP/WebSocketnexus:streamβ Readable/Writable streamsnexus:cryptoβ Hashing, encryption, RNGnexus:wasmβ WASM module loadingnexus:consoleβ Formatted output
See ARCHITECTURE.md for detailed design.
// High-performance HTTP/2 server
const server = try nexus.http.Server.init(.{
.port = 443,
.tls = .{ .cert = "cert.pem", .key = "key.pem" },
.http2 = true,
});// Load balance across WASM microservices
const auth_service = try nexus.wasm.load("./auth.wasm");
const payment_service = try nexus.wasm.load("./payment.wasm");# Compile to WASM and deploy
nexus build --target=wasm32-wasi
wrangler deploy ./dist/worker.wasm// Fast CLI tools with native performance
pub fn main() !void {
const args = try nexus.process.args();
// ... blazingly fast CLI logic
}# Cross-compile for ARM
nexus build --target=aarch64-linux-gnu
scp ./dist/app pi@raspberrypi:~/HTTP Server (req/sec):
Nexus: ββββββββββββββββββββ 500,000
Bun: ββββββββ 120,000
Node.js: ββββ 50,000
Cold Start (ms):
Nexus: ββ 5ms
Bun: ββββ 10ms
Deno: ββββββββ 30ms
Node.js: ββββββββββ 50ms
Memory Usage (MB):
Nexus: ββ 5MB
Bun: ββββββββ 40MB
Node.js: ββββββββββ 50MB
Deno: ββββββββββββ 60MB
- Project scaffold
- Event loop (epoll/kqueue/IOCP)
- Module loader (Zig only)
- Basic stdlib (fs, net, timer)
- HTTP/1.1 server
- CLI tool
- ZIM integration
- WASM runtime (Wasmer/Wasmtime)
- WASM module loading
- WASI support
- Host function bindings
- Security policies
- HTTP/2, HTTP/3
- WebSocket
- Streams API
- Worker threads
- Performance tuning
- Production hardening
- Package registry
- Web framework
- Database drivers
- Testing framework
- VSCode extension
- Full documentation
We welcome contributions! See CONTRIBUTING.md for guidelines.
Areas we need help:
- Event loop implementation
- WASM runtime integration
- Standard library modules
- Documentation
- Benchmarking
- Package ecosystem
- Specification β Technical specification
- Architecture β System architecture
- API Reference β API documentation
- Examples β Example projects
- Zig Team β For creating an amazing language
- Ghost Stack β For the foundational libraries
- ZIM β For package management infrastructure
- Node.js β For API design inspiration
- Cloudflare Workers β For edge runtime inspiration
- WASI β For WebAssembly standards
MIT License - see LICENSE for details.
Built with β‘ by the Ghost Stack Team
Website β’ Documentation β’ Discord β’ Twitter