Zero External Dependencies
Built directly on Node's native http.createServer. No nested dependency bloat, maximum transparency and speed.
Built purely from Node.js native core APIs with zero runtime dependencies. Clean routing, streaming JSON parser, middleware pipeline, and chainable response helpers.
@harshitclub/nodeframe • Node >= 18 Add NodeFrame to your ESM Node.js project using your package manager of choice:
Create an entire web server with JSON body parsing, route parameters, response helpers, and logging in less than 30 lines of code:
import NodeFrame, { parseJsonBody, logger } from "@harshitclub/nodeframe";
const app = new NodeFrame();
// 1. Register global middleware
app.use(logger());
app.use(parseJsonBody);
// 2. Define routes with query & route parameters
app.get("/users/:id", (req, res) => {
const { id } = req.params;
const { details } = req.query;
res.status(200).json({
success: true,
user: { id, name: "Harshit", details: details === "true" }
});
});
app.post("/users", (req, res) => {
const { name, role } = req.body;
res.status(201).cookie("session_user", name, { httpOnly: true }).json({
success: true,
message: "User created",
data: { name, role }
});
});
// 3. Start server
app.listen(3000, () => {
console.log("Server listening on http://localhost:3000");
});Most modern backend frameworks add thousands of lines of abstractions and dozens of external dependencies. NodeFrame was designed from the ground up using Node.js core modules to provide a lean, transparent, and modular foundation.
Built strictly on http.IncomingMessage and http.ServerResponse. Methods mutate the native object directly without runtime overhead.
Fluid chaining like res.status(201).cookie(...).json(...) for clean and readable route handlers.
Automatic try/catch wrapping around routes and middlewares. Thrown errors are safely routed to (err, req, res, next) handlers with a fallback 500 JSON response.
Understanding how a request flows through NodeFrame:
Incoming HTTP Request
│
▼
[ enhanceRequest() ] ──> Attaches req.query (URLSearchParams)
│
▼
[ enhanceResponse() ] ──> Attaches res.status(), res.json(), res.send(), res.cookie()
│
▼
[ Middleware Stack ] ──> Executes app.use() functions in order (e.g., logger, body parser)
│
├─── (If next(error) or thrown Error) ──► [ Error Pipeline ] ──► 500 JSON Fallback
│
▼
[ Dynamic Router ] ──> Matches path & extracts req.params (e.g. /users/:id)
│
├─── (If no route matches) ─────────────► HTTP 404 "Not Found"
│
▼
[ Route Handler ] ──> (req, res) handler sends response
│
▼
Outgoing HTTP Response