Every model in Conduit's schema, and what it's for
Auth (better-auth)
User, Session, Account, and Verification are the standard better-auth tables — email, session tokens, OAuth account links, and email-verification records. A User has a roles array (defaulting to empty) and links one-to-one to a Member.
Identity inside Conduit
Member is a User's presence inside Conduit specifically — it adds a unique callsign, an active flag, and an activeSquadId pointing at whichever Squad the member is currently shopping with. Member.customConfig is a free-form JSON field for per-member settings.
Squads and crew
Squad is a household. SquadCrew is the join table for squad membership. SquadCrewInvite is a pending invite — unique per (squadId, memberId) pair, so the same member can't be invited to the same squad twice. A squad tracks its creatorId, and creator-only actions (like removing a crew member) are enforced against that field.
Merchants and store layout
Merchant belongs to a squad and has a cnpj field (the Brazilian company tax ID) alongside its name. Aisle is a merchant's store section, ordered for walking-path sorting. MerchantAisle is the join between the two. MerchantAisleRule connects a specific MissionItem to a specific MerchantAisle, with its own order — this is the model that makes aisle-based sorting per-merchant rather than global. See Aisle Rules for how this plays out for a shopper.
Missions and shopping lists
Mission is a shopping trip: title, state (draft/active/finished), an optional merchantId, and a finalStatus JSON field. MissionItem is a squad's reusable item template (title, category, optional aisleId). MissionItemEst is the join between a mission and its items, carrying estValue, a complete checkbox, and its own order for list position. See Squads and Missions for the shopper's view of this.
Receipts and price history
Receipt belongs to a squad and a merchant, with status, an optional nfce code, scanData JSON from the scan pipeline, and a processedAt timestamp. ReceiptItem is a line item — qtd and unitValue — linking a receipt to an Item. Item carries the running price memory: lastPrice / lastPriceDate / lastPriceMerchant, lowestPrice / lowestPriceDate / lowestPriceMerchant, and a priceHistory JSON blob of every observed value. See Price Tracking.
Processing rules
ProcessingRules is a per-squad, per-category JSON config with an enabled flag — infrastructure for automating how incoming receipt items get categorized or handled, scoped to the squad like everything else in this schema.
The pattern underneath all of it#
Almost every model below Member carries a squadId and relates back to Squad with onDelete: Cascade. Data in Conduit doesn't belong to a user — it belongs to a squad, and deleting a squad takes its merchants, missions, receipts, and items with it.
Related: Squads and Missions, Price Tracking, Architecture for how the app code is organized around these models, or back to the documentation overview.