A high-performance JavaScript runtime built with Rust, powered by the V8 engine.
- π High Performance: Leveraging Rust's safety and speed with V8's power
- π§ Modern JavaScript: Support for ES2022+ features
- π οΈ Built-in APIs: Console, Timers, Fetch, File System, HTTP Server
- π» REPL Mode: Interactive JavaScript development environment
- π¦ Module System: ES Modules and CommonJS support (in development)
- β‘ Async/Await: Full async/await support with proper event loop
- π― TypeScript: Built-in TypeScript support (.ts, .tsx files)
- π³ Docker Ready: Single binary deployment, 15MB containers
# One-line installer (macOS/Linux)
curl -fsSL https://raw.githubusercontent.com/kirencore/kiren/main/install.sh | bash
# Homebrew (macOS/Linux) - Coming Soon
brew install kiren
# Cargo (Rust users)
cargo install --git https://github.com/kirencore/kiren
# NPM (Node.js users) - Coming Soon
npm install -g kiren-runtime
# Docker
docker run -it ghcr.io/kirencore/kiren --repl
Download pre-built binaries from GitHub Releases
Available Platforms:
- β
Linux (x64, ARM64) -
kiren-linux-x64.tar.gz
,kiren-linux-arm64.tar.gz
- β
macOS (Intel, Apple Silicon) -
kiren-macos-x64.tar.gz
,kiren-macos-arm64.tar.gz
- β
Windows (x64) -
kiren-windows-x64.zip
# Prerequisites: Rust 1.70+, Git
git clone https://github.com/kirencore/kiren.git
cd kiren
# Quick start with Make
make build # Development build
make dev # Build + REPL
make test # Run tests
make server # HTTP server demo
# Or use Cargo directly
cargo build --release # Optimized build
cargo run examples/hello.js # Run example
cargo run -- --repl # Interactive REPL
# Install locally
cp target/release/kiren /usr/local/bin/
kiren examples/hello.js
kiren examples/hello.ts
kiren examples/component.tsx
kiren --repl
Kiren uses kiren.toml
for configuration:
[runtime]
version = "3.0.0"
memory_limit = 512
[environment]
NODE_ENV = "development"
LOG_LEVEL = "info" # "debug", "info", "warn", "error", "silent"
[server]
default_port = 3000
cors_enabled = true
console.log("Hello, Kiren!");
const sum = (a, b) => a + b;
console.log("5 + 3 =", sum(5, 3));
// Modern JavaScript features
const users = [
{ name: "Alice", age: 30 },
{ name: "Bob", age: 25 }
];
const adults = users.filter(user => user.age >= 18);
console.log("Adults:", adults);
// setTimeout
setTimeout(() => {
console.log("This runs after 1 second");
}, 1000);
// setInterval
const intervalId = setInterval(() => {
console.log("This repeats every second");
}, 1000);
// Clear after 5 seconds
setTimeout(() => {
clearInterval(intervalId);
console.log("Interval cleared");
}, 5000);
// Write and read files
fs.writeFile("test.txt", "Hello from Kiren!");
const content = fs.readFile("test.txt");
console.log("File content:", content);
// Directory operations
fs.mkdir("new-folder");
console.log("Folder exists?", fs.exists("new-folder"));
// Environment variables
console.log("HOME directory:", process.env.HOME);
// Command line arguments
console.log("Arguments:", process.argv);
// Current working directory
console.log("Working directory:", process.cwd());
// Exit with code
process.exit(0);
// Fetch API
fetch("https://api.github.com/users/mertcanaltin")
.then(response => response.json())
.then(data => console.log("User:", data.name))
.catch(error => console.log("Error:", error));
// Async/await
async function getUser() {
try {
const response = await fetch("https://api.github.com/users/mertcanaltin");
const user = await response.json();
console.log("User:", user.name);
} catch (error) {
console.log("Error:", error);
}
}
getUser();
// hello.ts - TypeScript with types
interface User {
name: string;
age: number;
}
const users: User[] = [
{ name: "Alice", age: 30 },
{ name: "Bob", age: 25 }
];
function findUser(name: string): User | undefined {
return users.find(user => user.name === name);
}
const alice = findUser("Alice");
console.log("Found user:", alice?.name);
// Advanced TypeScript features
type EventHandler<T> = (event: T) => void;
class EventEmitter<T> {
private handlers: EventHandler<T>[] = [];
on(handler: EventHandler<T>): void {
this.handlers.push(handler);
}
emit(event: T): void {
this.handlers.forEach(handler => handler(event));
}
}
const emitter = new EventEmitter<string>();
emitter.on((message) => console.log("Received:", message));
emitter.emit("Hello TypeScript!");
// Zero-config production server
const server = http.createServer();
// Routes
server.get("/", () => "Hello from Kiren!");
server.get("/api/users", () => ({ users: ["Alice", "Bob"] }));
server.post("/api/data", (req) => ({
message: "Data received",
data: req.body
}));
// Middleware
server.use((req, res, next) => {
console.log(`${req.method} ${req.url}`);
next();
});
// Start server
server.listen(3000);
console.log("π Server ready at http://localhost:3000");
FROM scratch
COPY kiren /kiren
COPY app.js /app.js
EXPOSE 3000
CMD ["/kiren", "/app.js"]
# Result: 15MB container vs Node.js 500MB+
Real Benchmark Results (vs Node.js v20.18.1):
Metric | Kiren v3.0.0 | Node.js | Result |
---|---|---|---|
Startup Time | 72ms | 22ms | Node.js 3.3x faster |
Fibonacci(35) | 54ms | 46ms | Node.js 1.2x faster |
Loop (10M) | 37ms | 8ms | Node.js 4.6x faster |
Memory Usage | 45MB | 89MB | Kiren 50% less memory |
Binary Size | 15MB | 500MB+ | Kiren 97% smaller |
- π¦ Memory Safety: Rust's ownership model prevents crashes
- π¦ Single Binary: No dependency hell, easy deployment
- π§ Simplicity: Minimal setup, just copy & run
- π³ Container Friendly: 15MB Docker images vs 500MB+ Node.js
- π οΈ Learning: Perfect for understanding JavaScript runtime internals
- π Potential: Room for optimization and unique features
Note: At v3.0.0, Kiren is not faster than Node.js yet. This is a learning project and should be evaluated as a functional runtime. For detailed benchmark results, see
benchmarks/BENCHMARK_RESULTS.md
.
- V8 Integration - Full JavaScript support with modern features
- Console API -
console.log()
,console.time()
,console.timeEnd()
, etc. - REPL Mode - Interactive JavaScript environment (
.exit
,.help
) - CLI Interface - File execution and command line options
- Timer APIs -
setTimeout
,setInterval
,clearTimeout
,clearInterval
- Fetch API - HTTP requests with Promise support
- File System API -
fs.readFile
,fs.writeFile
,fs.exists
,fs.mkdir
- Process API -
process.env
,process.argv
,process.cwd()
,process.exit()
- π₯ HTTP Server API - Production-ready web server with routing
- TypeScript Support - Built-in TypeScript transpilation (.ts, .tsx files)
- Enhanced error handling & stack traces
- Timer callback execution improvements
- ES Modules system
- CommonJS compatibility layer
- Advanced TypeScript features (decorators, path mapping)
- Package manager integration (npm-compatible)
- WebAssembly support
- Worker Threads
- Streaming APIs
- Crypto APIs
We welcome contributions to Kiren! Here's how to get started:
- Read our CONTRIBUTING.md guide
- Fork the repository
- Set up development environment:
cargo build
- Create a feature branch:
git checkout -b feature/amazing-feature
- Test your changes:
cargo test
- Submit a Pull Request
- Performance Optimization - Improve V8 integration and runtime speed
- Stability Fixes - Fix crashes and memory issues
- New APIs - Implement missing JavaScript APIs
- Documentation - API guides, tutorials, examples
- Testing - Unit tests, integration tests, benchmarks
- Platform Support - Windows, ARM64, WebAssembly
# Clone and build
git clone https://github.com/kirencore/kiren.git
cd kiren
# Development helpers
make format # Format code with rustfmt
make clippy # Run Clippy linter
make test # Run all tests
make check # All quality checks
make examples # List available examples
# Build script with options
./scripts/build.sh release # Optimized build
./scripts/build.sh test # Run tests
./scripts/build.sh check # Full quality check
For details, see: CONTRIBUTING.md
Distributed under the MIT License. See LICENSE
file for details.
Maintainer: Mert Can Altin - @mertcanaltin
Project Link: https://github.com/kirencore/kiren
Community:
- π Report Issues
- π‘ Feature Requests
- π Documentation (Coming Soon)
- π¬ Discord Server (Coming Soon)
β If you find Kiren useful, please consider giving it a star on GitHub!