Description
tinyhttp is a modern Express-like web framework written in TypeScript and compiled to native ESM, that uses a bare minimum amount of dependencies trying to avoid legacy hell.
Here is a short list of most important features that tinyhttp has:
- ⚡ 2.3x faster than Express
- ⚙ Full Express middleware support
- ↪ Async middleware support
- ☑ Native ESM and CommonJS support
- 🚀 No legacy dependencies, just the JavaScript itself
- 🔨 Types out of the box
tinyhttp alternatives and similar modules
Based on the "Web Frameworks" category.
Alternatively, view tinyhttp alternatives based on common mentions on social networks and blogs.
-
Express
A minimal and flexible web application framework, providing a robust set of features for building single and multi-page, and hybrid web applications. -
Meteor
An ultra-simple, database-everywhere, data-on-the-wire, pure-Javascript web framework. (You might like awesome-meteor) -
Nest
A progressive Node.js framework for building efficient and scalable server-side applications on top of TypeScript & JavaScript (ES6 / ES7 / ES8) heavily inspired by Angular 😻🚀 -
Koa
A new web framework designed by the team behind Express, which aims to be a smaller, more expressive, and more robust foundation for web applications and APIs. -
SailsJS
An MVC web framework with a modern twist, supporting WebSockets, streams, and a data-driven API. -
Feathers
A minimal and flexible microservice framework built in the spirit of Express. -
Restify
A node framework built specifically to enable you to build correct REST web services. -
AdonisJs Framework
NodeJs Web Application Framework. Makes it easy for you to write webapps with less code 😃 -
MERN
Easily build production-ready universal apps with MongoDB, Express, React, and webpack. -
TypeGraphQL
Modern framework for creating GraphQL APIs with TypeScript, using classes and decorators. -
Derby
MVC framework, making it easy to write realtime, collaborative applications that run in both Node.js and browsers. -
LoopBack
Powerful framework for creating REST APIs and easily connecting to backend data sources. -
Quick Start
🍔 A Node.js Serverless Framework for front-end/full-stack developers. Build the application for next decade. Works on AWS, Alibaba Cloud, Tencent Cloud and traditional VM/Container. Super easy integrate with React and Vue. 🌈 -
ActionHero
Framework for making reusable & scalable APIs for TCP sockets, WebSockets, and HTTP clients. -
Marble.js
Functional reactive framework for building server-side apps, based on TypeScript and RxJS. -
sqs-consumer
Build SQS-based Node applications without the boilerplate -
lychee.js
Next-Gen Isomorphic Application Engine for Embedded, Console, Mobile, Server and Desktop -
Catberry
Framework with Flux architecture, isomorphic web-components, and progressive rendering. -
Interfake
Rapid prototyping framework for making mock HTTP APIs, with a Node.js, command-line and HTTP interface. -
dawson-cli
A serverless web framework for Node.js on AWS (CloudFormation, CloudFront, API Gateway, Lambda) -
AdonisJs Application
This repo is the pre-configured project structure to be used for creating ambitious web servers using AdonisJs. -
sqs-producer
Simple scaffolding for applications that produce SQS messages -
Perk
A node framework built on three core tenets: documentation, stability and balance. -
Restberry
Framework for setting up RESTful JSON APIs, applied to your database models without needing to write any code. -
Zeronode
Minimal building block for reliable and fault-tolerant microservices. -
express-version-route
A Node.js express middleware that implements API versioning for route controllers -
QueryQL
Easily add filtering, sorting, and pagination to your Node.js REST API through your old friend: the query string! -
Coher3nTS Project
Cross-platform project template using Electron and Angular with the Phaser game engine. Project has Flexbox integrated for easy and responsive organization of components around the Phaser canvas. -
@Sugoi/Server
Minimalist web server framework inspired by JAVA Spring -
AWS Lambda Router for NodeJS
AWS Lambda router for NodeJS -
searchkit
GraphQL API & React UI components for Elasticsearch. The easiest way to build a great search experience
Scout APM - Leading-edge performance monitoring starting at $39/month
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest. Visit our partner's website for more details.
Do you think we are missing an alternative of tinyhttp or a related project?
README
tinyhttp ⚡ Tiny web framework as a replacement of Express
tinyhttp is a modern Express-like web framework written in TypeScript and compiled to native ESM, that uses a bare minimum amount of dependencies trying to avoid legacy hell.
Here is a short list of most important features that tinyhttp has:
- ⚡ [2x faster](benchmark) than Express
- ⚙ Full Express middleware support
- ↪ Async middleware support
- ☑ Native ESM and CommonJS support
- 🚀 No legacy dependencies, just the JavaScript itself
- 🔨 Types out of the box
- 🔥 Prebuilt middleware for modern Node.js
Visit tinyhttp website for docs, guides and middleware search.
Install
tinyhttp requires Node.js 12.4.0 or newer. It is recommended to use pnpm, although it isn't required.
# npm
npm i @tinyhttp/app
# pnpm
pnpm i @tinyhttp/app
# yarn
yarn add @tinyhttp/app
Docs
You can see the documentation here.
Get Started
tinyhttp is compiled to ESM (and legacy CommonJS) so you can use import
/ export
syntax in Node.js with it.
To setup a Node ESM package, put "type": "module"
in the package.json file, like this:
{
"type": "module"
}
Another option would be using an .mjs
extension, then you don't need to put that "type"
field in package.json.
For more info, check out the ECMAScript Modules Node.js documentation.
From now on you can use named imports for ESM modules and default imports for CommonJS modules in your project.
The app structure is quite similar to Express, except that you need to import App
from @tinyhttp/app
instead of default import from express
.
import { App } from '@tinyhttp/app'
import { logger } from '@tinyhttp/logger'
const app = new App()
app
.use(logger())
.use(function someMiddleware(req, res, next) {
console.log('Did a request')
next()
})
.get('/', (_, res) => {
res.send('<h1>Hello World</h1>')
})
.get('/page/:page/', (req, res) => {
res.status(200).send(`You just opened ${req.params.page}`)
})
.listen(3000)
See tinyhttp "Learn" page for complete guide.
Middlewares
tinyhttp offers a list of premade middleware for common tasks, such as session, logger and jwt.
Search and explore the full list at middleware search page.
Comparison
See [COMPARISON.md](COMPARISON.md).
Benchmarks
Check [benchmark](benchmark) folder.
Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md).
Contributors ✨
Thanks goes to these wonderful people (emoji key):
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> <!-- prettier-ignore-start --> <!-- markdownlint-disable --> v 1 r t l💡 🔌 📆 🚧 💻 Matt🔌 ⚠️ Nasmevka📖 elianiva💡 🚧 💻 ⚠️ Katja Lutz💡 Arnovsky🔌 💻 Rocktim Saikia🚇 💻 💡 Ahmad Reza💻 Ionel lupu💡 Tomi Kalmi📖 Luiginator💡 💻 Aneesh Relan💡 ⚠️ Roberto Ortega💡 Barciet Maëlann💡 shzmr💻 ⚠️ 💡 Egor Avakumov💡 Rashmi K A💻 Shubhi Agarwal⚠️ Maurizio⚠️ 💻 jkreller💡 Alan Carpilovsky⚠️ KoljaTM⚠️ ike📖 💡 Fabian Morón Zirfas🐛 Vitaly Baev⚠️ 🐛 omrilotan💻 MVEMCJSUNPE💡 🐛
<!-- markdownlint-enable --> <!-- prettier-ignore-end --> <!-- ALL-CONTRIBUTORS-LIST:END -->
This project follows the all-contributors specification. Contributions of any kind welcome!
Supporters 💰
These amazing people supported tinyhttp financially:
<!-- prettier-ignore-start --> <!-- markdownlint-disable --> molefrog <!-- markdownlint-enable --> <!-- prettier-ignore-end -->
License
MIT © v1rtl
*Note that all licence references and agreements mentioned in the tinyhttp README section above
are relevant to that project's source code only.