LeafhavenDocs
System Architecture

Coolify v4 Production Deployment Guide

Step-by-step production deployment guide for B2BExpo by YPYM (@tradeos/web) to Coolify under the subdomain b2bexpo.ypym.app.

B2BExpo Production Deployment Guide (Coolify v4)

This guide provides exact configuration steps to deploy the B2BExpo by YPYM web application (@tradeos/web) to your Coolify VPS instance under the target subdomain https://b2bexpo.ypym.app.


1. Architecture & Multi-Pack Compatibility

B2BExpo is structured as a high-performance pnpm monorepo managed with Turborepo. The web application (apps/web) depends on internal workspace packages (@tradeos/types, @tradeos/commerce-core, @tradeos/trade-compliance, etc.).

To ensure deterministic, zero-failure deployment in Coolify v4, the repository provides multi-strategy support:

StrategyStatusConfig FileDescription
Dockerfile (Recommended)First ClassDockerfileMulti-stage Alpine container with explicit corepack pnpm v10.33.0, building @tradeos/web...
RailpackSupportedpackage.jsonUses root scripts build and start tailored for @tradeos/web
NixpacksSupportednixpacks.tomlDeclares Node.js 20, corepack pnpm activation, and frozen-lockfile build

2. DNS Record Setup (Cloudflare / Namecheap / DNS Provider)

Before or immediately after deploying, configure the DNS A-Record for your custom domain:

TypeName / HostTarget / ValueProxy StatusTTL
Ab2bexpo<YOUR_SERVER_IP>DNS Only (or Proxied)Auto / 300s

Note: Replace <YOUR_SERVER_IP> with the public IP address of your Coolify server shown in your Coolify dashboard under Infrastructure > Servers.


3. Coolify UI Configuration Steps

Following your screen in Coolify (YPYM Dev / YPYM Venture / production):

Step A: Initial Repository & Build Configuration

On the New Resource screen:

  1. Repository: maarif88/ypym-venture
  2. Branch: main
  3. Build pack: Select Dockerfile (or leave as Railpack)
  4. Output type: Web application
  5. Port: 3000
  6. Base directory: /
  7. Click the purple Continue button.

Step B: General Settings & Domain (FQDN)

Once the application is created:

  1. Navigate to the General tab.
  2. In the Domains field, input:
    https://b2bexpo.ypym.app
  3. Coolify's built-in Traefik reverse proxy will automatically acquire a valid Let's Encrypt SSL Certificate once the DNS A record resolves to your server.

In the Environment Variables tab:

NODE_ENV=production
PORT=3000
HOSTNAME=0.0.0.0
DATA_DIR=/app/data
TWENTY_CRM_API_URL=https://crm.ypym.app/rest
TWENTY_CRM_API_KEY=your_production_twenty_api_key_here

Step D: Persistent Volume (Preserve Database Across Redeploys)

To ensure user accounts, registrations, invites, and trade transactions persist across container redeployments:

  1. Go to the Storages tab in your application settings.
  2. Add a new Persistent Storage:
    • Source Path (Host): ypym-b2bexpo-data (or /var/lib/coolify/volumes/tradeos-data)
    • Destination Path (Container): /app/data
  3. Click Save.

Step E: Trigger Deployment

  1. Click the Deploy button in the top right corner.
  2. View real-time build logs. Turborepo will compile all 45 routes and output:
    ✓ Compiled successfully
    ✓ Generating static pages (45/45)
    Listening on port 3000
  3. Open https://b2bexpo.ypym.app to verify live production.

4. Verification Checklist

  • Domain resolves to Coolify server IP: nslookup b2bexpo.ypym.app
  • HTTPS padlock is green and valid (Let's Encrypt)
  • Navigation and auth routes (/auth/login, /auth/register, /auth/invite) function cleanly
  • Exporter registration creates atomic store entry
  • Seller team management (/seller#team) invites and displays memberships
  • Deal room and Escrow simulator (/deal-room/DR-2026-9041) responds smoothly