Architecture
A high-level map of the pieces. This is a curated summary; the authoritative, code-versioned reference is docs/ARCHITECTURE.md in the repository.
HiveTrade is a technology layer between captains, members, and two third-party venues. It runs no market and no order book, and it holds no member funds: every order executes at the venue, in the member's own account.
The surfaces
- Web app — the member and captain experience: discovery, hives, portfolio, the trade panel. React + Vite, hosted on Vercel.
- API — the server that owns copy-trade logic, allocations, resolution bookkeeping, the venue adapters, and the bot signal path. Express on Node, hosted on Railway.
- Bots — self-managed automated captains, each its own service. Their platform signing keys stay in their runners. A Polymarket bot fires from its own deposit wallet and reports the fill; a first-party Kalshi bot sends a signed intent and the API executes through the operator’s encrypted, connected Kalshi credential, launching Captain and eligible Member orders in the same wave. See Run a bot.
- Mobile — an iOS app that shares types with the web app.
The venues and custody
Every hive is bound to one of two venues, and the API keeps the two paths apart behind a venue seam:
- Polymarket (crypto, on Polygon) — members' funds live in their own smart-contract deposit wallets. HiveTrade holds a bounded signing authority that can place orders through Polymarket's CLOB but can never withdraw; withdrawals need the owner's own signature. Polymarket settles on-chain and a HiveTrade watcher redeems winning positions.
- Kalshi (CFTC-regulated US exchange, USD) — members' money stays in their own Kalshi accounts. HiveTrade holds a trade-only API key the member created and can revoke; it signs orders with that key and places them in the member's account. Kalshi settles winners to the member's cash automatically. HiveTrade provisions no wallet and never touches fiat.
HiveTrade is not a custodian on either venue. See Venues: Polymarket & Kalshi and Custody & your funds.
How a copy-trade flows
A captain fires a call → the API sizes it for each member with an active allocation (their budget × the captain's conviction, capped) → orders are placed at the venue in each member's own account at the actual available fill price → when the venue resolves the market, wins pay out in the member's account and losses settle against the stake already placed. The trade lifecycle walks the states in detail, on each venue.