Deploying Node.js applications

3 min read Updated 20 hours ago

Node.js on Ploi Cloud

Ploi Cloud provides comprehensive support for Node.js applications, from simple Express APIs to complex Next.js applications. Deploy your Node.js apps with confidence using our optimized container infrastructure.

Supported frameworks

Ploi Cloud supports any Node.js framework or application, including:

  • Express.js - Fast, unopinionated web framework
  • Next.js - Full-stack React framework
  • Nuxt.js - Vue.js framework
  • Nest.js - Progressive Node.js framework
  • Fastify - High-performance web framework
  • Static site generators - Gatsby, VitePress, Docusaurus
  • Build tools - Vite, Webpack, Parcel
  • Custom Node.js applications - Any application that runs on port 3000

Deployment modes

Node.js applications can be deployed in two modes:

Runtime mode (with start command)

Your application runs as a Node.js server on port 3000. Perfect for:

  • APIs and backend services
  • Server-side rendered applications
  • Real-time applications with WebSockets
  • Applications requiring server-side logic

Static mode (without start command)

Your built files are served by Nginx on port 8080. Ideal for:

  • Single-page applications (SPAs)
  • Pre-built static sites
  • Generated documentation
  • Client-side only applications

Start command configuration

The start command determines how your application runs:

Common start commands:

  • npm run start - Default, uses the start script from package.json
  • node server.js - Direct Node.js execution
  • node dist/index.js - For TypeScript applications
  • npx next start - Next.js production server
  • yarn start - Using Yarn package manager

Leave the start command empty for static file serving.

Automatic configuration

When you create a Node.js application, Ploi Cloud automatically:

  • Sets Node.js version 22 as default
  • Configures build commands for your application
  • Sets the default start command to npm run start
  • Installs both npm and yarn package managers
  • Configures the correct port based on your deployment mode

Build commands

Build commands run during the deployment process:

npm ci
npm run build

You can customize these in the Build Configuration section. Common patterns:

  • npm: npm ci && npm run build
  • yarn: yarn install --frozen-lockfile && yarn build

Database connections

Add database services to your Node.js application:

  1. Navigate to your application's Services tab
  2. Click "Add service" and select your database type
  3. Connection details are automatically injected as environment variables

Worker services

Run background jobs or long-running processes:

  1. Add a Worker service in your application
  2. Set the command (e.g., node worker.js)
  3. Workers share the same code and storage volumes