Brahma-JS (brahma-firelight)

JavaScript convenience, Rust-powered speed — Express-like feel on Tokio + Hyper.

Brahma-Firelight is built to replace Node.js’s slow HTTP layer with a lightning-fast Rust-powered core. It’s written entirely in Rust using tokio and hyper, giving it native async speed, zero garbage collection pauses, and rock-solid stability. Through napi-rs, it exposes a clean Express-like API to JavaScript developers, so it feels simple to use while the heavy lifting—request parsing, routing, and response handling—runs natively in Rust. Brahma-Firelight is pure Rust with a direct binary bridge to Node, eliminating overhead and context switches. It uses a fire-and-forget model that sends responses without blocking, ideal for orchestrators, control panels, and microservice routers. Each worker runs independently, scaling cleanly across CPU cores without shared event loop contention. With structured HTTP routing, no dependency bloat, and single-binary deployment, Brahma-Firelight focuses on raw throughput and developer simplicity 💛

Install


npm install brahma-firelight
# or
yarn add brahma-firelight
# or
pnpm add brahma-firelight
# or
bun add brahma-firelight
# or
nypm add brahma-firelight

Initialize


const { createApp, setJsResponseTimeout, setMaxBodyBytes } = require("brahma-firelight");
const app = createApp();
// This is Rust-Runtime config this works even node js event loop gets choked.
setJsResponseTimeout(12);  // return 503 if js failed to respond within 12 seconds
setMaxBodyBytes(5 * 1024 * 1024);  // set body-limit to 5mb handled natively by rust instead of node js

Middleware


// CORS config
app.use((req,res,next)=>{
  res.setHeader("Access-Control-Allow-Origin","*");
  res.setHeader("Access-Control-Allow-Methods","GET,POST,PUT,DELETE,OPTIONS");
  res.setHeader("Access-Control-Allow-Headers","Content-Type, Authorization");
  if(req.method==="OPTIONS") res.send(204);
  else next();
});

Routes


app.get("/hi",(req,res)=>res.json({msg:"Hello from Brahma"}));
app.post("/echo",(req,res)=>res.json(JSON.parse(req.body||"{}")));

Cookies & Redirects


app.get("/set",(req,res)=>{
  res.send(200,{"Content-Type":"text/plain"},
    ["a=1; Path=/; HttpOnly"],"cookies set");
});
app.get("/goto",(req,res)=>res.redirect("https://google.com"));

Listen & Shutdown


app.listen("0.0.0.0",2000,()=>console.log("Listening on 2000"));
// GRACEFUL shutdown handled safely with TOKIO
process.on("SIGINT",async()=>{await app.close(3000);process.exit(0);});  

Benchmark


wrk -t1 -c200 -d10s http://127.0.0.1:2000/hi
# ~251.2k req/sec, <2ms avg latency (i5-12450H)

🌌 The Brahma Story

Brahma-JS merges Rust concurrency with JS simplicity. Write Express-style code and run it at native speed — each request is async, non-blocking, and powered by Tokio + Hyper. It’s built to achieve ultimate perfomance in how we write and scale backend code compatible with Bun & Deno — if you love this project, give it a try and don’t forget to star it ⭐.

⭐ Star on GitHub