express-to-nestjs-migrator

Installation
SKILL.md

Express → NestJS Migrator

Phase 1 — THINK

Middleware order is the single biggest source of subtle bugs in this migration — Nest's guards/interceptors/pipes execute in a different conceptual model than Express middleware chains. Before planning anything:

  • Map every Express middleware currently registered, in the exact order it runs, including per-route middleware, not just app-level app.use()
  • Identify what each middleware actually does: auth check, logging, body parsing, error handling, CORS — because each maps to a different Nest concept (guard, interceptor, pipe, exception filter, or module-level config)
  • Find any middleware that mutates req/res and is depended on by later middleware or route handlers — this state-passing pattern doesn't translate directly to Nest's DI model and needs a redesign, not a 1:1 port
  • Check for raw app.get/post/put/delete route definitions vs. any router-based structure already in place — this tells you how much restructuring is ahead

Phase 2 — PLAN

Show the user, before any code changes:

  1. Proposed module breakdown (which routes become which Nest modules/controllers)
  2. Explicit middleware → Nest concept mapping table (e.g. "auth middleware → AuthGuard", "error handler → global ExceptionFilter", "request logger → LoggingInterceptor")
  3. Which middleware has ordering dependencies that need special handling (Nest guards/interceptors have defined execution order — call out anywhere the current Express order doesn't map cleanly)
  4. Whether this is an incremental migration (Nest wrapping the existing Express app during transition) or a full rewrite — recommend incremental for anything already in production
Installs
4
Repository
theamitv/skills
First Seen
Aug 1, 2026