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.
| Part | Where | Why there |
|---|---|---|
| Database | Neon (or any Postgres) | The engine writes it, the API reads it |
| Engine | Render (or any Docker host) | It must run 24/7 |
| Site, app and API | Vercel | One 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)
- Create a project and a database. Region: US East, the closest to Hyperliquid.
- Copy two connection strings:
- the direct one (no
-poolerin the host), for the engine; - the pooled one (host contains
-pooler), for Vercel.
- the direct one (no
No tables to create: the engine creates them on its first start.
2. Engine (Render)
- In Render: New → Blueprint, pick the repository.
render.yamlcreates a web service calledmotion-engine: Node, plan Starter, region Virginia, buildcd engine && npm ci && npm run build, startcd engine && npm start, health check/health, auto-deploy on. - Set
DATABASE_URLto 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). - 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. - Check
https://<your-engine>.onrender.com/health:
{ "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:
docker build -f engine/Dockerfile -t motion-engine .
docker run -e DATABASE_URL="postgres://…" -p 8080:8080 motion-engineIt needs one port (8080) and outbound internet. Health check path: /health.
3. Site, app and API (Vercel)
- Add New → Project, import the repository. Framework Next.js, root directory = the repository root.
- Environment variables:
| Variable | Value |
|---|---|
DATABASE_URL | the pooled Neon string |
ADMIN_TOKEN | openssl rand -hex 24. Keep it secret: it controls the kill switch |
- Deploy.
- Set the site's real address in
lib/site.ts(url) and redeploy. It is used for link previews and search engines.
4. Check
| Open | You should see |
|---|---|
/ | The landing page |
/api/v1/status | "database": true and "engine": { "online": true, "mode": "paper", … } |
/app | The vault with numbers, Engine live in the footer, a Paper badge |
/app/markets | A 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
- Set
MOTION_TOKENto the token's address on both Render and Vercel, with the same value, and redeploy both. - 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
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:3000Tip
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:
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)