https://github.com/tech-pw/platform-hyper-express
Nest.js http adapter using hyper-express, powered by uWebsockets.js
https://github.com/tech-pw/platform-hyper-express
Last synced: about 1 year ago
JSON representation
Nest.js http adapter using hyper-express, powered by uWebsockets.js
- Host: GitHub
- URL: https://github.com/tech-pw/platform-hyper-express
- Owner: tech-pw
- Created: 2024-07-02T09:28:55.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-11T12:53:53.000Z (over 1 year ago)
- Last Synced: 2025-07-09T06:06:49.203Z (about 1 year ago)
- Language: TypeScript
- Size: 202 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Hyper-Express Adapter for NestJS
## Motivation
**`platform-hyper-express`** is [**`NestJS HTTP Adapter`**](https://docs.nestjs.com/faq/http-adapter) that implement hyper-express into NestJS.
[**`hyper-express`**](https://github.com/kartikk221/hyper-express) aims to be a simple yet performant HTTP & Websocket Server.
Combined with the power of [**`uWebsockets.js`**](https://github.com/uNetworking/uWebSockets.js) - a Node.js binding of uSockets written in C++, **`platform-hyper-express`** allows NestJS Developers to unlock higher throughput for their web applications with their existing hardware.
Original work inspired by [m8a-io](https://github.com/m8a-io/hyper-express-adapter)
## Installation
```sh
npm i @pw-tech/platform-hyper-express
```
## Usage
Use **HyperExpressAdapter** for NestJS HTTP Adapter. Must require **`@nestjs/platform-express`** in dependencies.
```js
import { NestFactory } from '@nestjs/core';
import { HyperExpressAdapter, NestHyperExpressApplication } from '@pw-tech/platform-hyper-express';
import { AppModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.create(AppModule, new HyperExpressAdapter({ max_body_length: 5 * 1024 * 1024 }), { bufferLogs: true });
await app.listen(3000);
}
bootstrap();
```
## Examples
TBA
## Supported Versions
- Node `>=16`
Node 22 is also supported.
## APM Support
**@pw-tech/platform-hyper-express** is fully compatabile with dd-trace and opentelememetry APM using our [opentelemetry-instrumentaion-hyper-express](https://github.com/tech-pw/opentelemetry-instrumentation-hyper-express) package.
Checkout the above package for more info on usage.
## Encountering Problems?
- **`@pw-tech/platform-hyper-express`** is mostly compatible with **`@pw-tech/platform-hyper-express`** but 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.
- Currently uWebsockets.js supports only Node.js LTS versions 16, 18, 20 and 22 on (glibc) Linux, macOS and Windows, on [**`Tier 1`**](https://github.com/nodejs/node/blob/master/BUILDING.md#platform-list) platforms.
- The uWebsockets.js version header is disabled by default. You may opt-out of this behavior by setting an environment variable called **`KEEP_UWS_HEADER`** to a truthy value such as **`1`** or **`true`**.
## Still Having Problems?
- Open an [**`Issue`**](https://github.com/tech-pw/opentelemetry-instrumentation-hyper-express/issues) with details about what led up to the problem including error traces, route information, etc.
## Testing Changes
To run platform-hyper-express functionality tests locally on your machine, you must follow the steps below.
1. Clone the [**`platform-hyper-express`**](https://github.com/tech-pw/opentelemetry-instrumentation-hyper-express/issues) repository to your machine.
2. Initialize and pull any submodule(s) which are used throughout the tests.
3. Run **`npm install`** in the root directory.
4. Run **`npm install`** in the **`/tests`** directory.
5. Run **`npm test`** to run all tests with your local changes.
## License
[**MIT**](./LICENSE)