npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@asterflow/adapter

v2.2.0

Published

Wires a runtime's native server (Bun.serve, Node's http, Express, Fastify) into AsterFlow, converting native requests to Request and sending back AsterResponse the same way regardless of runtime.

Readme

@asterflow/adapter

license-info stars-info last-commit

bundle-size

Wires a runtime's native server (Bun.serve, Node's http, Express, Fastify) into AsterFlow, converting native requests to Request and sending back AsterResponse the same way regardless of runtime.

📦 Installation

bun install @asterflow/adapter

✨ Features

  • adapters - a ready-made Adapter instance for each runtime: adapters.bun, adapters.node, adapters.express, adapters.fastify
  • Runtime - the enum (Bun, Node, Express, Fastify) that types requests, listen arguments, and adapters to their runtime
  • Adapter - a small class holding a runtime, a listen(...) function typed to that runtime's native listen/serve signature, and an onRequest hook that AsterFlow assigns to route native requests into its handler
  • Request conversion per runtime - each adapter calls the matching create*Request factory from @asterflow/request (createBunRequest, createNodeRequest, createExpressRequest, createFastifyRequest) before handing the request to onRequest
  • Fallback response - if listen() is called before onRequest is set, every adapter responds with a 500 instead of crashing
  • Error-to-response conversion - toErrorResponse(err) turns a thrown value (an Error, an already-built AsterResponse, or anything else) into a JSON AsterResponse; the Node adapter uses it to catch per-request errors and return a 500 instead of hanging the connection

❓ How to Use

Pick an adapter and pass it as the driver when creating an AsterFlow app — everything else (routes, .listen()) stays the same:

import { AsterFlow } from 'asterflow'
import { adapters } from '@asterflow/adapter'

const app = new AsterFlow({ driver: adapters.bun }) // or adapters.node, adapters.express, adapters.fastify

app.listen({ port: 3000 })

Express and Fastify need their own instance passed through listen, since AsterFlow mounts a catch-all route on it rather than starting its own server:

import { AsterFlow } from 'asterflow'
import { adapters } from '@asterflow/adapter'
import express from 'express'

const app = new AsterFlow({ driver: adapters.express })

app.listen(express(), 3000)

🔗 Related Packages

  • @asterflow/request - supplies the create*Request factories each adapter calls to build a typed Request from the runtime's native one
  • @asterflow/response - AsterResponse is what onRequest must return; adapters convert it to the runtime's native response and use it to build fallback/error responses
  • Depended on by asterflow - the core framework picks a driver from adapters, sets its onRequest, and delegates app.listen(...) to driver.listen(...)

📄 License

This project is licensed under the MIT License.