VeztaVezta
Architecture

Data Model

Prisma schema with 42 models across 6 domains

The backend uses Prisma ORM with PostgreSQL. The schema contains 42+ models organized across seven domain groups. All financial values use Prisma Decimal types with explicit precision -- never JavaScript floats.

Financial field precisions: @db.Decimal(18, 2) for USD amounts and volumes, @db.Decimal(10, 6) for prices and probabilities, @db.Decimal(18, 6) for fees and share quantities, @db.Decimal(5, 4) for rates and tolerances.

Auth and Users

ModelKey FieldsPurpose
UserwalletAddress, walletChain, tier, accountTier, totalVolume, totalPointsPrimary user record, linked to all trading and social data
RefreshTokentokenHash, family, used, revoked, expiresAtJWT refresh token with rotation and family-based revocation
SubWalletchain, address, signerCiphertext, clobApiKeyExchange sub-wallets with encrypted private keys and CLOB credentials
AccessKeykey, creatorId, usedById, statusInvite-based access keys (ACTIVE, USED, EXPIRED)
ReferralreferrerId, refereeId, layerMulti-layer referral chain
ReferralEarningfeeAmount, commission, ratePer-order referral commission tracking
UserPreferencesTrading defaults, display settings, notification togglesUser-configurable settings
ApiKeykeyPrefix, keyHash, permissionsAPI key management with permission scoping
KycVerificationstatus, level, documentType, withdrawal limitsIdentity verification workflow (NOT_STARTED through APPROVED/REJECTED)
RewardEscrowtype, amount, status, releaseAtReward escrow with delayed release and clawback

Trading and Portfolio

ModelKey FieldsPurpose
Marketslug, source, yesPrice, noPrice, volume24h, change24h, closesAtUnified market record from Polymarket or Kalshi
EventGroupslug, title, category, totalVolumeGroups related markets into a single event
Orderside, type, action, status, price, quantity, filledQuantity, exchangeTrade orders with state machine (CREATED through FILLED/CANCELLED/FAILED)
Positionside, shares, entryPrice, currentPrice, unrealizedPnl, takeProfitPrice, stopLossPriceOpen and closed positions with TP/SL
Transactiontype, status, amount, currency, txHashDeposit/withdrawal transaction records
PnlSnapshottotalValue, realizedPnl, unrealizedPnl, snapshotDateDaily portfolio value snapshots for PnL charts
MarketPriceSnapshotmarketId, yesPrice, createdAtPrice history data points for sparklines and charts
ExchangeTradesource, side, outcome, price, size, makerAddress, tradedAtSynced trades from Polymarket/Kalshi for the trade feed
SniperOrdertriggerPrice, amount, slippage, statusPrice-triggered orders (WATCHING, EXECUTING, FILLED, EXPIRED)
CounterTradeConfigtargetWalletAddress, strategy, sizeMultiplier, dailyStopLossAutomated inverse trading configuration

Social and Engagement

ModelKey FieldsPurpose
WatchlistuserId, marketIdUser's watched markets
TrackedWalletaddress, displayName, category, alertOnWallet addresses the user is monitoring
CopyTradeSubscriptiontargetWalletAddress, sizingStrategy, fixedAmount, maxPositionUsdCopy trade configuration with sizing, exit, and filter rules
CommentmarketId, content, parentId, likesCountMarket discussion threads with nested replies
CommentLikecommentId, userIdPer-user comment likes
TopTraderaddress, pnl, roi, winRate, volume, period, category, rankCached leaderboard data from Polymarket
LoginStreakuserId, loginDateDaily login tracking for streak rewards
ActivityLogtype, address, side, amount, metadataAll platform activity for the global feed
Challengetitle, type, target, metric, rewardPointsTime-limited trading challenges
ChallengeParticipantchallengeId, userId, progress, completedUser progress in active challenges

Signals and AI

ModelKey FieldsPurpose
AiPredictionmarketId, aiPrediction, confidence, alpha, signal, accuracy7dML model predictions per market
AiModelStatsmodelVersion, overallAccuracy, winRate, totalPredictionsAggregate model performance metrics
MonitorSignaltype, severity, headline, source, category, lat, lng, address, marketIdNews and whale signals with geo-coordinates
NewsArticletitle, source, url, sentiment, publishedAtIngested news articles linked to markets and event groups

Rewards

ModelKey FieldsPurpose
PointsLedgeramount, source, sourceIdPoint credit/debit records
Missiontitle, reward, target, type, metric, activeMission definitions (daily, weekly, one-time)
MissionProgressuserId, missionId, progress, target, completed, claimedPer-user mission completion tracking

Notifications and Alerts

ModelKey FieldsPurpose
Notificationtype, title, message, read, marketIdIn-app notification records
PriceAlertmarketId, condition, targetPrice, channels, triggeredUser-configured price alerts with multi-channel delivery

Platform

ModelKey FieldsPurpose
WaitlistEntryemail, position, status, tweetUrl, accessKeyIdEarly access waitlist (PENDING_TWEET, TWEET_VERIFIED, KEY_ACTIVATED)
DeviceTokentoken, platform, deviceId, activeMobile push notification tokens (iOS/Android)
PaperBalancebalance, initialBalancePaper trading virtual balance
PaperTransactiontype, amount, balanceBefore, balanceAfterPaper trading transaction history

Key Enums

EnumValuesUsed By
MarketStatusACTIVE, SUSPENDED, RESOLVED, CANCELLEDMarket
OrderStatusCREATED, SUBMITTING, OPEN, PARTIALLY_FILLED, FILLED, CANCELLING, CANCELLED, REJECTED, FAILEDOrder
UserTierBRONZE, SILVER, GOLD, DIAMONDUser
SniperStatusWATCHING, EXECUTING, FILLED, EXPIRED, CANCELLED, INSUFFICIENT_BALANCE, FAILEDSniperOrder
KycStatusNOT_STARTED, INITIATED, DOCUMENTS_UPLOADED, PENDING_REVIEW, APPROVED, REJECTEDKycVerification
WaitlistStatusPENDING_TWEET, TWEET_VERIFIED, KEY_ACTIVATED, UNSUBSCRIBEDWaitlistEntry
EscrowStatusPENDING, AVAILABLE, CREDITED, CLAWED_BACKRewardEscrow

On this page