Skip to content
Docs
 

Express on Vercel

Express is a fast, unopinionated, minimalist web framework for Node.js. You can deploy an Express app to Vercel with zero configuration.

Express applications on Vercel benefit from:

  • Fluid compute: Active CPU billing, automatic cold start prevention, optimized concurrency, background processing, and more
  • Preview deployments: Test your changes on a copy of your production infrastructure
  • Instant Rollback: Recover from unintended changes or bugs in milliseconds
  • Vercel Firewall: Protect your applications from a wide range of threats with a multi-layered security system
  • Secure Compute: Create private links between your Vercel-hosted backend and other clouds

You can quickly deploy an Express application to Vercel by creating an Express app or using an existing one:

Get started by initializing a new Express project using Vercel CLI init command:

terminal
vc init express

This will clone the Express example repository in a directory called express.

To run an Express application on Vercel, create a file that imports the express package at any one of the following locations:

  • app.{js,cjs,mjs,ts,cts,mts}
  • index.{js,cjs,mjs,ts,cts,mts}
  • server.{js,cjs,mjs,ts,cts,mts}
  • src/app.{js,cjs,mjs,ts,cts,mts}
  • src/index.{js,cjs,mjs,ts,cts,mts}
  • src/server.{js,mjs,cjs,ts,cts,mts}

The file must also export the application as a default export of the module or use a port listener.

For example, use the following code that exports your Express app:

src/index.js
// Use "type: commonjs" in package.json to use CommonJS modules
const express = require('express');
const app = express();
 
// Define your routes
app.get('/', (req, res) => {
  res.json({ message: 'Hello from Express on Vercel!' });
});
 
// Export the Express app
module.exports = app;
src/index.ts
// Use "type: module" in package.json to use ES modules
import express from 'express';
const app = express();
 
// Define your routes
app.get('/', (req, res) => {
  res.json({ message: 'Hello from Express on Vercel!' });
});
 
// Export the Express app
export default app;

You may also run your application using the app.listen pattern that exposes the server on a port.

src/index.js
// Use "type: commonjs" in package.json to use CommonJS modules
const express = require('express');
const app = express();
const port = 3000;
 
// Define your routes
app.get('/', (req, res) => {
  res.json({ message: 'Hello from Express on Vercel!' });
});
 
app.listen(port, () => {
  console.log(`Example app listening on port ${port}`);
});
src/index.ts
// Use "type: module" in package.json to use ES modules
import express from 'express';
const app = express();
const port = 3000;
 
// Define your routes
app.get('/', (req, res) => {
  res.json({ message: 'Hello from Express on Vercel!' });
});
 
app.listen(port, () => {
  console.log(`Example app listening on port ${port}`);
});

Use vercel dev to run your application locally

terminal
vercel dev
Minimum CLI version required: 47.0.5

To deploy, connect your Git repository or use Vercel CLI:

terminal
vc deploy
Minimum CLI version required: 47.0.5

To deploy your Express app without an account or login, run this command in the project root:

terminal
vercel deploy --temporary

The CLI builds the project, deploys it to production, and prints a claim URL. Claim the project to keep it live. See Deploying without logging in.

To serve static assets, place them in the public/** directory. They will be served as a part of our CDN using default headers unless otherwise specified in vercel.json.

express.static() will be ignored and will not serve static assets.

When you deploy an Express app to Vercel, your Express application becomes a single Vercel Function and uses Fluid compute by default. This means your Express app will automatically scale up and down based on traffic.

Use res.write() to send response chunks and res.end() to finish the response. See the Express streaming example for a route running on Vercel.

Use Cron Jobs to call an Express route on a schedule. Configure the route and schedule, then check the request's Authorization header against your CRON_SECRET environment variable before running the task. See the Express cron job example.

Use Vercel Passport to require sign-in through your company's identity provider before requests reach your Express app. Passport requires an Enterprise plan. Follow the Express Passport guide to verify visitor identity and authorize access within your app.

Use Runtime Logs to inspect application output and errors, and Observability to investigate request duration and failures. See monitoring Express with Observability for details.

Additionally, all Vercel Functions limitations apply to the Express application, including:

  • Application size: The Express application becomes a single bundle, which has a standard bundle size limit of 250MB. Large Functions support Node.js bundles up to 5GB on Fluid compute when enabled (public beta). Our bundling process removes all unneeded files from the deployment's bundle to reduce size, but does not perform application bundling (e.g., Webpack or Rollup).
  • Error handling: Express.js will swallow errors that can put the main function into an undefined state unless properly handled. Express.js will render its own error pages (500), which prevents Vercel from discarding the function and resetting its state. Implement robust error handling to ensure errors are properly managed and do not interfere with the serverless function's lifecycle.

Learn more about deploying Express projects on Vercel with the following resources:

Last updated November 14, 2026

Was this helpful?

supported.