Stop Using Express.js in 2023
- 2 min read
What’s wrong with Express?
1. It’s Unmaintained
Express hasn’t seen any major updates or new features in years, with its website last being updated in 2017.
2. It’s Slow
3. It doesn’t work well with TypeScript
Express wasn’t designed with TypeScript in mind and requires a separate types package to work with it. Despite this, you will still encounter lots of
Alternatives to Express
Fastify is a modern alternative to Express. It’s significantly faster and has a vast ecosystem of plugins. It shares a similar syntax with Express, so most of your Express knowledge will still apply to Fastify. With
@fastify/express package, you can even use any express middleware module with fastify. Fastify is the most similar to express out of these alternatives, and It’s the easiest to switch to. Use Fastify instead of Express for your next API to get instant performance and DX improvements.
Hono is a simple and minimal web framework that is even faster than Fastify. Although it lacks many of plugins, it can still handle most use cases. The primary selling point of Hono is that it can be used with runtimes other than Node.js, like Deno, Bun, or Cloudflare Edge Workers. Using Hono with these runtimes can make it even faster, cheaper and easier to host.
If you’re building an API solely to consume it in a TypeScript client application (such as a React app), consider using tRPC. With this library, you can declare a function on your backend, and after a simple setup, call it on the frontend. tRPC automatically infers the input and return types of the function, resulting in TypeScript error messages and IntelliSense.