Skip to content

Self-Hosting

Amplify is designed to be self-hosted by default. This page covers all deployment methods, reverse proxy configuration, and SSL requirements.

Docker deployment

Amplify's docker-compose.yaml defines three profiles for different deployment scenarios.

  • Dockerfile multi-stage build

    The Dockerfile uses four stages:

    StageBasePurpose
    buildnode:22-bookworm-slimInstall deps, build Remix app (--max-old-space-size=4096)
    prod-depsinherits from buildpnpm prune --prod --ignore-scripts
    amplify-ai-productioninherits from prod-depsFinal runtime; installs curl for healthcheck; EXPOSE 5173
    developmentinherits from buildDev runtime with source mount support

    Healthcheck: curl -fsS http://localhost:5173/ — interval 10s, timeout 3s, start-period 5s, retries 5

    Start command: pnpm run dockerstartbindings=$(./bindings.sh) && wrangler pages dev ./build/client $bindings --ip 0.0.0.0 --port 5173

Cloudflare Pages deployment

Deploy Amplify to Cloudflare Pages for edge-hosted execution.

Step 1: Build

sh
pnpm run build

Creates build/client/ and build/server/.

Step 2: Deploy

sh
pnpm run deploy
# or manually:
wrangler pages deploy ./build/client

Step 3: Set secrets

sh
wrangler pages secret put OPENAI_API_KEY
wrangler pages secret put ANTHROPIC_API_KEY

Step 4: Set config

sh
wrangler pages config set DEFAULT_NUM_CTX=32768

Step 5: Add COEP/COOP headers (REQUIRED for WebContainers)

Create a _headers file in build/client/:

/*
  Cross-Origin-Embedder-Policy: credentialless
  Cross-Origin-Opener-Policy: same-origin
Worker size limits

Cloudflare Pages functions have size limits:

  • Free tier: 1MB worker size
  • Paid tier: 10MB worker size

The wrangler.toml config: name = "amplify", compatibility_flags = ["nodejs_compat"], compatibility_date = "2025-03-28", pages_build_output_dir = "./build/client"

Coolify deployment

Deploy Amplify via Coolify (self-hosted platform alternative):

  1. Create new application in Coolify
  2. Set Dockerfile path and build target (amplify-ai-production)
  3. Pass VITE_PUBLIC_APP_URL as build argument
  4. Configure environment variables for API keys
  5. Deploy via Coolify's Docker builder

Electron desktop app

For a native desktop experience, use the Electron build.

Configuration (electron-builder.yml):

  • appId: com.amplify.dev, productName: Amplify
  • Mac: DMG target, hardenedRuntime, category: developer-tools
  • Win: NSIS installer with custom installation directory
  • Linux: AppImage + deb targets
  • Auto-updater via setupAutoUpdater()

Build commands:

sh
pnpm run electron:dev        # Dev mode with Vite HMR
pnpm run electron:build:dist # Full distribution build (macOS, Windows, Linux)

Electron main process (electron/main/index.ts):

  • Creates BrowserWindow with Remix request handler
  • Cookie management (initCookies, storeCookies)
  • Vite server for dev mode
  • App path root configurable via VITE_APP_PATH_ROOT

Native deployment

Deploy Amplify on bare metal (Linux/macOS):

Requirements:

  • Node.js 18.18.0+, pnpm, 4GB+ RAM
  • Reverse proxy (nginx or Caddy)

Build and start:

sh
NODE_OPTIONS=--max-old-space-size=4096 pnpm run build
pnpm run start:unix

start:unix command: bindings=$(./bindings.sh) && wrangler pages dev ./build/client $bindings

Process management options:

  • systemd — Create a service unit for production reliability
  • PM2 — pm2 start "pnpm run start:unix"
  • Docker Compose — Use the production profile

Reverse proxy configuration

A reverse proxy is required for production deployments to handle SSL, COEP/COOP headers, and SSE streaming.

Required headers (for WebContainers):

Cross-Origin-Embedder-Policy: credentialless
Cross-Origin-Opener-Policy: same-origin
SSL is required

WebContainers require HTTPS because:

  • SharedArrayBuffer (needed for WebAssembly) requires a secure context
  • COEP/COOP headers only work with HTTPS
  • Most modern browser APIs require HTTPS

Options: Let's Encrypt (Certbot/Caddy), Cloudflare SSL, or commercial certificates.

Memory recommendations

ComponentMinimumRecommended
Node.js heap4GB8GB (--max-old-space-size=8192)
Server RAM4GB8GB+
CPU cores12+
Disk1GB5GB+ (for builds)

Learn about migration options