๐ŸŒ
Reddit
reddit.com โ€บ r/nestjs_framework โ€บ express vs fastify
r/Nestjs_framework on Reddit: Express vs Fastify
June 29, 2024 -

Based on recent researches about HTTP frameworks such as Express, Fastify, Koa, etc.. I see Fastify and Koa are way faster and better in performance than Express, but why do people keep using Express over Fastify?

from my point of view is it due to Express offers more stability, and reliability in long term speaking?

NestJS oficial page they even suggest you to use Fastify if you want to improve your app's performance, but it comes with Express by default. Many things doesn't seem to make sense to me tbh. In the picture attached below you can spot Fastify is 4x times faster, at request processing per second.

Source: https://fastify.dev/benchmarks/

NodeJS HTTP Framework's Benchmarks
๐ŸŒ
Medium
medium.com โ€บ deno-the-complete-reference โ€บ nestjs-express-vs-fastify-comparison-for-hello-world-19875479e41d
NestJS โ€” Express vs Fastify comparison for hello world | Tech Tonic
June 11, 2023 - NestJS with Fastify brings significant performance benefits over NestJS (default is with Express). At 200 concurrent connections, we get 17K RPS from default NestJS, while NestJS with Fastify offers 50K RPS.
๐ŸŒ
Better Stack
betterstack.com โ€บ community โ€บ guides โ€บ scaling-nodejs โ€บ nestjs-vs-fastify
NestJS vs Fastify | Better Stack Community
NestJS gives you structure and lots of built-in tools, while Fastify is all about being as fast and lightweight as possible. NestJS was made to help teams keep big projects organized.
๐ŸŒ
NestJS
docs.nestjs.com โ€บ techniques โ€บ performance
Performance (Fastify) | NestJS - A progressive Node.js ...
Nest is a framework for building efficient, scalable Node.js server-side applications. It uses progressive JavaScript, is built with TypeScript and combines elements of OOP (Object Oriented Programming), FP (Functional Programming), and FRP (Functional Reactive Programming).
๐ŸŒ
Leapcell
leapcell.io โ€บ blog โ€บ choosing-your-node-js-backend-framework-express-fastify-or-nestjs
Choosing Your Node.js Backend Framework Express Fastify or NestJS | Leapcell
September 29, 2025 - It aims to provide the best possible ... serialization to optimize request handling. Fastify is more opinionated than Express in how it handles request/response cycles due to its focus on speed....
๐ŸŒ
DEV Community
dev.to โ€บ expressots โ€บ expressots-vs-nest-vs-expressjs-vs-fastify-benchmark-5d17
ExpressoTS vs Nest vs Expressjs vs Fastify (Benchmark) - DEV Community
September 1, 2023 - Our dev team has been grinding to make ExpressoTS as efficient as possible, and this Benchmark report showcases that dedication. Definitely worth a read! Don't just skim through itโ€”make sure to check out the conclusion. It's not about saying X is better than Y; it's about understanding why we stand where we do in the TypeScript ecosystem. ... Thanks for this comparison @rsaz , This is show that Fastify and express are best, so why developers should move to ExpressoTS
๐ŸŒ
Scalable Backend
blog.scalablebackend.com โ€บ performance-testing-express-fastify-and-nestjs-with-expressfastify
Performance Testing Express, Fastify, and NestJS (With Express/Fastify)
July 6, 2024 - For Express, it starts to fail around 2 minutes, which corresponds to 5 virtual users on our configuration. For Fastify, it starts to fail 1 minute later, when we have 6 virtual users. Interestingly enough, the results are exactly the same for NestJS with Express and NestJS with Fastify.
Find elsewhere
๐ŸŒ
Medium
medium.com โ€บ deno-the-complete-reference โ€บ nestjs-express-vs-fastify-performance-comparison-for-jwt-verify-and-mysql-query-d94637bc8a3e
NestJS Express vs Fastify: Performance comparison for JWT verify and MySQL query | Tech Tonic
June 29, 2023 - This article compares default NestJS (Express) & NestJS (Fastify) for this use-case. For the hello world case, NestJS over Fastify was about 3โ€“4 times faster than default NestJS (Express). However, that was a hello world case.
๐ŸŒ
StackShare
stackshare.io โ€บ stackups โ€บ fastify-vs-nestjs
Fastify vs NestJS | What are the differences? | StackShare
It achieves this by leveraging ... the other hand, NestJS, being built on top of Express, provides a more familiar development experience but lacks the same level of performance optimizations as Fastify....
๐ŸŒ
YouTube
youtube.com โ€บ watch
Performance testing ExpressJS vs Fastify vs NestJS (with Express & Fastify) - YouTube
What's the most performant option: ExpressJS vs Fastify vs NestJS (based on Express) vs NestJS (based on Fastify).# ResourcesArtillery.io scripts: https://gi...
Published ย  February 15, 2023
Top answer
1 of 1
1

This question will be closed soon because it is not a programming question, and the answer is that it depends.

I've considered using Nest.js (which can incorporate either Fastify or Express) but is this needed?

No, to use Fastify you don't need Nest.js.

Is this generally a bad decision?

Do you know Nest.js? If the answer is yes: go for it if you like it. If the answer is no, you will need to learn Nest first, and then you need to learn Fastify if you want to use its features.

Is using Fastify or Express by themselves considered bad practice?

No, I have tons apps in prod in pure Fastify way. The covid APP backend of many nations was in pure Fastify: https://github.com/covidgreen/covid-green-backend-api

Of course, you must know that:

  • More layers and frameworks
  • = more things to know
  • = more things that can go wrong
  • = less control of what you can do

Would an overlying framework like Nest.js provide considerably more than either of these alone?

First, I don't like Nest.js because:

  • it pins the fastify dependency so you can get fixes until nest will release a new version
  • nobody is using fastify+nestjs in a good way because there are tons of unanswered questions on SO
  • if you need help, you can't ask to the fastify team. They tell you to ask to the nest team: https://github.com/fastify/help/issues/883

The only pro I see on using Nest.js is that it forces you and your team to write the same code structure and you can't go off those rails.

Meanwhile using pure fastify you can do what you want and your codebase could become a mess (I wrote a book about it, check my profile).

๐ŸŒ
DEV Community
dev.to โ€บ samchon โ€บ i-made-express-faster-than-fastify-4h8g
I made Express faster than Fastify (100x faster JSON, also NestJS) - DEV Community
April 5, 2023 - Measuring benchmark of those servers through autocannon (another library what fastify team had built), I could get awesome result. express became faster than fastify in some cases, just by utilizing typia.stringify() function. ... You know what? NestJS is utilizing class-validator and class-transformer.
Top answer
1 of 1
292

UPDATE - 17.03.2020

We are now running benchmarks for every new PR. One of the latest benchmarks can be found here: https://github.com/nestjs/nest/runs/11029354661

               Req/sec  Trans/sec
Nest-Express    15370   3.17MB  
Nest-Fastify    30001   4.38MB  
Express         17208   3.53MB  
Fastify         33578   4.87MB      

That means Nest + FastifyAdapter is now almost 2 times faster than express.

UPDATE - 22.09.2018

Benchmarks directory has been added to the repository: https://github.com/nestjs/nest/blob/master/benchmarks/all_output.txt (you can run benchmarks on your machine as well).

UPDATE - 24.06.2018

Nest v5.0.0 supports fastify. Fastify + Nest integration is even more performant than plain(!) express.


The following list shows what Nest is doing in comparison to plain express route handler:

  • it surrounds your route handler body with try..catch blocks
  • it makes every route handler async
  • it creates a global express router
  • it creates a separated router for each controller
  • it binds error-handling middleware
  • it binds body-parser middleware (both json and extended urlencoded)

All of the mentioned things reflect a real-world example (probably 99.9% express apps have to do this as well, it's unavoidable). It means that if you want to compare Express and Nest performance, you should at least cover above points. The comparison with the example below:

app.get('/', (req, res, next) => res.status(200).send('Hello world'));

Is unfair in this case, because it's not enough. When I cover these points, this is what I received (express 4.16.2):

Running 10s test @ http://localhost:3000
1024 connections

Stat         Avg    Stdev   Max
Latency (ms) 225.67 109.97  762
Req/Sec      4560   1034.78 5335
Bytes/Sec    990 kB 226 kB  1.18 MB

46k requests in 10s, 9.8 MB read

Additionally, Nest has to:

  • recognize whether a result is a Promise/Observable/plain value
  • based on the result type, use send() or json() (+1 condition)
  • add 3 conditions (if statements) to check pipes, interceptors and guards

There's an output for Nest (4.5.8):

Running 10s test @ http://localhost:3000
1024 connections

Stat         Avg    Stdev   Max
Latency (ms) 297.79 55.5    593
Req/Sec      3433.2 367.84  3649
Bytes/Sec    740 kB 81.9 kB 819 kB

34k requests in 10s, 7.41 MB read

This implies that Nest performance is around 79% express (-21%). This is due to the reasons set out above, and moreover, because Nest is compatible with Node 6.11.x which means that it can't use async/await under the hood - it has to use generators.

Which conclusion is to be drawn based on those stats? None, because we aren't used to creating applications that only returns plain strings without any asynchronous stuff. The comparisons with Hello world means nothing, it's only a titbit :)

PS. I used autocannon library https://github.com/mcollina/autocannon

autocannon -c 1024 -t30 http://localhost:3000

๐ŸŒ
Better Stack
betterstack.com โ€บ community โ€บ guides โ€บ scaling-nodejs โ€บ fastify-express
Express.js vs Fastify: An In-Depth Framework Comparison | Better Stack Community
It remains widely used, but its ... largely unchanged. Fastify offers a different approach, focusing on efficiency, built-in validation, and structured plugins while keeping a familiar developer experience....
๐ŸŒ
GitHub
github.com โ€บ nestjs โ€บ nest โ€บ issues โ€บ 12927
perf: Proposal - Should we evaluate to use Fastify by default instead of Express? ยท Issue #12927 ยท nestjs/nest
December 17, 2023 - I know that Nest already supports Fastify, but since the default is Express, I assume a big portion of the people approaching Nest for the first time is using the default option. I found this interesting article regarding the difference in performances: https://medium.com/deno-the-complete-reference/nestjs...
Published ย  Dec 17, 2023
๐ŸŒ
Evgeniistuditskikh
evgeniistuditskikh.com โ€บ home โ€บ code โ€บ nestjs vs. fastify: which one is better for high-performance apis?
NestJS vs. Fastify: Which One is Better for High-Performance APIs? - Evgenii Studitskikh's Tech Blog
February 26, 2025 - NestJS: Steeper learning curve due to TypeScript, decorators, and dependency injection. However, Angular developers will feel at home. The payoff is a structured, maintainable codebase.