Skip to main content

System architecture

Supermission is a full-stack trading terminal that sits on top of Polymarket’s infrastructure. Understanding the layers helps you understand what’s happening when you place a trade, receive a signal, or interact with an AI agent.

Architecture layers

┌─────────────────────────────────────────────┐
│            User Interface (Next.js 15)       │
│  Market Terminal · Portfolio · War Room       │
│  Oracle Chat · Delphi Chat · Admin           │
└──────────────────┬──────────────────────────┘
                   │ API calls
┌──────────────────▼──────────────────────────┐
│           Next.js API Routes                 │
│  Auth gating · Rate limiting · Caching       │
│  150+ endpoints across markets, trading,     │
│  AI, dashboard, agents, and admin            │
└──────────────────┬──────────────────────────┘
                   │ reads/writes
┌──────────────────▼──────────────────────────┐
│         Supabase (PostgreSQL)                │
│  market_catalog · market_ai_analysis         │
│  alpha_edges · smart_money_moves             │
│  user sessions · trade records               │
└──────────────────┬──────────────────────────┘
                   │ executes
┌──────────────────▼──────────────────────────┐
│             Polymarket                       │
│  CLOB (orderbook) · Data API                 │
│  UMA Oracle (resolution)                     │
└─────────────────────────────────────────────┘

Core systems

Frontend

Next.js 15 with React 19. App Router with React Server Components for performance. Tailwind CSS + Framer Motion for styling and animation. Zustand for local state, React Query for server state.

Backend

Next.js API routes (150+ endpoints). Supabase PostgreSQL with Row-Level Security. Privy for auth token verification. Rate limiting per-IP and per-user.

AI Pipeline

MiniMax M2.7 for multi-agent market analysis. OpenRouter (GPT-4O-mini) for chat agents (Oracle, Delphi, Securo). Vercel AI SDK for streaming and tool calling. 4-agent debate system with judge synthesis. Scheduled analysis runs per market tier.

Blockchain

Base (L2) for wallet and settlement. Polygon for Polymarket CLOB execution. Privy MPC for wallet infrastructure. Auto-bridging between chains via Circle CCTP.

Data flow: placing a trade

1

User confirms trade in UI

Click “Buy YES” on a market. The frontend validates amount, checks balance, and prepares the order parameters.
2

API processes the request

The trade route authenticates via Privy JWT, checks wallet balance on Base, and initiates the bridge if needed.
3

USDC bridges Base → Polygon

Circle CCTP bridges the exact USDC amount from your Base wallet to Polygon. USDC converts to USDC.e (Polymarket’s settlement token).
4

Order hits Polymarket CLOB

A FAK (Fill-And-Kill) or GTC (Good-Till-Cancel) order is submitted directly to Polymarket’s orderbook. No mempool, no MEV exposure.
5

Position recorded

The trade is recorded in Supabase. Portfolio updates in real-time. The user sees their new position in the Portfolio tab.

Data flow: AI signal generation

1

Market data ingested

Polymarket Data API provides real-time prices, volume, and orderbook depth. Market catalog synced to Supabase.
2

4 agents analyze independently

Four agents — Bull (narrative analysis), Bear (microstructure analysis), Contrarian (consensus challenge), and Quant (base-rate anchoring) — each receive market data + external context (news, social, on-chain). Each produces an independent probability estimate with reasoning.
3

Judge synthesizes

A judge agent reviews all 4 analyses, weighs argument quality and evidence strength, and produces a final probability + confidence score.
4

Signal emitted if divergence exists

If the synthesized probability diverges meaningfully from market price, a signal is stored in market_ai_analysis and pushed to the frontend via Server-Sent Events (SSE).

Market tiering

Not all markets get the same AI treatment. Analysis depth scales with market importance:
TierCriteriaAnalysisUpdate Frequency
Tier 1Trending OR volume > $50KFull 4-agent debateEvery 15 minutes
Tier 2Volume > $5K2-agent quick analysis (Bull + Bear)Every 30 minutes
Tier 3Everything elseSingle-model sentimentEvery 60 minutes

Tech stack summary

LayerTechnology
FrontendNext.js 15, React 19, TypeScript, Tailwind CSS 4, Framer Motion
StateZustand 5, TanStack React Query 5, Zod
Web3wagmi 2, viem 2, Privy 3, OnchainKit, ethers.js 5
AIVercel AI SDK 6, MiniMax M2.7, OpenRouter, OpenAI SDK, Google GenAI (Gemini 2.0 Flash for vision)
DeFiUniswap V3, Morpho, Circle CCTP, LI.FI, Polymarket CLOB
BackendSupabase PostgreSQL, Pinata (IPFS), Alchemy, QuickNode
HostingVercel, PostHog analytics
Supermission is deployed on Vercel with Supabase as the primary database. All blockchain interactions happen through verified RPC providers (Alchemy, QuickNode) with fallback routing.