Rust is amazing for speed, safety, and stability — but let’s be real: most JS/TS devs don’t want to wrangle the borrow checker, strict type system, and ownership rules just to build APIs.
That’s why I built Brahma-JS — an ultra-low latency runtime written in Rust on top of Tokio + Hyper, but plug-and-play with Node, Deno, and Bun.
🚀 Why v1.5?
The first version (v1) of Brahma-JS was a minimal prototype. It proved that Rust + JS could hit crazy speeds with a simple API, but it wasn’t ergonomic for building real services.
Brahma-JS v1.5 changes that:
- ✅ Express-like API (middleware, routes, responses)
- ✅ Rust-level performance (Tokio + Hyper under the hood)
- ✅ Async Support (Async support with oneshot implementation)
In short: v1 proved the concept, v1.5 makes it practical.
⚡ Benchmarks
On a tiny AWS EC2 t2.micro (1 vCPU, 1 GB RAM):
Framework | Requests (10s) | Notes |
---|---|---|
uWebSockets.js | 456k | C++ core, fastest overall |
Brahma-JS | 413k | Rust-powered — impressively close |
Fastify | 307k | High-performance JS framework |
Express.js | 54k* | Thousands of failures |
* Express fell significantly behind under load.
👉 On the same hardware, Brahma-JS v1 hit ~33.2k req/s sustained throughput.
👉 That’s Rust speed, with a JS developer experience.
🛠 Brahma-JS v1 (The Prototype)
Super minimal — no middleware, no fancy routing. Just raw speed.
const { useBrahma, startServer, redirect } = require("brahma-firelight");
useBrahma((req) => {
if (req.path === "/hi") {
return {
headers: { "Content-Type": "application/json" },
status: 200,
body: JSON.stringify({ message: "Hello World from Brahma-JS v1!" }),
};
}
if (req.path === "/bye") {
return redirect("https://example.com");
}
return {
status: 404,
body: "Route not found",
};
});
const port = process.env.PORT || 3000;
const host = process.env.HOST || "0.0.0.0";
startServer(host, +port).then(() => {
console.log(`🌀 Brahma-JS v1 running at http://${host}:${port}`);
});
⚠️ Great for raw experiments. But real-world APIs need more flexibility.
🛠 Brahma-JS v1.5 (The Upgrade)
Now with Express-style API, middleware, async support, and JSON helpers:
npm install brahma-firelight@latest
const { createApp } = require("brahma-firelight");
const app = createApp();
// utils.js
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
app.get("/hi", (req, res) => {
res.json({ message: "Hello World from Brahma-JS!" });
});
// // Async handler returning an object
app.get("/time", async (req) => {
await sleep(20000);
return {
status: 400,
headers: { "Content-Type": "application/json" }, // Custom RESPONSE
body: JSON.stringify({ now: Date.now() }),
};
});
// To send HTML response
app.get("/page", (req, res) => {
res.html(`<h1>Hello HTML</h1><p>Served by Brahma-JS id: ${req.reqId}</p>`);
});
// to return body no overhead very fast as text
app.post("/json", (req, res) => {
res.text(req.body);
});
app.post("/submit", (req, res) => {
let formData = JSON.parse(req.body);
console.log("bodyData:", formData);
res.json(formData, 201); // return the JSON response with http-status-code
});
app.get("/redirect", (req, res) => {
res.redirect("https://google.com");
});
app.listen("0.0.0.0", 2000, () => {
console.log("Server listening on port 2000");
});
👉 Same “Hello World” — but with the ergonomics you expect from Express,
and the performance only Rust can deliver.
🔍 More Examples in v1.5
Async Fetch
app.get("/data", async (req, res) => {
const result = await fetch("https://jsonplaceholder.typicode.com/todos/1")
.then(r => r.json());
res.json({ result });
});
Middleware + Delay
app.use((req, res, next) => {
req.startTime = Date.now();
next();
});
app.get("/delay", async (req, res) => {
await new Promise(r => setTimeout(r, 200));
res.json({ elapsed: Date.now() - req.startTime });
});
📊 Learn More
- Docs & benchmarks: https://shyam20001.github.io/rsjs/
- Repo (master-branch): https://github.com/Shyam20001/rsjs
🙌 Feedback Welcome
- Try it in your API/microservice projects.
- Share your benchmarks & ideas.
- Help shape where Brahma-JS goes next.
✨ Write JavaScript. Run at Rust speed. ⚡
Top comments (2)
Interesting... can this work on something like Stackblitz, by any chance?
It would be great if it could, as a one-click kind of playground...
You can run the code in github codespaces. Since stackblitz is light weight it does not support running native addons directly. Try switching to github code spaces. Now i made a major upgrade v1.5 removing v2. This update is much stable and almost scored high throughputs compared to bun elysia and fastify in cluster mode. You can give a try by starting npm i brahma-firelight.
refer here // github.com/Shyam20001/rsjs