Skip to content

Data Model

Brandvelia is a single-schema, RLS-protected Postgres application. All data lives in the brandvelia schema of the shared Supabase project panoptes. The app never touches any other schema, Edge Function, or job that belongs to co-tenants.


Layout

brandvelia/            ← the only schema this app may touch
├── authentication/    identity, sessions
├── offers/            product catalog + commission model
├── landing_pages/     operator destinations
├── creative/          AI-generated copy
├── campaigns/         traffic runs + spend
├── offers_src/        inbound marketplace feed (products)
├── marketplaces/      ClickBank marketplace products
├── snapshots/         Radar opportunity snapshots
├── marketplace/       offer scores
├── leads/             CRM capture + pipeline
├── experiments/       A/B tests + metric breakdown
├── checkout_tracking/ order tracking
├── finance/           transactions, ledger, P&L
├── dashboard/         dashboard aggregates
├── vision_board/      product ideas + offer spreadsheets
├── integrations/      connected apps, webhooks, triggers, refresh
├── ai/                AI models, runs, results, settings
└── settings/          workspace + operator settings

ID strategy

Every entity has a nominal platform ID — BV_USER, BV_Campaign, BV_Created, BV_ID, BV_LandingPage, BV_Product, BV_Snapshot, BV_AIModel, BV_AIResult, BV_AIModel, BV_Transaction, BV_Leads, BV_Workspace, BV_AuthProvider. These nominal IDs (defined in packages/types) encode the domain and are enforced by the compiler, not just documentation.


Relationships

flowchart LR
    WB[Vision Board] --> OFF[Offers]
    OFF --> LP[Landing Pages]
    OFF --> CRE[Creatives]
    LP --> CAM[Campaigns]
    CRE --> CAM
    CAM --> TR[Finance / Transactions]
    CAM --> LEAD[Leads/CRM]
    EX[Experiments] -. metric .- TR
    CO[Copilot] -. reads .- TR
    RAD[Radar Snapshot] --> MS[Offer Score]
    OFF --> MS