Powered by uWebSockets.js
This is an actively maintained community fork of kartikk221/hyper-express, which has not received updates since late 2024. This fork includes:
- Bug Fixes from unmerged community Pull Requests
- Built-in CORS — Native cross-origin handling as a Server option
- Built-in Helmet — Security headers out of the box with zero per-request overhead
- Built-in Zod Validation — Schema-based request validation for body, query & params
- Updated Dependencies — uWebSockets.js v20.57.0 with Node.js v24 support
This package is a drop-in replacement for hyper-express. Simply change your install and import — no code changes required. The built-in middleware features are opt-in and disabled by default.
const HyperExpress = require('@masternemo/hyper-express');
const app = new HyperExpress.Server({
cors: true, // Built-in CORS with permissive defaults
helmet: true, // Built-in security headers
validation: true, // Built-in Zod validation (requires: npm i zod)
});
app.get('/', (req, res) => {
res.json({ hello: 'world' });
});
app.listen(3000).then(() => console.log('Server running on port 3000'));npm i @masternemo/hyper-express
Replace your existing dependency:
npm uninstall hyper-express
npm i @masternemo/hyper-express
Update your imports:
// Before
const HyperExpress = require('hyper-express');
// After
const HyperExpress = require('@masternemo/hyper-express');All existing code will continue to work without changes.
| Feature | hyper-express (original) | @masternemo/hyper-express |
|---|---|---|
| Active maintenance | ❌ (since late 2024) | ✅ |
| Community bug fixes | ❌ (unmerged PRs) | ✅ |
| Node.js v24 support | ❌ | ✅ |
| Built-in CORS | ❌ | ✅ |
| Built-in Security Headers | ❌ | ✅ |
| Built-in Request Validation | ❌ | ✅ |
| Express.js compatibility | ✅ | ✅ |
HyperExpress aims to be a simple yet performant HTTP & Websocket Server. Combined with the power of uWebsockets.js, a Node.js binding of uSockets written in C++, HyperExpress allows developers to unlock higher throughput for their web applications with their existing hardware. This can allow many web applications to become much more performant on optimized data serving endpoints without having to scale hardware.
Some of the prominent highlights are:
- Simplified HTTP & Websocket API
- Server-Sent Events Support
- Multipart File Uploading Support
- Modular Routers & Middlewares Support
- Multiple Host/Domain Support Over SSL
- Limited Express.js API Compatibility Through Shared Methods/Properties
- Built-in CORS, Helmet & Zod Validation
See > [Benchmarks] for performance metrics against other webservers in real world deployments.
- See
> [Examples & Snippets]for small and easy-to-use snippets with HyperExpress. - See
> [Server]for creating a webserver and working with the Server component. - See
> [Router]for working with the modular Router component. - See
> [Request]for working with the Request component made available through handlers. - See
> [Response]for working with the Response component made available through handlers. - See
> [Websocket]for working with Websockets in HyperExpress. - See
> [Middlewares]for working with global and route-specific Middlewares in HyperExpress. - See
> [Cors]for configuring built-in CORS handling in HyperExpress. - See
> [Helmet]for configuring built-in Security Headers in HyperExpress. - See
> [Validation]for configuring built-in Zod-based Request Validation in HyperExpress. - See
> [SSEventStream]for working with Server-Sent Events based streaming in HyperExpress. - See
> [MultipartField]for working with multipart requests and File Uploading in HyperExpress. - See
> [SessionEngine]for working with cookie based web Sessions in HyperExpress. - See
> [LiveDirectory]for implementing static file/asset serving functionality into HyperExpress. - See
> [HostManager]for supporting requests over multiple hostnames in HyperExpress.
- HyperExpress is mostly compatible with
Expressbut not 100% therefore you may encounter some middlewares not working out of the box. In this scenario, you must either write your own polyfill or omit the middleware to continue. - The uWebsockets.js version header is disabled by default. You may opt-out of this behavior by setting an environment variable called
KEEP_UWS_HEADERto a truthy value such as1ortrue. - Still having problems? Open an
> [Issue]with details about what led up to the problem including error traces, route information etc etc.
To run HyperExpress functionality tests locally on your machine, you must follow the steps below.
- Clone the HyperExpress repository to your machine.
- Initialize and pull any submodule(s) which are used throughout the tests.
- Run
npm installin the root directory. - Run
npm installin the/testsdirectory. - Run
npm testto run all tests with your local changes.
This fork is based on the original work by Kartik Kumar and the hyper-express community. Bug fixes included in this fork were contributed by community members including fawzyOz and RatchetS2.