How to Deploy a Node.js App to Vercel
Ilyas Abdisalam

Ilyas Abdisalam @ilyasgaraad

About: Computer Engineer and Technical Writer

Joined:
Jun 16, 2025

How to Deploy a Node.js App to Vercel

Publish Date: Jun 16
1 1

This tutorial will show you how to deploy a simple Node.js (Express) app to Vercel. It’s perfect for beginners who want to get their API online fast — without worrying about infrastructure.


🧰 Prerequisites

Before you start, make sure you have the following installed:

  • ✅ Node.js and npm on your system
  • ✅ Git installed
  • GitHub account
  • ✅ Basic knowledge of JavaScript and Node.js

🛠️ Step 1: Create a Simple Node.js App

Open your terminal and run the following commands:

mkdir my-app
cd my-app
npm init -y
npm install express
Enter fullscreen mode Exit fullscreen mode

This creates a new folder, initializes a Node.js project, and installs Express.js.

📝 Step 2: Create index.js

Inside your project folder, create a file called index.js and add the following code:

const express = require('express');
const app = express();

app.get('/', (req, res) => {
  res.send('Hello, Vercel!');
});

app.listen(3000, () => {
  console.log('Server is running on http://localhost:3000');
});
Enter fullscreen mode Exit fullscreen mode

This sets up a basic Express server that responds with "Hello, Vercel!".

🧪 Step 3: Test the App Locally

Run the app locally to make sure everything works:

node index.js
Enter fullscreen mode Exit fullscreen mode

Visit http://localhost:3000 in your browser — you should see:

Hello, Vercel!

🚀 Step 4: Prepare for Deployment

  1. Create a .gitignore file and ignore node_modules:
echo node_modules > .gitignore
Enter fullscreen mode Exit fullscreen mode
  1. Initialize a git repository and push it to GitHub:
git init
git add .
git commit -m "Initial commit"
git branch -M main
git remote add origin https://github.com/YOUR_USERNAME/YOUR_REPO_NAME.git
git push -u origin main
Enter fullscreen mode Exit fullscreen mode

🌐 Step 5: Deploy to Vercel

  1. Go to https://vercel.com and sign in with your GitHub account.
  2. Click "New Project".
  3. Import your repository.
  4. Leave all settings as default and click "Deploy".

Wait a few moments… and voilà! Your Node.js app is live ✨

✅ Conclusion

You’ve just built and deployed a Node.js app to the web using Express and Vercel. From here, you can:

  • Build APIs and connect to databases
  • Add frontend frameworks like React or Vue

Comments 1 total

  • Admin
    AdminJun 16, 2025

    Hey authors! If you’ve ever published on Dev.to, you may be eligible for a limited-time token giveaway. Head over here. no gas fees. – Dev.to Airdrop Desk

Add comment