Back to Tutorials
Backend Deployment
25 min read
Sahasransu Satpathy
4/20/2026
Deploy Backend API on Heroku / Vercel
Step-by-step guide to deploy your Node.js backend API on Heroku and Vercel
Introduction
Deploying your backend API allows your applications to be accessible online. This guide covers deployment on Heroku and Vercel for Node.js applications.
Step 1: Prepare Your Project
- Ensure your Node.js project has a
package.jsonand main entry file (index.jsorserver.js). - Use environment variables for secrets and database URIs.
npm init -y
npm install express dotenv
- Create a Procfile for Heroku:
web: node index.js
Step 2: Push Project to GitHub
- Initialize git if not already done:
git init
git add .
git commit -m "Initial commit"
- Push to a new GitHub repository:
git remote add origin https://github.com/username/your-backend-api.git
git push -u origin main
Step 3: Deploy on Heroku
- Install Heroku CLI:
npm install -g heroku
- Login and create a new Heroku app:
heroku login
heroku create your-app-name
- Push your code to Heroku:
git push heroku main
- Set environment variables on Heroku:
heroku config:set MONGO_URI="your_mongo_connection_string"
heroku config:set JWT_SECRET="your_secret_key"
- Open your app:
heroku open
Step 4: Deploy on Vercel
- Install Vercel CLI:
npm i -g vercel
- Login and deploy:
vercel login
vercel
- During deployment:
- Select your project folder.
- Set the Node.js environment.
- Add environment variables in Vercel dashboard.
- Once deployed, your API endpoint will be live with a Vercel URL.
Step 5: Testing Your API
- Use Postman or Insomnia to send requests to your live API.
- Verify all endpoints work as expected.
Step 6: Best Practices
- Use environment variables for sensitive data.
- Enable CORS if frontend is on a different domain.
- Monitor logs with
heroku logs --tailor Vercel dashboard. - Keep dependencies updated and secure.
Conclusion
By following this tutorial, your backend API is now live and accessible globally. You can integrate it with frontend applications or other services.
SEO Suggestions:
- Main keywords: Deploy Node.js API, Heroku deployment tutorial, Vercel backend deployment, live Node.js server
- Meta description: Learn how to deploy your Node.js backend API on Heroku and Vercel. Step-by-step guide for beginners with environment setup and testing.
- Catchy title suggestions: "Deploy Your Node.js API on Heroku & Vercel – Step-by-Step 2026", "Live Backend Deployment Guide for Node.js Projects"
Previous Tutorial
Browse All TutorialsNext Tutorial
Browse All Tutorials