DEV Community

Cover image for Deploy a node server to Vercel!
Dev Sharma
Dev Sharma

Posted on • Originally published at blog.devsharma.live

Deploy a node server to Vercel!

Vercel 😏

Vercel, the creator of Next js. But isn't that where you are supposed to host your frontend applications.
Yes, but not just that!
We can host a node backend applications on Vercel. Vercel essentially allows running a server on Vercel.

Deploying to Vercel

Create a free account on Vercel. (Preferably, use a provider where the repository for code is hosted)

Add a vercel.json file in the root folder.

{
  "version": 2,
  "name": "name-of-your-vercel-app",
  "builds": [
    { "src": "script.js", "use": "@vercel/node" }
  ],
  "routes": [
    { "src": "/(.*)", "dest": "/index.js" }
  ]
}

Enter fullscreen mode Exit fullscreen mode

Now create a new projecton Vercel.

image.png
When setting up the repository, we need to select the Other option in Frameworks to deploy a backend server. You can also configure Environment variables at this stage.

image.png
And that's it you have deployed your server blazing fast 🚀.

If you are a developer enjoying Vercel to deploy your front-end applications, you will definitely love Vercel for hosting your backend node applications.

What's your go-to way for deploying a node server? 🙌🏻

Source repo: mongo-CRUD-basics
Deployed app: https://mongoose-crud.vercel.app/
Feel free to reach out to me on Twitter and connect with me on LinkedIn

Top comments (1)

Collapse
 
ikeeptrying profile image
Dre

What did you use for front end? How does that work with Vercel?