Operations

Deployment

Put Motion online in about 30 minutes: database, engine, then site, app and API.

Three things to create, in this order. Nothing on this page can move money: the engine is deployed in paper mode.

PartWhereWhy there
DatabaseNeon (or any Postgres)The engine writes it, the API reads it
EngineRender (or any Docker host)It must run 24/7
Site, app and APIVercelOne Next.js project, the repository root

You need accounts on Neon, Render (a paid instance: free ones go to sleep and a sleeping engine quotes nothing) and Vercel, with access to the repository. Node 22 or newer to run it locally.

1. Database (Neon)

  1. Create a project and a database. Region: US East, the closest to Hyperliquid.
  2. Copy two connection strings:
    • the direct one (no -pooler in the host), for the engine;
    • the pooled one (host contains -pooler), for Vercel.

No tables to create: the engine creates them on its first start.

2. Engine (Render)

  1. In Render: New → Blueprint, pick the repository. render.yaml creates a web service called motion-engine: Node, plan Starter, region Virginia, build cd engine && npm ci && npm run build, start cd engine && npm start, health check /health, auto-deploy on.
  2. Set DATABASE_URL to the direct string. Leave every other prompted variable empty (MOTION_TOKEN, STANDIN_TOKEN, CONFIRM_LIVE, OPERATOR_KEY, HL_ACCOUNT, HL_AGENT_KEY, SWAP_ADAPTER_ADDRESS, NAV_REPORTER_ADDRESS).
  3. Deploy. The blueprint already sets EXECUTION_MODE=paper, PAPER_CAPITAL_USD=25000, HEDGE_RATIO=0.5, MAX_DRAWDOWN_BPS=1000, LOG_FORMAT=json, NODE_VERSION=22.
  4. Check https://<your-engine>.onrender.com/health:
json
{ "ok": true, "mode": "paper", "uptimeSec": 42, "killSwitch": false }

Without Render

The engine is also a Docker image (Node 22, two-stage build, runs as node). From the repository root:

bash
docker build -f engine/Dockerfile -t motion-engine .
docker run -e DATABASE_URL="postgres://…" -p 8080:8080 motion-engine

It needs one port (8080) and outbound internet. Health check path: /health.

3. Site, app and API (Vercel)

  1. Add New → Project, import the repository. Framework Next.js, root directory = the repository root.
  2. Environment variables:
VariableValue
DATABASE_URLthe pooled Neon string
ADMIN_TOKENopenssl rand -hex 24. Keep it secret: it controls the kill switch
  1. Deploy.
  2. Set the site's real address in lib/site.ts (url) and redeploy. It is used for link previews and search engines.

4. Check

OpenYou should see
/The landing page
/api/v1/status"database": true and "engine": { "online": true, "mode": "paper", … }
/appThe vault with numbers, Engine live in the footer, a Paper badge
/app/marketsA live chart and order book; the vault's quotes appear within a minute or two

The engine starts with a pretend treasury of $25,000 and saves a snapshot every minute, so charts fill in as it runs.

When MOTION launches

  1. Set MOTION_TOKEN to the token's address on both Render and Vercel, with the same value, and redeploy both.
  2. The contract admin calls FeeSplitter.setPoolId(poolId) once, on chain.

The app then switches from the stand-in pool to MOTION by itself.

Running it locally

bash
npm install && (cd engine && npm install)
cp .env.example .env.local           # DATABASE_URL (and ADMIN_TOKEN for the kill switch)
cp engine/.env.example engine/.env   # the same DATABASE_URL
npm run engine:dev                   # engine on http://localhost:8080
npm run dev                          # site, app and API on http://localhost:3000

Tip

Remove the empty lines from engine/.env (like HL_ACCOUNT=) or fill them in: the engine's config check rejects empty address and key values.

Checks before deploying a change:

bash
npm run typecheck && npm run lint && npm run build   # site, app and API
cd engine && npm test && npm run typecheck           # 19 tests
cd contracts && npm test                             # 31 tests (+ npm run fork-check)