Skip to content

Quick Start — Node.js

Deploy a Node.js app from git push to a live HTTPS URL in 5 minutes.

Prerequisites

  • A Node.js project (package.json + a start script)
  • Node.js 20+ on your machine (node --version)
  • The paas CLI:
    curl -fsSL https://get.di2amp.com/install.sh | sh
    paas --version
    

If you don't already have a Node.js project, scaffold one:

mkdir hello-paas && cd hello-paas
npm init -y
cat > server.js <<'EOF'
const http = require('http');
const port = process.env.PORT || 3000;
http.createServer((_, res) => {
  res.writeHead(200, { 'Content-Type': 'text/plain' });
  res.end('Hello from PaaS Runtime!\n');
}).listen(port, () => console.log(`listening on :${port}`));
EOF
npm pkg set scripts.start="node server.js"
git init && git add -A && git commit -m "init"

Step 1 — Authenticate

paas login

This opens your browser for SSO (Keycloak). Once authenticated, the token is stored in ~/.config/paas/credentials.toml.

Verify:

$ paas whoami
octave@paas.local (member of: paas-default)

Step 2 — Create the app

paas apps create hello-paas

Output:

✓ Created app hello-paas
  URL:    https://hello-paas.runtime.di2amp.com
  Region: eu-fr-1
  Plan:   free
  Git:    https://git.di2amp.com/octave/hello-paas.git

The paas apps create command:

  1. Provisions a Kubernetes namespace (paas-apps, label paas-tenant-id=...)
  2. Creates a Forgejo repo under your org
  3. Adds it as a paas git remote in your local repo

Verify:

$ git remote -v
paas    https://git.di2amp.com/octave/hello-paas.git (fetch)
paas    https://git.di2amp.com/octave/hello-paas.git (push)

Step 3 — Add a Procfile

PaaS uses Buildpacks (Paketo) to build images automatically. You only need a Procfile to declare process types:

# Procfile
web: npm start

Commit it:

git add Procfile && git commit -m "add Procfile"

Step 4 — Push to deploy

git push paas main

You'll see live build logs:

remote: ─────── PaaS Build ───────
remote: → Detected: nodejs (paketo-buildpacks/nodejs)
remote: → Installing Node.js 20.10.0
remote: → Running: npm ci --omit=dev
remote: → Running: npm rebuild
remote: → Image:    registry.di2amp.com/octave/hello-paas:abc1234
remote: → SBOM:     ✓ generated, 47 packages
remote: → CVE scan: ✓ 0 critical, 0 high
remote:
remote: ─────── PaaS Deploy ───────
remote: → Process types: web
remote: → Replicas:      1/1 ready
remote: → Rollout:       v1 → v2 (canary 10% → 100%)
remote: → Health:        / returns 200 OK
remote: → URL:           https://hello-paas.runtime.di2amp.com
remote:
remote: ✓ Deployed in 47s

Step 5 — Verify the app is live

$ curl https://hello-paas.runtime.di2amp.com/
Hello from PaaS Runtime!

The dashboard shows runtime status:

https://ma30.di2amp.com/runtime/dashboard/apps/hello-paas

Next steps

Add a managed PostgreSQL

paas addons create database --type postgres --plan free --name db

The connection string is exposed automatically as DATABASE_URL:

const { Pool } = require('pg');
const pool = new Pool({ connectionString: process.env.DATABASE_URL });

Tail logs

paas logs --tail

Add a custom domain

paas domains add www.example.com

PaaS automatically issues a Let's Encrypt certificate via cert-manager.

Scale to multiple replicas

paas ps:scale web=3

See also