tl;dr; polka is the lightest Node HTTP server package.

Highly unscientific but nevertheless worth writing down. Lightest here refers to the eventual weight added to the node_modules directory which is a reflection of network and disk use.

When you write a serious web server in Node you probably don't care about which one is lightest. It's probably more important which ones are actively maintained, reliable, well documented, and generally "more familiar". However, I was interested in setting up a little Node HTTP server for the benefit of wrapping some HTTP endpoints for an integration test suite.

The test

In a fresh new directory, right after having run: yarn init -y run the yarn add ... and see how big the node_modules directory becomes afterward (du -sh node_modules).

The results

  1. polka: 116K
  2. koa: 1.7M
  3. express: 2.4M
  4. fastify: 8.0M

bar chart

Conclusion

polka is the lightest. But I'm not so sure it matters. But it could if this has to be installed a lot. For example, in CI where you run that yarn install a lot. Then it might save quite a bit of electricity for the planet.

Comments

Your email will never ever be published.

Previous:
The best and simplest way to parse an RSS feed in Node February 13, 2021 Node, JavaScript
Next:
How MDN's site-search works February 26, 2021 Python, Web development, Django, MDN, Elasticsearch
Related by category:
Always run biome migrate after upgrading biome August 16, 2025 JavaScript, Node
gg2 - a new CLI for helping me manage git branches August 6, 2025 JavaScript
gg shell completion August 13, 2025 JavaScript
Switching from Next.js to Vite + wouter July 28, 2023 JavaScript, Node
Related by keyword:
Hello-world server in Bun vs Fastify September 9, 2023 Node, JavaScript, Bun
Make your NextJS site 10-100x faster with Express caching February 18, 2022 Node, Nginx, React, JavaScript
How post JSON with curl to an Express app April 15, 2020 Node, JavaScript