Platforms
uWebSockets.js
Running mion APIs on uWebSockets.js for maximum performance.
Installing the Adapter
npm install @mionjs/platform-uws @mionjs/router
The native uWebSockets.js binaries install automatically, as per-platform packages npm picks for your machine, with no compiler or extra steps.
uWebSockets.js publishes prebuilt binaries only for even Node.js versions (currently 22, 24 and 26) on Linux (glibc), macOS and Windows x64. On other Node versions or on Alpine Linux the server will not start, so use the Node.js platform there.
Starting the Server
import {startUwsServer} from '@mionjs/platform-uws';
import './uws-routes.ts';
const server = await startUwsServer({port: 3000});
console.log('Server running at http://localhost:3000');
import {createMionRouter, Routes} from '@mionjs/router';
const mion = createMionRouter();
const routes = {
sayHello: mion.route((ctx, name: string): string => {
return `Hello ${name}!`;
}),
} satisfies Routes;
// the server entry only imports this file
export const myApi = mion.initRoutes(routes);
export type MyApi = typeof myApi;
Adapter Options
Pass options such as maxBodySize to startUwsServer, and set router options like basePath once in createMionRouter. Each route has its own body limit, and the native read stops at it.
import {startUwsServer} from '@mionjs/platform-uws';
import './uws-routes.ts';
await startUwsServer({port: 3000});
uWebSockets.js is a native C++ server and one of the fastest HTTP servers for Node.js. It suits high throughput APIs on your own machines or containers.
The mion team publishes the binaries on npm, unmodified from the pinned official uWebSockets.js release (Apache 2.0 license).