Express → Fastify migration

    Convert your Express app to Fastify automatically.

    Refactyl analyzes your existing Express routes, middleware, and error handling, then generates a Fastify-based, TypeScript-friendly version with clean diffs and zero breaking changes.

    Free tier: preview Express → Fastify migrations for up to 1,000 lines / 25 files before upgrading.

    Why migrate from Express to Fastify?

    Express has been the default Node.js web framework for over a decade—but many teams now hit its limits around performance, type safety, and maintainability. Fastify keeps the simplicity of Express while giving you significantly better throughput and a modern plugin ecosystem.

    Refactyl automates this migration so you don't have to manually touch every route, middleware chain, and config file. You keep your app's behaviour, but gain performance and a cleaner, TypeScript-ready codebase.

    • Performance boost: move from standard Express to Fastify's 3–4× higher HTTP throughput for many workloads.
    • TypeScript-ready code: generate handlers and types designed for strong typing from day one.
    • Easier future maintenance: fewer custom helpers, less boilerplate, and clearer boundaries between routes, schemas, and plugins.
    Before
    const express = require("express");
    const app = express();
    
    app.get("/health", (req, res) => {
      try {
        const status = checkDbAndCache();
        res.json({ ok: true, status });
      } catch (err) {
        console.error(err);
        res.status(500).json({ ok: false });
      }
    });
    
    app.listen(3000, () => {
      console.log("Server listening on :3000");
    });
    After
    import Fastify from "fastify";
    
    const app = Fastify({ logger: true });
    
    app.get("/health", async () => {
      const status = await checkDbAndCache();
      return { ok: true, status };
    });
    
    app.listen({ port: 3000 }, (err, address) => {
      if (err) {
        app.log.error(err);
        process.exit(1);
      }
      app.log.info(`Server listening on ${address}`);
    });

    What Refactyl migrates for you

    The Express → Fastify migration focuses on production-critical code paths. Refactyl understands:

    • Routes: converts route handlers, parameters, and response shapes to Fastify's API.
    • Middleware: maps common Express middleware patterns to Fastify hooks and plugins where possible.
    • Error handling: preserves your error responses while using Fastify's error flow.
    • Config & startup: cleans up listen/start logic, logging, and env handling.

    What isn't fully supported yet

    Being honest about limitations builds trust. Today, the Express → Fastify migration doesn't automatically handle:

    • Highly custom Express middleware that depends on internal request object quirks.
    • Exotic server setups (clustered processes, custom HTTP servers, etc.).
    • Deeply coupled legacy code that mixes routing, business logic, and data access in one file.

    Refactyl will still flag these areas for manual review with clear comments in the diff.

    Will my app break?

    The goal is simple: migrate safely, then let you review before shipping.

    • Refactyl preserves your existing route structure and response shapes.
    • All changes are visible as a structured diff before you download.
    • You can run your existing test suite or add smoke tests on the migrated branch before deploying.

    How the Express → Fastify migration flow works

    1. Upload or connect

    Connect a GitHub repo or upload a ZIP of your Express project.

    Free tier supports up to 1,000 lines / 25 files for preview.

    2. AI-powered refactor

    Refactyl maps Express routes, middleware, and error handling to Fastify equivalents.

    You can watch a live, scrollable diff view while the migration runs.

    3. Preview, then download

    Review the diff inside Refactyl. When you're happy, download the migrated Fastify project.

    Downloads are gated behind sign-in so you can keep migrations tied to your account.

    Typical migrations complete in minutes, not days.
    Watch the progress bar, diff, and logs update in real time.

    Built by a backend dev who got tired of manual refactors

    Refactyl started as a weekend script to migrate a real-world Express monolith to something faster and easier to maintain. After doing the same migration three times for different projects, it became obvious this should be a product.

    The philosophy is simple: don't just convert syntax. Preserve behaviour, make the codebase feel modern, and keep developers in control with clear diffs and safe fallbacks.

    If you're an early user, your feedback directly shapes which Express patterns and edge cases Refactyl supports next.

    FAQ: What happens to my existing middleware?

    Common middleware like authentication, logging, and parsing are mapped to Fastify-compatible equivalents or hooks. For very custom middleware, Refactyl leaves clear TODOs and comments so you can decide how to adapt them.

    The goal is to avoid "magic" rewrites that hide behaviour changes.

    FAQ: How does TypeScript conversion work?

    Refactyl can emit TypeScript-first handlers and helpers, generating types for route parameters, query strings, and responses where it's safe to infer them. You still own the final type definitions and can refine them after the migration.

    Ready to see your Express app on Fastify?

    Run a free migration preview in minutes. No credit card required—just connect a repo or upload a ZIP.

    Start free Express migration