What is the difference between Fastify and Express?

Why Interviewers Ask This

This is a differentiating question used for senior and lead roles. Interviewers want to see if you can explain not just what happens, but why — and what the trade-offs are in different approaches.

Answer

Express and Fastify are both Node.js web frameworks but with different design philosophies. Express (2010): minimal, widely adopted, huge ecosystem, synchronous middleware model, no built-in schema validation, no built-in serialization — it's the "safe" choice with the most tutorials, plugins, and community support. Fastify (2016): designed for performance from the ground up. Key differences: (1) Performance: Fastify is 2-4x faster than Express in benchmarks — it uses fast-json-stringify for serialization and find-my-way for routing; (2) Schema validation: Fastify has first-class JSON Schema support for request validation and response serialization (faster + safer); (3) Async/await: Fastify natively supports async route handlers without the wrapper pattern Express requires; (4) Plugins: Fastify uses an encapsulated plugin system with fastify-plugin for dependency scoping; (5) TypeScript: Fastify has excellent TypeScript support out of the box; (6) Error handling: more consistent async error propagation. Choose Express for familiarity/ecosystem; choose Fastify for performance-critical services or greenfield projects.

Pro Tip

If you're unsure about a detail, say so honestly and explain your reasoning. Interviewers respect candidates who can think through uncertainty rather than bluffing.