Skip to content

Quickstart: Deploy an Express.js App

This guide explains how to deploy an Express.js application to seenode.

Get started in seconds by deploying our pre-configured Express.js template. This example is ready to deploy and reflects the structure discussed in this guide.

Follow these steps to prepare and deploy your Express.js project.

  1. Prepare Your Project for Production

    Your project structure should be ready for deployment.

    Project Structure

    A minimal Express.js project contains a main.js entry point and a package.json file.

    • Directoryyour-express-project/
      • main.js // The application entry point
      • package.json

    Dependencies

    Make sure your package.json lists express as a dependency.

    package.json
    {
    "name": "example-nodejs-express",
    "version": "1.0.0",
    "main": "main.js",
    "scripts": {
    "start": "node main.js"
    },
    "dependencies": {
    "express": "^4.18.2"
    }
    }

    Run

    npm install
    to create your package-lock.json file.

    Application Code

    Your main.js file should create an Express server that listens on a port defined by an environment variable. This allows seenode to correctly route traffic to your application.

    main.js
    const express = require('express');
    const app = express();
    const port = process.env.PORT || 3000;
    app.get('/', (req, res) => {
    res.send('Hello World\\nWelcome to Seenode!');
    });
    app.listen(port, () => {
    console.log(`Example app listening on port ${port}`);
    });
  2. Deploy on seenode

    Follow these steps to deploy your Express.js application:

    1. First, create a new Web Service from the seenode Dashboard and connect your Express.js project’s Git repository.
    2. Configure your build and start commands. seenode will attempt to detect these automatically.
      • Build Command:
        npm install
      • Start Command:
        node main.js
    3. In the Environment tab, set a PORT variable (e.g., 8080). seenode does not automatically assign one.
    4. Choose your preferred instance size and create your service.
    5. Watch your deployment progress in real-time through the Logs tab.
    6. Once complete, your Express.js application will be accessible via your service’s URL.

Now that your Express.js application is deployed, here are some things you might want to do next: