Skip to main content

Data model reference

This page is a flat reference of every Firestore collection in LifeWell with its key fields. For the conceptual overview (why per-user collections, why these shapes), see Concepts → Data model. This page is the index.

All collections prefix with lifewell_ so they don't collide with other Firebase projects sharing the same Google Cloud account.

Collection list

CollectionDocumentOwner
lifewell_usersPer-user account recorduserId
lifewell_user_preferencesPer-user preferences (units, language, etc.)userId
lifewell_user_statePer-user app state snapshotsuserId
lifewell_wellness_profilePer-user wellness profile (height, conditions, etc.)userId
lifewell_waterWater-intake log entriesuserId
lifewell_vitals_bpBlood-pressure readingsuserId
lifewell_vitals_sugarBlood-sugar readingsuserId
lifewell_vitals_heart_rateHeart-rate readingsuserId
lifewell_vitals_weightWeight entriesuserId
lifewell_vitals_bmiBMI entriesuserId
lifewell_medicationsMedication definitionsuserId
lifewell_medication_logsPer-dose logsuserId
lifewell_sleepSleep sessionsuserId
lifewell_caloriesCalorie-log entriesuserId
lifewell_workoutsExercise sessionsuserId
lifewell_mood_journalMood entriesuserId
lifewell_period_cyclesPeriod cycle recordsuserId
lifewell_fertility_dataFertility-awareness daily recordsuserId
lifewell_babiesBaby profilesuserId + partnerUserIds
lifewell_baby_feedingsFeeding sessionsuserId
lifewell_baby_sleepBaby sleep sessionsuserId
lifewell_baby_diapersDiaper changesuserId
lifewell_baby_growthGrowth measurementsuserId
lifewell_baby_milestonesMilestone recordsuserId
lifewell_peoplePerson recordsuserId
lifewell_family_connectionsVerified family connectionsuserId
lifewell_memoriesMemory recordsuserId
lifewell_notesNote recordsuserId
lifewell_note_foldersNote folder structureuserId
lifewell_journeysJourney recordsuserId
lifewell_location_snapshotsLocation snapshots (opt-in)userId
lifewell_chatsConversation recordsuserId
lifewell_chat_messagesIndividual messagesuserId
lifewell_communitiesCommunity definitionsplatform
lifewell_community_postsCommunity postsuserId (author)
lifewell_community_commentsCommunity commentsuserId (author)
lifewell_consultationsConsultation sessionsuserId + professionalId
lifewell_consultation_messagesEncrypted consultation messagesuserId + professionalId
lifewell_professionalsProfessional profilesprofessionalId
lifewell_blood_donorsBlood-donor opt-in profilesuserId
lifewell_blood_donationsDonation historyuserId
lifewell_blood_contact_requestsContact requests on donor profilesrequestorUserId + donorUserId
lifewell_achievementsPer-user achievement progressuserId
lifewell_remindersPer-user reminder definitionsuserId
lifewell_reminder_logsReminder fire historyuserId
lifewell_calendar_eventsCalendar event recordsuserId
lifewell_paymentsPayment recordsuserId
lifewell_audit_logAdmin action audit logplatform (admin)

Common field patterns

Every document includes:

  • userId (string, indexed) — owner; Firestore rules check this.
  • createdAt (Timestamp) — when created.
  • updatedAt (Timestamp) — last edit.
  • deletedAt (Timestamp | null) — soft-delete marker (for collections that soft-delete).

Firestore-rule patterns

Three access patterns across collections:

  1. User-owned: request.auth.uid == resource.data.userId — most collections.
  2. Multi-owner: request.auth.uid in resource.data.partnerUserIds — baby records with partner access.
  3. Public read: lifewell_communities, lifewell_community_posts — anyone can read; only authors can write.

The rules deny everything else by default. Admin claims grant limited writes (suspend / restore / verifications) — never reads of personal collections.

Indexes

Firestore composite indexes are defined in firestore.indexes.json. Common indexed combinations:

  • (userId, createdAt DESC) — for chronological lists.
  • (userId, date, dateRange) — for time-window queries.
  • (communityId, createdAt DESC) — for community feeds.

Deploy indexes with firebase deploy --only firestore:indexes. Never deploy with firebase deploy --only firestore — that command can delete indexes.

Document size limits

Firestore caps documents at 1 MB. LifeWell stays well under by:

  • Splitting large documents into multiple smaller ones (e.g. one document per memory, not all memories in one).
  • Storing media in Google Drive (not embedded in Firestore docs).
  • Avoiding nested arrays of unbounded length (paginate instead).

Last updated: 2026-05-11 Author: Ahsan Mahmood