Docs Reference

Deployment

Three artefacts to deploy: a long-lived Node process, a static React bundle and a static landing page. The database is already hosted by Supabase.

Before you deploy

App process

The API is a stateful Node process: it owns the Socket.io server, both schedulers, and (after npm run build) the React desk from dist/. It must be a long-running instance rather than a serverless function.

npm ci
npm run build
NODE_ENV=production node server.js

Under a process manager:

pm2 start server.js --name agex --time
pm2 save
pm2 startup
Run exactly one instance The trading engines run on in-process timers. A second replica would execute every cycle twice and double the real spend.

Behind nginx, WebSocket upgrade headers must be forwarded on the app host:

location / {
  proxy_pass http://127.0.0.1:5000;
  proxy_http_version 1.1;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection "upgrade";
  proxy_set_header Host $host;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header X-Forwarded-Proto $scheme;
}

Production hosts (subdomains)

HostServes
www.agex.zone / agex.zoneLanding (landing/ as site root)
docs.agex.zoneDocs (docs/ as site root)
www.app.agex.zone / app.agex.zoneDesk + API + Socket.io (proxy to Node :5000)

DNS A records for each name point at the VPS. Issue one cert covering all names, then rebuild the desk so deep links and nav match the hosts.

Same-origin desk

Production builds leave VITE_API_URL empty (see .env.production) so the desk on www.app.agex.zone calls /api and Socket.io on the same host. The landing page calls the API at https://www.app.agex.zone for live stats.

Build-time desk variables:

VITE_API_URL=
VITE_SUPABASE_URL=https://your-project.supabase.co
VITE_SUPABASE_ANON_KEY=…
VITE_WALLETCONNECT_PROJECT_ID=…

Landing page

landing/ is a single HTML file with its image assets and no build step. In production Nginx serves it at www.agex.zone. Locally you can still open landing/index.html or visit /landing on the API process.

Docs

This site is also static — plain HTML plus assets/docs.css, assets/icons.js and assets/docs.js. In production Nginx serves docs/ at docs.agex.zone.

Post-deploy checklist

CheckHow
API is upGET /api/health returns status: ok
Sockets connectThe desk's live indicator turns on and events arrive
Wallet connect worksConnecting creates or fetches a profile
Trading state is intentionalGET /api/real-trading/status shows the config you expect
Secrets are absent from responsesNo wallet_private_key anywhere in /api/agents