Firestore Schema¶
Last reviewed: March 15, 2026
This page summarizes the active Firestore model used by the mobile app and Cloud Functions.
Core collections¶
clans: clan profile and aggregate metadatabranches: branch hierarchy and branch leadership referencesmembers: canonical member profile, role, and denormalized relationship idsrelationships: canonical relationship edgesinvites: phone and child-access invite recordsusers: session access context for auth/rules fallbacknotifications: per-member notification inbox documentsevents,funds,transactions,scholarshipPrograms,awardLevels,achievementSubmissions,auditLogs
Billing collections (Epic #213):
subscriptions: clan-level plan state (FREE,BASE,PLUS,PRO), member snapshot, price, ad entitlement, expiry, renew modesubscriptionInvoices: invoice summaries for each billing cyclepaymentTransactions: gateway-level payment intent/settlement recordspaymentWebhookEvents: idempotency and callback verification trackingbillingSettings: owner/admin renewal preferences and reminder settingsbillingAuditLogs: immutable billing action trace entries
Member + relationship pattern¶
- truth source:
- edges in
relationships - read optimization:
members.parentIdsmembers.childrenIdsmembers.spouseIds- relationship callables maintain denormalized arrays transactionally
Session and device token docs¶
users/{uid}stores resolved access:memberId,clanId,clanIds,branchId,primaryRole,accessModeusers/{uid}/deviceTokens/{token}stores FCM routing metadata
Query/index profile¶
Key indexes are maintained in firebase/firestore.indexes.json:
- members by clan + name
- members by clan + branch + name
- members by clan + generation
- relationships by clan + person + type
- events by clan/branch + start time
- notifications by member + created time and read state
- billing indexes by clan + subscription status/expiry and transaction chronology
Reference¶
For full schema examples and expanded field contracts: