shahriyar.dev
Back to blog
expressverceldeploymentnodejshostingweb-development

From Localhost to Production: Your Complete Node.js Express Deployment Checklist

·3 min read

If you're building an Express app with Node.js and want to make it accessible to the internet, you've come to the right place. Hosting a Node.js application might seem complex, but with platforms like Vercel, the process is surprisingly straightforward — if you follow a few key steps. This guide walks you through the entire process, from preparing your project to deploying it live.

Project Preparation

Before you begin, make sure you have a working Express application using Node.js. However, there is an important caveat: Vercel does not support file uploads to the server's filesystem. If your application uses packages like multer to upload files to a local directory, those features will not work on Vercel.

Instead, you must use cloud-based storage solutions like Amazon S3, Google Cloud Storage, or similar services. Rewrite any file upload logic to store files externally before proceeding with deployment.

Configuration with vercel.json

Vercel requires a configuration file named vercel.json placed in the root directory of your project. This file tells Vercel how to build and route your application. Here is a basic configuration to get started:

json
{
  "version": 2,
  "builds": [
    {
      "src": "index.js",
      "use": "@vercel/node"
    }
  ],
  "routes": [
    {
      "src": "/(.*)",
      "dest": "index.js"
    }
  ]
}

What does this configuration do?

  • "version": 2 — Specifies the latest configuration format.
  • "builds" — Tells Vercel that your entry point is index.js and to use the Node.js builder.
  • "routes" — Ensures all incoming requests are directed to index.js for processing.

You can learn more about all available options in the official Vercel configuration documentation. For most Express apps, the above setup is enough to get started.

Deploying Your Project

Once your configuration is in place, open a terminal in your project directory and install the Vercel CLI if you haven't already:

npm install -g vercel
# or
yarn global add vercel

After installation, initialize Vercel in your project by running the vercel command:

$ vercel
Vercel CLI 31.4.0
? Set up and deploy “~/Development/Phero/react/brand-shop-backend”? [Y/n]

Press Enter to confirm setup.

? Which scope do you want to deploy to?
● yourName

This shows a list of available teams or profiles. Select the one you want and press Enter.

? Link to existing project? [y/N]

This asks if you want to link to an existing project on Vercel. The default answer is No, so just press Enter.

? What’s your project’s name? (brand-shop-backend)

A suggested name appears based on your folder. You can change it or press Enter to accept.

? In which directory is your code located? ./

If your index.js file is in the current directory, press Enter. If you are using TypeScript and your compiled output is in a folder like ./dist or ./build, type that path instead.

After answering all prompts, Vercel will create a project on your dashboard and provide a production URL in the terminal. Your Express app is now live.

Updating Your Deployment

When you make changes to your code later, updating your deployed project is simple. Just run the following command in your terminal:

vercel --prod

This command pushes your latest code to production, overwriting the previous deployment. No need to repeat the entire setup process — Vercel remembers your configuration.

Thank you so much for reading this blog. Now you're ready to deploy your Express app on Vercel with confidence.

Comments