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
- Rotate every secret that has ever been in a committed
.env. - Set
WALLET_ENCRYPTION_SECRETexplicitly rather than relying on the fallback. - Decide whether
REAL_TRADING_ENABLEDstartsfalse— it usually should. - Confirm the house wallet holds enough ETH for gas on Robinhood Chain.
- Restrict CORS. The backend currently allows all origins.
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
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)
| Host | Serves |
|---|---|
www.agex.zone / agex.zone | Landing (landing/ as site root) |
docs.agex.zone | Docs (docs/ as site root) |
www.app.agex.zone / app.agex.zone | Desk + 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
| Check | How |
|---|---|
| API is up | GET /api/health returns status: ok |
| Sockets connect | The desk's live indicator turns on and events arrive |
| Wallet connect works | Connecting creates or fetches a profile |
| Trading state is intentional | GET /api/real-trading/status shows the config you expect |
| Secrets are absent from responses | No wallet_private_key anywhere in /api/agents |