
Research
Node.js Fixes AsyncLocalStorage Crash Bug That Could Take Down Production Servers
Node.js patched a crash bug where AsyncLocalStorage could cause stack overflows to bypass error handlers and terminate production servers.
@andywer/srv
Advanced tools
Node.js servers rethought: Functional, lean, performant.
What if we were to write express from scratch in 2019...
Would we use async functions and promises? Would we make it more functional? With TypeScript in mind?
Sure we would! So here we go.
⚠️ Status: Experimental ⚠️
import {
Response,
Route,
Router,
Service
} from "@andywer/srv"
const greet = Route.GET("/welcome", async (request) => {
const name = request.query.name
return Response.JSON({
name: "Greeting service",
welcome: name ? `Hello, ${name}!` : `Hi there!`
})
})
const service = Service(Router([ greet ]))
service.listen(8080)
.catch(console.error)
Find some documentation and sample code here. Work in progress right now.
No callbacks. Leverage modern day features instead for an optimal developer experience.
import { Response, Route } from "@andywer/srv"
const greet = Route.GET("/health", async () => {
try {
const stats = await fetchHealthMetrics()
return Response.JSON({
operational: true,
stats
})
} catch (error) {
return Response.JSON(500, {
operational: false
})
}
})
Take a request, return a response. Lean, clean, easy to test and debug.
import { Response, Route, Router } from "@andywer/srv"
import { queryUserByID } from "./database/users"
const getUser = Route.GET("/user/:id", async request => {
const userID = request.params.id
const user = await queryUserByID(userID)
if (!user) {
return Response.JSON(404, {
message: `User ${userID} not found`
})
}
const headers = {
"Last-Modified": user.updated_at || user.created_at
}
return Response.JSON(200, headers, user)
})
export const router = Router([
getUser
])
Stop passing data from middlewares to route handlers by dumping it in an untypeable context. Take the request object, extend it, pass it down to the route handler.
By applying middlewares in a direct and explicit manner, the passed requests and responses are completely type-safe, even if customized by middlewares.
import { Middleware, Request, RequestHandler, Service } from "@andywer/srv"
import { Logger } from "./logger"
export default function LoggingMiddleware(logger: Logger): Middleware {
return async (request: Request, next: RequestHandler) => {
const requestWithLogger = request.derive({
log: logger
})
// typeof requestWithLogger.log === Logger
return next(requestWithLogger)
}
}
import { composeMiddlewares, Service } from "@andywer/srv"
import logger from "./logger"
import router from "./routes"
const applyMiddlewares = composeMiddlewares(
LoggingMiddleware(logger),
SomeOtherMiddleware()
)
const service = Service(applyMiddlewares(router))
The code base is relatively simple. Middlewares, routes and routers, they are all just implementations of the following function type:
type RequestHandler = (request: Request, next?: NextCallback) => Response | Promise<Response>
type NextCallback = (req: Request) => Response | Promise<Response>
Set the DEBUG environment variable to srv:* to get some debug logging:
$ DEBUG=srv:* node ./dist/my-server
MIT
FAQs
Node.js server rethought. Functional, clean, performant.
We found that @andywer/srv demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
Node.js patched a crash bug where AsyncLocalStorage could cause stack overflows to bypass error handlers and terminate production servers.

Research
/Security News
A malicious Chrome extension steals newly created MEXC API keys, exfiltrates them to Telegram, and enables full account takeover with trading and withdrawal rights.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.