Zano - A Node.js-like Runtime in Rust
A high-performance, Node.js-compatible runtime built in Rust with JavaScript-like syntax
Installation • Quick Start • Examples • Built-in Modules • Documentation
Why Zano?
Zano brings the familiar Node.js development experience to the Rust ecosystem, offering:
- Blazing Fast: Built on Tokio's async runtime
- Memory Safe: All the safety guarantees of Rust
- Familiar Syntax: Write JavaScript-like code that just works
- Package Management: Full package.json support
- Built-in Modules: File system, HTTP, and more out of the box
Installation
Install from Crates.io
Build from Source
Quick Start
Create a new Zano project:
# Initialize a new project
# Create your first script
# Run it
Basic Syntax
Zano supports JavaScript-like syntax with powerful features:
// Variables and functions
let name = "World"
const greeting = "Hello"
console.log // Output: Hello, World!
// Arrays and Objects
let numbers =
let person =
console.log
console.log
// Control Flow
if else
// Loops
let count = 0
while
Built-in Modules
Console Module
console.log
console.error
console.warn
File System Module
const fs = require
// Write and read files
try catch
HTTP Module
const http = require
// Make HTTP requests
try catch
// Create HTTP server (basic implementation)
let server = http.
console.log
Path Module
const path = require
let fullPath = path.
console.log
let directory = path.
let filename = path.
console.log // /home/user
console.log // file.txt
Error Handling
Robust error handling with try/catch:
try catch
console.log
Package Management
Zano includes a built-in package manager similar to npm:
Initialize a Project
Creates a package.json:
Manage Dependencies
# Install a package
# Install all dependencies
# Run scripts
Complete Examples
Example 1: Simple Web API Simulation
// api-server.zn
console.log
let user1 =
let user2 =
// Simulate API calls
let response1 =
console.log
console.log
let response2 =
console.log
console.log
console.log
Example 2: File Processing Pipeline
// file-processor.zn
const fs = require
console.log
try catch
Example 3: Data Analysis Script
// analytics.zn
console.log
let jan =
let feb =
let mar =
let totalProfit = 0
let bestProfit = 0
let bestMonth = ""
console.log
// Process January
let janAnalysis =
let janProfit =
totalProfit = totalProfit + janProfit
if
// Process February
let febAnalysis =
let febProfit =
totalProfit = totalProfit + febProfit
if
// Process March
let marAnalysis =
let marProfit =
totalProfit = totalProfit + marProfit
if
console.log
console.log
console.log
CLI Commands
# Run Zano scripts
# Evaluate code directly
# Interactive REPL
# Package management
# Get help
Language Features
| Feature | Status | Example |
|---|---|---|
| Variables | Available | let x = 5; const y = "hello" |
| Functions | Available | function add(a, b) { return a + b } |
| Arrays | Available | let arr = [1, 2, 3]; arr[0] |
| Objects | Available | let obj = {name: "test"}; obj.name |
| Control Flow | Available | if/else, while loops |
| Error Handling | Available | try/catch/throw |
| Modules | Available | const fs = require('fs') |
| Async/Await | Planned | Coming soon |
| Classes | Planned | Coming soon |
| Destructuring | Planned | Coming soon |
Architecture
Zano is built on these core technologies:
- Parser: Custom JavaScript-compatible lexer and parser
- Runtime: Tokio-based async execution engine
- Memory: Rust's ownership system ensures memory safety
- Modules: Pluggable module system with built-in and custom modules
- Package Manager: Cargo-inspired dependency management
Performance
Zano leverages Rust's performance characteristics:
- Zero-cost abstractions: No runtime overhead
- Memory efficient: No garbage collector needed
- Concurrent: Built on Tokio for handling thousands of concurrent operations
- Fast startup: Compiled binary starts instantly
Development
Building from Source
Running Tests
Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes and add tests
- Run
cargo testandcargo fmt - Submit a pull request
Comparison with Node.js
| Aspect | Zano | Node.js |
|---|---|---|
| Runtime | Tokio (Rust) | libuv (C++) |
| Memory Safety | Compile-time | Runtime errors possible |
| Performance | Very High | High |
| Startup Time | Instant | ~50ms |
| Memory Usage | Minimal | Higher baseline |
| Ecosystem | Growing | Massive |
| Syntax | JS-compatible | JavaScript |
| Error Messages | Precise | Sometimes cryptic |
Roadmap
Version 1.1.0
- Full async/await support
- HTTP server implementation
- Module bundling system
- Package registry integration
Version 1.2.0
- Class syntax support
- Destructuring assignment
- Template literals
- JSON parsing utilities
Version 2.0.0
- TypeScript-like static typing
- WebAssembly module support
- Built-in testing framework
- Debug tooling
License
This project is licensed under the MIT License - see the LICENSE file for details.
Community
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Contributing: See CONTRIBUTING.md
Star History
If you find Zano useful, please consider giving it a star on GitHub!
Built with love in Rust