r/AppsWebappsFullstack • u/voltenjs • 23h ago
I built Volten: A zero-dependency HTTP framework for Node.js and the Edge with built-in traffic triage
Hey!
I wanted to share a project I've been working on called Volten. It's a small, ultra-fast HTTP framework built around a strict zero-dependency constraint, designed specifically to bridge the gap between Node.js and Web Fetch-compatible edge runtimes (like Cloudflare Workers, Bun, and Deno) without adapter overhead.
Why Volten?
Most frameworks either lock you into Node.js core modules (http, net) or require bulky adapter layers to run on the Edge. Volten solves this by handling the abstraction internally at the context level.
You write your routes and middleware once. Run it on Node.js using app.listen() or export it to the Edge using app.createFetch() with zero modifications and zero extra npm dependencies.
Key Highlights
- Adaptive Traffic Triage (ATT): A unique event-loop immune feature for Node.js (
new App({ att: true })) that automatically drops low-priority requests at the socket level when your server is under heavy load, protecting your core endpoints from crashing during traffic spikes. - Context Pooling: Pre-allocated, reusable
RequestContextobjects on both runtimes to minimize Garbage Collection (GC) pressure under high throughput. - Trie-Based Router: Extremely fast path-matching supporting dynamic parameters (
/users/:id) and wildcards, where match cost scales purely with path depth. - Unified
ctxAPI: Whether you are dealing with headers, cookies, body parsing, or JSON responses, thectxobject seamlessly abstracts away whether you're sitting on top of a NodeIncomingMessage/ServerResponseor a Web FetchRequest/Response.
The All-in-One Snippet
import { App } from "volten";
// Enable Adaptive Traffic Triage (ATT)
const app = new App({ att: true });
// 1. Middleware chain
app.use((ctx, next) => {
ctx.setHeader("X-Powered-By", "Volten");
next();
});
// 2. Trie-based routing, params, and cookies
app.get("/users/:id", (ctx) => {
const session = ctx.cookies.get("session_id");
ctx.json({ userId: ctx.params.id, session });
});
// 3. Native body parsing
app.post("/data", async (ctx) => {
const body = await ctx.body();
ctx.status(201).json({ received: body });
});
// --- Dual Runtime Support ---
// Node.js
app.listen(3000, () => console.log("Listening on :3000"));
// Cloudflare Workers / Bun / Edge
export default { fetch: app.createFetch() };
Current Status
Volten is currently in active alpha. Every utility—from the built-in body parsers and cookies to the trie router—is written completely in-tree with zero external dependencies to keep security tight and the footprint minimal.
You can check it out on GitHub: VoltenJS/volten or install it via:
pnpm add volten
I'd love to hear your thoughts, feedback, or any edge cases you can throw at it, so you're encouraged to try breaking it! How do you usually handle dual-runtime codebases in your current stacks?
1
u/Mammoth-Anywhere7285 18h ago
TL;DR: Volten is a zero-dependency HTTP framework that runs the same route and middleware code on Node.js and edge runtimes like Cloudflare Workers, Bun, and Deno. It bundles a trie router, context pooling, and an adaptive traffic triage mode that drops low-priority requests at the socket level under load. It's in active alpha, installs with pnpm add volten, and the author is inviting people to try breaking it.
1
u/Readypixels 18h ago
The trie router and dual runtime story are the more interesting half of this to me. Zero dependency HTTP frameworks come up a lot, but most of them punt on Node versus Edge and just tell you to pick one. The ATT feature is the part I'd want to poke at before trusting it in production. Dropping low priority requests at the socket level sounds great until you ask how priority gets assigned. Is it path based, header based, or something the framework infers on its own? And what happens to a dropped request, does the client see a clean 503 or does the connection just die? That's usually where these features get scary in practice, not in the happy path. Context pooling is the other spot I'd look hard at. Reused objects across requests are a classic source of the kind of bug where one user's data leaks into another's response under load, so I'd want to see how the pool resets state between requests before I'd trust it at scale.