Skip to content

Deploy Vue with Express server on seenode

This guide explains how to deploy an existing Vue single-page application (SPA) served by a minimal Node server (using Express for static + SPA fallback) to seenode.

Before you begin, ensure you have:

  • A seenode account at cloud.seenode.com
  • Git configured on your machine
  • An existing Vue project ready to build (Vite)

To deploy your Vue SPA on seenode, you need a simple Express server to serve your built static files. This server handles SPA routing by returning index.html for all routes.

First, install Express in your project root:

Terminal window
npm install express

Create a server.js file at your project root to serve your built Vue app:

server.js
const express = require("express");
const path = require("path");
const app = express();
const PORT = 8080; // * Match the Port field in seenode
const BUILD_DIR = path.join(__dirname, "client", "dist"); // * Vite Vue output
// * Serve static assets from the build output
app.use(express.static(BUILD_DIR));
// * SPA fallback: always return index.html
app.get("*", (req, res) => {
res.sendFile(path.join(BUILD_DIR, "index.html"));
});
app.listen(PORT, "0.0.0.0", () => {
console.log(`Server running on http://0.0.0.0:${PORT}`);
});

This server serves your built Vue app and handles client-side routing by returning index.html for all routes.

Set the port in server.js to match the Port field you’ll configure in seenode (for example, 8080). On seenode, there is no default container port—traffic is routed to whatever value you set in the Port field.

For more background on how the Port field controls routing on seenode, see Configuring Your Application’s Port.

Add these scripts to your root package.json:

package.json
{
"scripts": {
"client:install": "cd client && npm install",
"client:build": "cd client && npm run build",
"start": "node server.js"
},
"dependencies": {
"express": "^4.19.2"
}
}
  • Directory/your-vue-spa-app
    • server.js # Express static server + SPA fallback
    • package.json # Root scripts and Express dependency
    • Directoryclient/ # Vue app (Vite)
      • index.html
      • package.json
      • vite.config.js
      • Directorysrc/
        • main.js
        • App.vue
        • style.css
  1. Push to Git

    Commit your project and push it to GitHub or GitLab.

  2. Create a Web Service

    From the seenode Dashboard, create a new Web Service and connect your repository.

  3. Configure Build & Start

    seenode attempts to detect these automatically. Configure:

    • Build Command:
      npm install && npm run client:install && npm run client:build
    • Start Command:
      node server.js

    Set the Port field to 8080 (or your chosen value) and ensure server.js listens on the same port.

  4. Configure Environment Variables

    Add any additional variables your app needs. You do not need to add a PORT environment variable.

  5. Deploy

    Click Create Web Service and watch logs until your web service is live.

  6. Success

    Your Vue SPA is now accessible via your service’s URL.

If you don’t have a Vue project yet:

Option 1: Use our Template (Recommended)

Option 2: Create from Vue Docs + seenode Setup

Follow the official Vue documentation and Vite documentation to create a new project, then follow the Project Configuration steps above to set up the Express server.

Now that your Vue SPA is deployed, here are some things you might want to do next: