High-Level Overview

User Browser
Next.js Web App
Hono API + Workers
Privy Auth
Solana (Helius)
Base (Alchemy)
Hyperliquid

Multi-Chain Parser Architecture

┌─────────────────────────────────────────────────────────────┐
│                    Parser Factory                           │
│              getParser(chain, marketType)                   │
└─────────────────────────────────────────────────────────────┘
                              │
        ┌─────────────────────┼─────────────────────┐
        │                     │                     │
        ▼                     ▼                     ▼
┌───────────────┐     ┌───────────────┐     ┌───────────────┐
│    Solana     │     │     Base      │     │  Hyperliquid  │
│  SpotParser   │     │  SpotParser   │     │  PerpParser   │
├───────────────┤     ├───────────────┤     ├───────────────┤
│ • Helius API  │     │ • Alchemy RPC │     │ • REST API    │
│ • DEX normals │     │ • EVM decode  │     │ • Fills       │
│ • Bot detect  │     │ • Uniswap/Aero│     │ • Positions   │
│ • MEV detect  │     │ • Gas tracking│     │ • Funding     │
└───────────────┘     └───────────────┘     └───────────────┘
        │                     │                     │
        └─────────────────────┼─────────────────────┘
                              │
                              ▼
              ┌───────────────────────────┐
              │   Cost Basis Engine       │
              │   FIFO / HIFO / Spec-ID   │
              └───────────────────────────┘
                              │
                              ▼
              ┌───────────────────────────┐
              │       PostgreSQL          │
              │  (swaps · lots · ratings) │
              └───────────────────────────┘
        

Data Flow

  1. User enters wallet address - Web app accepts address + chain
  2. Parser factory selects chain parser - Routes to Solana/Base/Hyperliquid
  3. Transactions fetched from RPC - Chain-specific API calls
  4. Normalizers process each transaction - Extract swaps/fills
  5. Pricing API fetches USD values - Jupiter for Solana, CoinGecko fallback
  6. Cost basis engine calculates - FIFO/HIFO lots and PnL
  7. Results stored + displayed - Dashboard and available for export

Package Dependencies

@posit/web
  └── @posit/types

@posit/api
  ├── @posit/parser
  ├── @posit/db
  ├── @posit/auth
  └── @posit/config

@posit/parser
  ├── @posit/config
  ├── @posit/types
  └── chain clients (helius, viem, etc.)

@posit/db
  ├── drizzle-orm
  └── @posit/types

Database Schema

Core Tables (Books)

Table Purpose
usersUser accounts (Sign-in-with-Solana)
entitiesTax entities (personal, LLC, trust)
walletsTracked wallet addresses (multi-chain)
address_registryUnified address tracking
swapsParsed swap transactions
lotsTax lots for cost basis
positionsCurrent token positions

Perpetual Trading (Hyperliquid)

Table Purpose
perp_positionsOpen perpetual positions with margin/PnL
perp_tradesIndividual perpetual fills
perp_fundingFunding payment history
perp_liquidationsLiquidation events

Intelligence/Scorecard

Table Purpose
wallet_flagsImmutable timestamp when wallet was flagged
wallet_labelsLabels (smart, sniper, whale) with confidence
wallet_relationshipsGraph edges between wallets
wallet_ratingsComputed scores and decay states
cohort_snapshotsMonthly cohort decay metrics

API/Platform

Table Purpose
api_keysCustomer API keys with rate limits
webhook_subscriptionsWebhook endpoint registrations
organizationsFund/team accounts

Authentication

Authentication is handled via Privy (Sign-in-with-Solana):

External APIs

Solana

APIPurposeRate Limit
Helius RPCTransaction history, enhanced parsing100k credits/mo (free)
Helius WebhooksReal-time transaction notificationsPer webhook
Jupiter Price APIToken pricing (primary)Higher with API key
BirdeyeToken pricing (fallback)Per plan

Base (EVM)

APIPurposeRate Limit
AlchemyRPC + Transaction historyPer plan
BasescanContract verification, ABI5/sec (free)

Hyperliquid

APIPurposeRate Limit
REST APIFills, positions, funding1200/min
WebSocketReal-time updatesPer connection

Security Considerations