Skip to content

NodeJS Workspace Type

The NodeJS workspace type provides a runtime environment for JavaScript/TypeScript applications including Next.js, Nuxt, Express, and headless frontend projects.

Unlike PHP workspaces where the web server invokes PHP-FPM directly, the NodeJS web server acts as a reverse proxy — it forwards incoming HTTP traffic to the port where your Node application is listening. Your application is responsible for handling requests and sending responses; the web server simply routes traffic to it.

When you SSH into a NodeJS workspace, the following tools and paths are pre-configured:

Terminal window
# Check versions
node -v
npm -v
# Run a script
node app.js
# Install dependencies
npm install
# Run package scripts
npm run dev
npm run build
npm start

Alternative package managers are supported. If your project uses one, the workspace will auto-detect it from your lock file and install it if needed:

Terminal window
yarn install
pnpm install
bun install

Run packages without installing them globally:

Terminal window
npx create-next-app@latest
npx prisma migrate dev

Beyond Node.js and package managers, the following tools are available out of the box:

ToolCommandPurpose
PM2pm2Process manager (see below)
YarnyarnPackage manager
AWS CLIawsAWS service management
Kiro CLIkiroAI-assisted development
MySQL clientmysqlDatabase access
PostgreSQL clientpsqlDatabase access
MongoDB ShellmongoshMongoDB access
GitgitVersion control
jqjqJSON processing
rsyncrsyncFile synchronization
Terminal window
cd /home/web/html
# Development server
npm run dev
# Production build
npm run build
npm start
# Lint
npm run lint
Terminal window
cd /home/web/html
# Development
npm run dev
# Build and preview
npm run build
npm run preview
# Generate static site
npm run generate
Terminal window
cd /home/web/html
# Start server
node server.js
# Or with npm script
npm start
# Development with auto-reload (if configured)
npm run dev

NodeJS workspaces use PM2 as the process manager. PM2 runs your application, restarts it on crash, and persists process state across workspace restarts.

When the workspace environment starts, the following sequence runs automatically:

  1. Check for a start command — If no start command is configured in the Ordin admin, the startup script exits and no app is launched. You can still SSH in and run things manually.

  2. Check for the project directory — The app is expected to live in /home/web/project. If this directory doesn’t exist, startup is skipped.

  3. Resurrect saved processes — If PM2 has a saved process list from a previous session (~/.pm2/dump.pm2), it restores those processes. If the saved start command matches the current configuration, the app is considered already running and no further action is taken.

  4. Detect and install the package manager — If package.json exists, the workspace determines which package manager to use (see below) and installs it globally if it’s not already available.

  5. Install dependencies — Runs <package-manager> install in the project directory.

  6. Start the application — PM2 launches the app using the configured start command, registers it under the name app, and saves the process list for future restarts.

If you change the start command in the Ordin admin, PM2 detects the mismatch on next startup, removes the old process, and re-launches with the new command.

The start command and PM2 enablement are configured through the Ordin Workspace Manager admin — you don’t set these yourself.

During startup, the workspace automatically detects which package manager to use for install, in this order of priority:

  1. Explicit configuration — if set in the Ordin admin
  2. Lock file detectionyarn.lock → yarn, pnpm-lock.yaml → pnpm, bun.lockb/bun.lock → bun
  3. Default — npm

If the detected package manager isn’t already installed, it will be installed globally via npm before running install.

Terminal window
# View running processes
pm2 list
# View application logs
pm2 logs
pm2 logs app
# Restart your application
pm2 restart app
# Stop your application
pm2 stop app
# Delete a process from PM2
pm2 delete app
# Monitor CPU/memory in real time
pm2 monit
# Save current process list (persists across restarts)
pm2 save

Ordin automatically injects environment variables into the workspace to pass configuration values to your application. These are set by the platform based on your workspace and project settings — you don’t manage them directly.

Commonly used variables:

VariableExampleDescription
WORKSPACE_DOMAIN_1myapp.project.ordinlabs.ioPrimary workspace URL
WORKSPACE_DB_HOSTdbDatabase hostname
WORKSPACE_DB_NAMEworkspace_abcDatabase name
WORKSPACE_DB_USERrootDatabase user
WORKSPACE_DB_PASSWORD(set automatically)Database password
WORKSPACE_NAMEmyappWorkspace subdomain
PORT3000Port your app should listen on

Your application code can reference these to connect to services without hardcoding values. See Workspace Config Templates for the full list.

Terminal window
curl -H "Host: $WORKSPACE_DOMAIN_1" http://localhost
Terminal window
# MySQL
mysql -h db -u root -p $WORKSPACE_DB_NAME
# Or from your app via environment variables
DATABASE_URL="mysql://$WORKSPACE_DB_USER:$WORKSPACE_DB_PASSWORD@$WORKSPACE_DB_HOST/$WORKSPACE_DB_NAME"
Terminal window
# PM2 application logs
pm2 logs
# Web server proxy logs
tail -f /var/log/nginx/error.log
/home/web/
├── html/ # Web root (application code)
│ ├── package.json
│ ├── node_modules/
│ └── ...
├── .bashrc # Personal shell config
└── .workspacerc # Workspace-specific config
/shared/ # Shared across project workspaces
├── .profile # Project-wide shell profile
├── .bashrc # Project-wide bash config
├── bin/ # Shared scripts (in $PATH)
└── startup.d/ # Scripts run on environment start