u/alangomes_

▲ 21 r/nestjs

I built a Vite plugin that lets you run NestJS through Vite. Native ESM, plugin ecosystem, and Swagger metadata out of the box

Hey everyone! I just published vite-plugin-nestjs: a Vite plugin that replaces the NestJS CLI as your dev/build tool.

Why?

The NestJS CLI uses its own compiler pipeline (ts-jest, SWC, etc.), which means you're locked out of the Vite plugin ecosystem. I wanted to use Vite plugins in a NestJS project and couldn't find a clean way to do it, so I built one.

What it does:

  • Runs your NestJS app through Vite's dev server, your controllers are available at localhost:5173 with full Vite support
  • Gives you access to the entire Vite plugin ecosystem in your backend project
  • Automatically detects @nestjs/swagger in your nest-cli.json and generates Swagger metadata before any request is handled, no manual step required
  • vite build bundles your Nest app as an SSR Node.js module you can run with node dist/main.js
  • npm: https://www.npmjs.com/package/vite-plugin-nestjs
  • GitHub: https://github.com/Alan-Gomes/vite-plugin-nestjs

Would love feedback, bug reports, or ideas. Happy to answer any questions!

reddit.com
u/alangomes_ — 5 days ago