Deploy Node.js (Express) Projects in Seconds

Deploy your Node.js and Express.js APIs with zero-config on Flyway. Guide to Node.js deployment, Express port errors, and TypeScript build steps.

Deploy Node.js (Express) Projects in Seconds

How to deploy Node.js? Deploying the Node.js and Express.js ecosystem, which is the backbone of modern web APIs, can sometimes require complex server configurations. But with Flyway, Express.js hosting and deployment processes are completely automated.

Unlike platforms such as Heroku, Railway, or Vercel, Flyway analyzes your project via GitHub, compiles it in seconds with a zero-config principle, and takes it live with SSL in a completely isolated environment that belongs to you. Moreover, you don't need to write complex Procfile or Dockerfile.

Read Time: 7 Minutes
Environment: Node.js (TypeScript)
Recommended DB: PostgreSQL, Redis

1. Prerequisites

Before taking your project live on Flyway, make sure you meet the following requirements:

  • ✅ Your project must be hosted on a GitHub, GitLab, or Bitbucket repository.
  • ✅ A valid package.json file must be present in the root directory of your project.
  • ✅ You must have logged into your Flyway account and completed the GitHub integration.

2. Specifying Node.js Version (Engines)

One of the most common errors encountered in production is the mismatch between the local Node.js version and the server version. Flyway uses the current LTS version (e.g., Node 20.x) by default. However, if your project requires a specific Node version, you can specify this in the engines field in your package.json file.

package.json (Example Node 18 Specification)
{
  "name": "my-api",
  "engines": {
    "node": "18.x" // Flyway will use the image suitable for this version
  }
}

3. Start Script and TypeScript Build Steps

Flyway triggers the start and build scripts in your package.json file directly to boot up your Node.js project. Tools like nodemon or ts-node-dev that you use in your development environment should not be used in production.

For Standard JavaScript Projects

package.json
"scripts": {
  "start": "node index.js", // Flyway starts the project with this command
  "dev": "nodemon index.js"
}

For TypeScript Projects (Important)

Today, most new Express projects are written with TypeScript. Since your TypeScript code cannot run directly on the server (it causes performance loss), it needs to be compiled (build) first. If Flyway sees a build script in your repository, it will automatically run it.

package.json (TypeScript Setup)
"scripts": {
  "build": "tsc", // 1. Flyway does the compilation (build) first
  "start": "node dist/index.js", // 2. Flyway runs the compiled JS file
  "dev": "ts-node-dev src/index.ts"
}

4. Port Listening Rules (Crucial)

The biggest reason Node.js projects crash on PaaS systems is incorrect port listening configurations. Flyway (and modern cloud platforms) assigns your app a random dynamic port and routes traffic to it.

Incorrect Usage (Hardcoded Port)

You must not bind your app to a static port (e.g., 3000) or just localhost (127.0.0.1). This will disconnect your app from the outside world.

app.listen(3000); // DOES NOT WORK on Flyway!
Correct Usage (Dynamic Port)

Your app must read the process.env.PORT variable and listen to the 0.0.0.0 host address.

const port = process.env.PORT || 3000;
const host = '0.0.0.0';

app.listen(port, host, () => {
  console.log(`Server running on ${host}:${port}`);
});

5. Environment Variables (.env) Management

You should never write sensitive data such as database passwords, API keys, or JWT secret keys used by your application directly into your code (hardcoded) or in your .env file on GitHub. You can safely add all this data from the "Environment Variables" tab in the Flyway panel.

Manage your environment variables easily via the Flyway panel.
Manage your environment variables easily via the Flyway panel.

6. Log Viewing and Debugging (Crash Loop)

Sometimes your project might successfully deploy but constantly restart (Crash Loop). The only way to understand what the error is when your Node.js application crashes is to read the logs.

  • Go to your Flyway project control panel.
  • Click on the Logs tab from the top menu.
  • Monitor your application's console.log() and error outputs in Real-time. You can instantly spot database connection errors or missing module errors here.

7. Troubleshooting & FAQ

Frequently Asked Questions

How to deploy Node.js?

Just create a "New Project" on Flyway and select your GitHub repository. Flyway detects that your project is Node.js, installs dependencies, and takes it live including SSL.

Troubleshooting Table (Errors and Solutions)

Web process failed to bind to $PORT
Possible Cause: Your app is listening on a static port (e.g. 3000).
Solution: Update your code to app.listen(process.env.PORT || 3000, '0.0.0.0').
Missing start script
Possible Cause: There is no "start" command in package.json.
Solution: Add "start": "node index.js" to the "scripts" block.
Cannot find module 'express'
Possible Cause: The package was installed in devDependencies.
Solution: Move the module to the dependencies block and commit again.

Related Articles

You're All Set! 🚀

After these configurations, just push your project. Flyway compiles your app in seconds and takes it live on your Custom Domain.

Last updated on July 20, 2026
Edit this page on GitHub