Express → Fastify
medium2x faster throughput, built-in validation with JSON Schema, TypeScript-first. Plugin system > middleware chain.
npm install fastify @fastify/cors @fastify/helmet && npm uninstall express
Replace app = express() with Fastify({ logger: true }). Register plugins instead of app.use().
import Fastify from 'fastify'
const app = Fastify({ logger: true })app.get('/path', (req, res) => ...) → app.get('/path', async (request, reply) => ...). Note: reply not res.
Replace express-validator/joi with JSON Schema on route level. Fastify validates automatically.
body-parser → built-in. cors → @fastify/cors. helmet → @fastify/helmet. multer → @fastify/multipart.
What this migration involves
Moving from Express to Fastify is rated medium and takes about 4-12h on a typical project. The guide breaks it into 6 steps, 2 of which ship with runnable commands and 1 with a verification check. On pricing, Express is open-source and Fastify is open-source with a free plan to test the move.
Related migrations
FAQ
How long does migrating from Express to Fastify take?
Around 4-12h for a typical project — 6 steps, difficulty rated medium, 2 of them with copy-paste commands.
Is moving from Express to Fastify reversible?
No reverse guide is tracked yet, so treat this as a one-way move and keep a full export of your Express data before you start.
What does Fastify cost compared to Express?
Express: open-source from $0/mo, free plan available. Fastify: open-source from $0/mo, free plan available.