Developer Overview
Monorepo structure, tech stack, and architecture diagram
Vezta is a prediction market trading terminal that aggregates markets from Polymarket and Kalshi into a unified trading interface. The codebase is a monorepo containing three independent subprojects that share a single backend API.
Monorepo Structure
| Subproject | Stack | Port | Description |
|---|---|---|---|
vezta-fe/ | Next.js 16, React 19, Tailwind v4, TanStack Query v5 | 3000 | Web frontend -- App Router with Kubb code-gen from OpenAPI |
vezta-be/ | NestJS, Fastify, Prisma, PostgreSQL, Redis/BullMQ | 3001 | Backend API -- market ingestion, trading execution, WebSockets |
vezta-mobile/ | Expo SDK 55, React Native 0.83, NativeWind v4, Reanimated v4 | -- | Mobile app -- Expo Router with 5-tab navigation |
All subprojects use pnpm as the package manager.
Data Flow
Polymarket API ──┐
├──▶ vezta-be Ingester ──▶ PostgreSQL
Kalshi API ──────┘ │
├── REST API (/api/v1)
└── WebSocket (/ws)
│
┌──────┴──────┐
▼ ▼
vezta-fe vezta-mobile
(Next.js) (Expo)The backend continuously ingests market data from Polymarket and Kalshi, normalizes it into a unified schema, stores it in PostgreSQL, and serves it to clients via REST and WebSocket APIs. Redis handles caching, pub/sub for real-time delivery, and BullMQ job queues for background processing.
API Contract
The backend auto-exports an openapi.json specification on startup. The frontend uses Kubb to generate TypeScript types, Zod schemas, fetch clients, and TanStack Query hooks from this spec. After any backend API change, run pnpm generate in vezta-fe/ to regenerate the client layer. The mobile app's lib/api/gen/ directory is a manual copy of the frontend's generated code.
Never hand-edit files in lib/api/gen/ in any subproject. These files are fully regenerated by code-gen tools and manual changes will be overwritten.
Shared Patterns
The frontend and mobile app share several code layers that are kept in sync manually:
lib/api/gen/-- auto-generated API layer (types, hooks, schemas)lib/utils.ts,lib/constants.ts,lib/types/-- shared utilities and TypeScript interfaceslib/ws/-- WebSocket client with Jotai atoms for real-time statelib/trading/-- PnL helpers and price impact calculations
Sections
Tech Stack
Detailed breakdown of all technologies used across frontend, backend, and mobile.
Quickstart
Get the full development environment running on your machine.
Architecture
System overview, data model, ingestion pipelines, trading engine, and auth system.
WebSocket Reference
Connection setup, channel subscriptions, and payload schemas for all 8 real-time channels.