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

@unmbt/http-server-mbt

v0.5.0

Published

High-performance MoonBit HTTP/HTTPS static server and reverse proxy Node.js addon

Readme

@unmbt/http-server-mbt

High-performance, zero-copy HTTP/HTTPS static file server and reverse proxy Node.js native addon powered by MoonBit and MbedTLS.

Features

  • Blazing Fast: Native event loop backed by OS zero-copy kernel mechanisms (TransmitFile on Windows, sendfile on Linux/macOS).
  • Full HTTPS / TLS 1.2 & 1.3: Integrated MbedTLS 4.2.0, zero external dynamic library dependencies.
  • Reverse Proxy: Built-in HTTP proxy and fallback proxy support.
  • SPA & Fallback: Native Single Page Application (SPA) routing and try_files support.
  • Optional Linux io_uring: Set io_backend: 'auto' or 'io_uring' to opt into the experimental file-read path; auto falls back when the kernel or sandbox rejects it.
  • ABI Stable: Node-API v8; tested support targets Node 22 and 24. OS, CPU and libc must match the prebuilt package.
  • Prebuilt Binaries: Shipped via platform-specific optionalDependencies for Windows x64, Linux x64, and macOS Apple Silicon (arm64).

Installation

npm install @unmbt/http-server-mbt

Usage

ESM (Recommended)

import { createServer, getAbiVersion } from '@unmbt/http-server-mbt';

console.log(`ABI Version: 0x${getAbiVersion().toString(16)}`);

// Start an HTTP server
const server = createServer({
  port: 8080,
  root: './public',
  spa: true,
  cors: true,
  silent: false,
  cache_seconds: 3600,
  io_backend: 'platform'
});

console.log('Server is running on http://127.0.0.1:8080');

// Graceful shutdown
process.on('SIGINT', () => {
  console.log('Shutting down...');
  server.stop();
  process.exit(0);
});

CommonJS

const { createServer, getAbiVersion } = require('@unmbt/http-server-mbt');

HTTPS Example

const server = createServer({
  port: 8443,
  root: './public',
  cert_file: './certs/server.crt',
  key_file: './certs/server.key'
});

Reverse Proxy Example

const server = createServer({
  port: 8080,
  root: './public',
  proxy: 'http://127.0.0.1:3000'
});

License

Apache-2.0

Embed static files in an existing framework

import express from 'express';
import { createEngine, createMiddleware } from '@unmbt/http-server-mbt';

const engine = await createEngine({
  root: './public', handle_error: false, cache_control: 'no-cache'
});
const app = express();
app.use('/files', createMiddleware(engine));
app.get('/files/*path', (_req, res) => res.send('dynamic fallback'));
const server = app.listen(8080);
// During application shutdown: stop accepting requests, then await engine.close().

handle({ method, target, headers, signal }) returns { kind: 'next' } or { kind: 'handled', status, headers, contentLength, body }. Headers are pairs; contentLength is a bigint or null. body is a Node Readable / AsyncIterable. Destroy it or exit iteration to cancel unused bytes. Errors reject with stable HS_* codes; HS_FILE_CHANGED terminates the response rather than indicating EOF. AbortSignal remains active through body consumption. Always await engine.close() during graceful shutdown.

The host owns sockets and TLS. Static body chunks are copied into bounded Node Buffers, so framework integration does not claim zero-copy delivery. Mounted middleware uses req.url after the host strips the mount prefix; do not repeat that prefix in engine base_url. Next leaves request bodies and response headers untouched. Errors after response headers are committed destroy the connection.

io_backend accepts platform, auto, epoll, kqueue, iocp, and experimental Linux io_uring. The default is platform; explicit backends that are unavailable on the current platform or kernel reject startup with HS_UNSUPPORTED from the async engine API (the synchronous createServer wrapper reports SERVER_START_ERROR with the same diagnostic). The io_uring experiment uses bounded reads for response bodies and does not claim socket zero-copy delivery.

CJS and ESM expose the same API. Linux glibc and musl builds are distinct; missing musl builds report the matching package name instead of loading glibc. This candidate supports Node 22 and 24; package engine metadata matches that validation scope. Bun and Deno require separate lifecycle verification.