VeztaVezta
Architecture

System Overview

Full system architecture diagram and component inventory

Vezta's backend orchestrates data ingestion from two prediction market exchanges, processes it through multiple pipelines, and delivers it to web and mobile clients via REST and WebSocket APIs.

Data Flow

┌─────────────────┐     ┌─────────────────┐
│  Polymarket API  │     │   Kalshi API    │
│  (CLOB + Gamma)  │     │  (Trade API v2) │
└────────┬────────┘     └────────┬────────┘
         │                       │
         └───────────┬───────────┘

          ┌─────────────────────┐
          │   BullMQ Ingester   │
          │   (market-sync)     │
          └──────────┬──────────┘

          ┌─────────────────────┐
          │  NormalizerService  │
          │  (unified schema)   │
          └──────────┬──────────┘

          ┌─────────────────────┐
          │    PostgreSQL 17    │◀── Prisma ORM (42+ models)
          └──────────┬──────────┘

              ┌──────┴──────┐
              ▼             ▼
      REST API (/api/v1)  WebSocket (/ws)
              │             │
       ┌──────┴──────┐     │
       ▼             ▼     ▼
   vezta-fe     vezta-mobile
  (Next.js 16)  (Expo SDK 55)

Backend Module Inventory

The backend contains 36+ NestJS modules organized by domain. Each module follows the standard pattern: module.ts, controller.ts, service.ts, dto/, and optionally a processor.ts for BullMQ jobs.

Auth and Users

ModulePurpose
authWallet-based authentication (Solana + EVM), JWT issuance, token refresh
waitlistEarly access waitlist with tweet verification and access key generation
sub-walletExchange sub-wallet creation and encrypted key management
userUser profile management
accountAccount settings and preferences
kycIdentity verification workflow

Core Trading

ModulePurpose
marketMarket CRUD, search, chart data, price snapshots
tradingOrder submission, SmartRouter, exchange adapters, OrderStateMachine
portfolioPosition tracking, PnL snapshots, portfolio analytics
merge-splitPolymarket conditional token merge/split operations
sniperPrice-triggered sniper orders with monitoring
counter-tradeAutomated inverse trading against target wallets
arbitrageCross-platform spread detection (Polymarket vs Kalshi)

Social and Engagement

ModulePurpose
leaderboardTop trader rankings synced from Polymarket, enrichment pipeline
trackerWallet tracking and activity monitoring
activityActivity logs and trade feed
copy-tradeCopy trade subscriptions and automated execution
rewardsPoints ledger, missions, challenges
eventsEvents calendar and competitions

Intelligence

ModulePurpose
ai-predictionsML model predictions with confidence scoring
monitorSignal detection, news ingestion pipeline (6 sources)
alertsPrice alerts with multi-channel delivery
analyticsPlatform-wide analytics and metrics

Platform

ModulePurpose
notificationIn-app and email notifications
push-notificationMobile push via Expo Notifications
searchFull-text market and event search
share-cardShareable PnL card generation
calendarMarket resolution date calendar
feedAggregated activity feed
helpHelp and FAQ content
healthHealth check endpoint
adminAdmin management endpoints
app-versionMobile app version checking

Deployment Topology

ComponentTargetTrigger
FrontendVercel (auto-deploy on push to main)Git push
BackendDocker on Digital Ocean VM (8 GB RAM, 4 vCPU)GitHub Actions self-hosted runner
MobileEAS Build (iOS + Android)GitHub Actions
DatabasePostgreSQL 17 container on backend VMDocker volume
RedisSeparate container on backend VMDocker network

The backend runs at https://backend.vezta.io behind an Nginx reverse proxy with SSL via Certbot. Host port 4001 maps to container port 3001.

The backend VM is a shared 8 GB machine. Memory-intensive operations like uncapped Kalshi event fetching or running price-change queries every 60 seconds can exhaust available memory. Critical optimizations are in place -- do not remove them.

On this page