Nano-framework for Node.js powered by uWebSockets.js
Documentation available here
Are you want faster and stable performance with extra features, see PRO version
If you want Suport me, please see Support section
See Credits if you want which libraries i've used
This library does not support HTTP2!
This library reached the Stable
status and works good, see /examples
folder.
This library up to 25% slower than uWebSockets.js
on normal and complex application because of method polyfilling layer. Basic usage/examples performance are same as uWebSockets.js
, but not in all case gives you same performance.
Requires: Node.js v10 or greater
Benchmarked on my macBook Pro 2012 13" (Core i5, 8Gb RAM) performance.
Note: Real-world app memory/rps may differs from these numbers and these numbers are in my macBook
You can install wrk
via Homebrew
in macOS
or Linux
Benchmark command: wrk -t1 -d60 -c100
I've long-time planned somehow create own Express-like alternative Node.js framework, then seen uWebSockets.js. Almost 2 month i've think how do this right and decided to create Node.js framework with almost same as Express API.
This library makes very thin layer between uWebSockets.js and your code. But, gives you very Familiar and Clean API. Async/Await supported out-of-the-box!
- Async/Await out-of-the-box
- No async mode supported
- Easy to use (for Express users especially)
- Blazing fast performance
- Ultra lightweight size
- Resource (CPU / Memory) effecient
- Familiar API
- Normalised API
- Can define routes Declaratively
- Express-compatible middleware
- In-built middlewares
- In-built Stream (Video stream, yay!) support
- In-built WebSocket support (Express-like API and Events)
- In-built Schema validator via
Ajv
- Out-of-the-box
fast-json-stringify
support via{schema}
middleware - Small working examples
- TypeScript declaration
- Tests and CI checked code
All examples are lives here
Built-in middlewares implemented at layer-level for performance reason and enables automacilly when needed, not always
cookie
body-parser
express-ws
(for comparing, uWS has built-in support at core-level)fast-json-stringify
(for serialization)express-ajv
(for comparing, for validation, this library does it at layer-level)redoc
swagger-ui
I'm excluded in-box modules from initialization for performance reason
import { middlewares } from 'nanoexpress/packed';
// or import { passportInitialize } from 'nanoexpress/packed/middlewares';
const app = nanoexpress();
app.use(middlewares.passportInitialize()); // or app.use(passportInitialize());
passport
body-parser
(yes, if you don't want built-in)express-fileupload
cors
(yes,express
cors
middleware)express-jwt
express-session
express-graphql
passport
If you using alpine
or slim
version of node
images, some errors may happen and you can fix with this minimal guide
- git
# FROM ...
RUN apk update && apk add --no-cache git
# your scripts
# your scripts
RUN ln -s /lib/libc.musl-x86_64.so.1 /lib/ld-linux-x86-64.so.2
CMD ["node", "server.js"]
And to other libraries which used to create this library and without these libraries wouldn't be possible to create this library
- Star project
- Fork project
- Add Tests to Project
- Watch project
- Report bugs
- Fix issue
- Make PR