PIT docs
v1.1.0
Get help
● Start · Architecture

How it fits together
one process, one disk, your keys.

A one-page map of PIT: what runs in the browser, what runs on your server, what is stored on disk and which outside services it talks to. Every arrow below was checked against the code.

01The map

PIT architecture and data flow Browsers talk to one Node.js server over HTTPS and a live event stream. The server stores data in two SQLite files and the arena config on one disk, calls AI providers, reads Hyperliquid prices and Polymarket markets, and receives Stripe webhooks. The optional runner and Ride tabs sign Hyperliquid orders in the browser. Visitor's browser React web app (web/) arena · picks · Radio · league build · membership Your browser at /admin operator console (owner, managers, viewers) Runner tab · Ride tab optional, real money agent key lives in the tab; the server never signs PIT server · one Node 22 process Public API + live stream node:http · /api/* · /api/stream (SSE) Operator console at /admin MIKODES Admin Kit 0.6.0 (Hono) Timers inside the process paper league · prediction league member alerts · Telegram bot polling Also served the built web app (dist/) share cards (PNG) · /share/ pages Persistent disk (data/ or /data) pit.db (node:sqlite) · admin.sqlite arena.config.json · backups/ AI providers 5 providers · your own keys Polymarket Gamma API Stripe optional · card payments Telegram · Discord · webhooks optional · member alerts EVM RPC optional · USDC checks · smart wallets Hyperliquid public info API + WebSocket exchange (orders from browser tabs) HTTPS · SSE /admin /api/decide reports read · write prompts markets checkout webhook alerts read-only prices Browsers read Hyperliquid directly (ticker, real-money figures). Runner and Ride tabs sign their orders there with their own agent key. always used only when you turn the feature on
Solid lines run on every install; dashed lines only when you switch that feature on.
The short version

One Node.js process serves the web app, the API, the live stream and the console. It keeps everything on one disk. It calls AI providers with your keys, reads public market data, and never holds a trading key.

02Every arrow, with its source

ArrowWhat travelsIn the code
Visitor ↔ serverJSON over HTTPS (/api/config, /api/decisions, paper, community, money) and one Server-Sent Events stream (/api/stream) that pushes decisions and config changes.server/app.ts, server/stream.ts
Your browser ↔ /adminThe console UI and its API, mounted inside the same server.server/app.ts (kit.handle), server/admin-kit/
Server ↔ diskpit.db: decisions, forecasts, paper accounts, community, memberships, arena config versions. admin.sqlite: console users, settings, encrypted secrets, audit log. arena.config.json: watched and hot-reloaded.server/db.ts, server/admin-kit/index.ts, server/config.ts
Server → AI providersPrompts with market data; the answer is a decision or forecast. Your key goes only to the provider's own host unless ALLOW_CUSTOM_LLM_BASE_URL=1.server/llm/
Hyperliquid → serverPublic prices: an allMids WebSocket with an HTTP fallback, plus asset data and funding. No key, nothing signed. The feed follows season.network (mainnet or testnet).server/paper/feed.ts, server/admin/hl.ts
Polymarket → serverMarket list and prices from the Gamma API for the prediction league, every 10 minutes.server/league/gamma.ts
Server ↔ StripeThe server creates a Checkout session; Stripe calls back /api/money/webhook/stripe, signed with your webhook secret.server/money/stripe.ts, server/money/service.ts
Server → alertsTelegram bot messages (the server polls the bot with getUpdates; no inbound webhook), Discord webhooks, members' signed webhooks.server/money/alerts.ts
Server → EVM RPCRead-only calls: USDC transfer checks (USDC_RPC_URL) and smart-wallet sign-in (SIWE_RPC_URLS).server/money/usdc.ts, server/community/eip1271.ts
Runner tab ↔ serverThe tab sends a market and account snapshot to /api/decide; the server asks the model and answers with a decision. The tab reports what it executed and sends heartbeats. Needs OPERATOR_TOKEN.server/app.ts, server/decide.ts
Browser tabs → HyperliquidPublic reads for the ticker and real-money figures. In the runner and Ride tabs, orders signed by an agent key that exists only in that tab.web/src/data/market.ts, web/src/hl/, web/src/ride/

03What this means for hosting

  • One instance only. The live stream, the timers and SQLite assume one process. Two machines would run every timer twice.
  • A persistent disk. Everything you would hate to lose is in pit.db, admin.sqlite and arena.config.json (backups).
  • Outbound internet. The server must reach the AI providers, Hyperliquid and, for the prediction league, Polymarket (diagnose it).
  • Inbound only from browsers and Stripe. Nothing else calls your server.