NestJS on Vercel
NestJS is a progressive Node.js framework for building efficient, reliable and scalable server-side applications. You can deploy a NestJS app to Vercel with zero configuration using Vercel Functions.
NestJS applications on Vercel benefit from:
- Fluid compute: Pay for the CPU you use, automatic cold start reduction, optimized concurrency, background processing, and more
- Preview deployments: Test your changes in a copy of your production infrastructure
- Instant Rollback: Recover from breaking changes or bugs in milliseconds
- Vercel Firewall: Protect your applications from a wide range of threats with a robust, multi-layered security system
- Secure Compute: Create private links between your Vercel-hosted backend and other clouds
You can quickly deploy a NestJS application to Vercel by creating a NestJS app or using an existing one:
To allow Vercel to deploy your NestJS application and process web requests, your server entrypoint file should be named one of the following:
src/main.{js,mjs,cjs,ts,cts,mts}
src/app.{js,mjs,cjs,ts,cts,mts}
src/index.{js,mjs,cjs,ts,cts,mts}
src/server.{js,mjs,cjs,ts,cts,mts}
app.{js,mjs,cjs,ts,cts,mts}
index.{js,mjs,cjs,ts,cts,mts}
server.{js,mjs,cjs,ts,cts,mts}
For example, use the following code as an entrypointt:
Use vercel dev
to run your application locally
vercel dev
To deploy, connect your Git repository or use Vercel CLI:
vc deploy
When you deploy a NestJS app to Vercel, your NestJS application becomes a single Vercel Function and uses Fluid compute by default. This means your NestJS app will automatically scale up and down based on traffic.
All Vercel Functions limitations apply to the NestJS application, including the size of the application being limited to 250MB.
Learn more about deploying NestJS projects on Vercel with the following resources:
Was this helpful?