DEV Community

Cover image for How to Deploy a Node.js App to Vercel
Ilyas Abdisalam
Ilyas Abdisalam

Posted on

1

How to Deploy a Node.js App to Vercel

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

Warp.dev image

The best coding agent. Backed by benchmarks.

Warp outperforms every other coding agent on the market, and gives you full control over which model you use. Get started now for free, or upgrade and unlock 2.5x AI credits on Warp's paid plans.

Download Warp

Top comments (0)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.

Feature flag article image

Create a feature flag in your IDE in 5 minutes with LaunchDarkly’s MCP server 🏁

How to create, evaluate, and modify flags from within your IDE or AI client using natural language with LaunchDarkly's new MCP server. Follow along with this tutorial for step by step instructions.

Read full post

👋 Kindness is contagious

Dive into this thoughtful piece, beloved in the supportive DEV Community. Coders of every background are invited to share and elevate our collective know-how.

A sincere "thank you" can brighten someone's day—leave your appreciation below!

On DEV, sharing knowledge smooths our journey and tightens our community bonds. Enjoyed this? A quick thank you to the author is hugely appreciated.

Okay