An efficient server implies a lower cost of the infrastructure, a better responsiveness under load and happy users. How can you efficiently handle the resources of your server, knowing that you are serving the highest number of requests as possible, without sacrificing security validations and handy development?
Enter Fastify. Fastify is a web framework highly focused on providing the best developer experience with the least overhead and a powerful plugin architecture. It is inspired by Hapi and Express and as far as we know, it is one of the fastest web frameworks in town.
npm i fastify --save
// Require the framework and instantiate itconst fastify =// Declare a routefastify// Run the server!fastify
const fastify =fastifyfastify
Do you want to know more? Head to the
.listen binds to the local host,
127.0.0.1, interface by default. See the documentation for more information.
Machine: Intel Xeon E5-2686 v4 @ 2.30GHz (4 cores, 8 threads), 16GiB RAM (Amazon EC2 m4.xlarge)
autocannon -c 100 -d 40 -p 10 localhost:3000 * 2, taking the second average
Benchmarks taken using https://github.com/fastify/benchmarks. This is a synthetic, "hello world" benchmark that aims to evaluate the framework overhead. The overhead that each framework has on your application depends on your application, you should always benchmark if performance matters to you.
Validation and Serialization
Content Type Parser
Fastify is the result of the work of a great community. Team members are listed in alphabetical order.
Fastify's support schedule is detailed in the LTS document.
This project is kindly sponsored by:
Licensed under MIT.