Skip to main content

Documentation Index

Fetch the complete documentation index at: https://grantmaster.dev/llms.txt

Use this file to discover all available pages before exploring further.

Firestore Schemas

StatusUpdatedCovered Files
Complete2026-03-14src/core/firestore/ (modular), src/core/firestoreCollections.ts (legacy re-export)
Source of truth: Collection references, typed queries, and validation helpers are now defined in the modular Firestore layer at src/core/firestore/. The legacy entry point src/core/firestoreCollections.ts re-exports from the new modules for backward compatibility.

Modular Firestore Architecture (March 2026)

The formerly monolithic firestoreCollections.ts has been decomposed into a domain-driven module structure:
src/core/firestore/
├── index.ts                       # Public API barrel export
├── references.ts                  # Re-exports from full/references.ts
├── queries.ts                     # Re-exports from full/queries.ts
├── validation.ts                  # Re-exports from full/validation.ts
├── firestoreCollections.full.ts   # Aggregates full/* modules
└── full/
    ├── references.ts              # 80+ typed collection and document reference factories
    ├── validation.ts              # getValidatedDoc(s), transformDocSnapshot, transformQuerySnapshot
    ├── queries.ts                 # Query registry aggregator (merges all domain queries)
    ├── queriesCore.ts             # Core domain: projects, users, journals, expenses, notifications, milestones
    ├── queriesImpact.ts           # M&E domain: indicators, targets, data points, dashboards, Kobo connections
    ├── queriesPlatform.ts         # Platform-level: module installations
    ├── queriesPolicy.ts           # Compliance domain: rules, templates, violations, platform rules
    └── queriesRelations.ts        # Relations domain: contacts, interactions, grantor interactions, deadlines

Import Patterns

// Recommended (new modular import):
import { collections, queries } from '@/core/firestore';

// Domain-specific (when only one domain is needed):
import { coreQueries } from '@/core/firestore/full/queriesCore';
import { impactQueries } from '@/core/firestore/full/queriesImpact';

// Legacy (still works via re-export):
import { collections, queries } from '@/core/firestoreCollections';

Key Design Characteristics

  • Type-safe references: collections.projects() returns CollectionReference<Project> with IDE autocomplete.
  • Lazy initialization: All collection factories use getDbOrThrow() to defer Firebase initialization.
  • Domain-split queries: 5 query modules (Core, Impact, Platform, Policy, Relations) merged into one queries object.
  • Runtime validation: getValidatedDoc<T>() and getValidatedDocs<T>() provide type-safe document retrieval with transformation.
  • Runtime architecture guards: src/core/architecture/runtimeGuards.ts can enforce import boundaries when ENFORCE_RUNTIME_ARCH_GUARDS=true.

Collection Summary Table

Root Collections (Tenant-Scoped)

All documents contain an organizationId field unless otherwise noted.
#Collection NameCode AliasFirestore PathTypeScript TypeScope
1UsersusersemployeesUserTenant
2ProjectsprojectsprojectsProjectTenant
3JournalsjournalsjournalsJournalEntryTenant
4ExpensesexpensesexpensesExpenseTenant
5Journal SubmissionsjournalSubmissionsjournalSubmissionsJournalSubmissionTenant
6NotificationsnotificationsnotificationsNotificationTenant
7ReferralsreferralsreferralsReferralTenant
8InvitationsinvitationsinvitationsInvitationTenant
9Grant ApplicationsgrantApplicationsgrantApplicationsGrantApplicationTenant
10Grant PipelinegrantPipelinegrantPipelineGrantPipelineEntryTenant
11Active GrantsactiveGrantsactiveGrantsActiveGrantTenant
12Expense AllocationsexpenseAllocationsexpenseAllocationsExpenseAllocationTenant
13Audit LogsauditLogsauditLogsAuditLogEntryTenant
14Security EventssecurityEventssecurityEventsSecurityEventTenant
15System EventssystemEventssystemEventsRecord<string, unknown>Tenant
16DeadlinesdeadlinesdeadlinesDeadlineTenant
17Compliance SummariescomplianceSummariescomplianceSummariesComplianceSummaryTenant
18Compliance AlertscomplianceAlertscomplianceAlertsComplianceAlertTenant

Rule Engine Collections

#Collection NameCode AliasFirestore PathTypeScript TypeScope
19Compliance RulescomplianceRules / compliancePoliciescompliance_rulesCompliancePolicyTenant
20Rule TemplatesruleTemplatesrule_templatesRuleTemplatePlatform
21Grant Rules (junction)grantRulesgrant_rulesGrantRuleTenant
22Rule ViolationsruleViolationsrule_violationsRuleViolationTenant
23Rule AnalyticsruleAnalyticsrule_analyticsRulePerformanceMetricsTenant
24Platform RulesplatformRulesplatform_rulesPlatformPolicyPlatform (SuperAdmin)
25Tenant Donor ConfigstenantDonorConfigstenant_donor_configsTenantDonorConfigTenant

Relations Module Collections

#Collection NameCode AliasFirestore PathTypeScript TypeScope
26ContactscontactscontactsContactTenant
27InteractionsinteractionsinteractionsInteractionTenant
28Contact ViewscontactViewscontactViewsContactViewTenant

Grantor Relationship Management Collections

#Collection NameCode AliasFirestore PathTypeScript TypeScope
29FoundationsfoundationsfoundationsTaxonomyItemPlatform
30Grantor InteractionsgrantorInteractionsgrantorInteractionsGrantorInteractionTenant
31Reporting DeadlinesreportingDeadlinesreportingDeadlinesReportingDeadlineTenant
32Grantor Rule ConflictsgrantorRuleConflictsgrantorRuleConflictsGrantorRuleConflictTenant

HubSpot Integration Collections

#Collection NameCode AliasFirestore PathTypeScript TypeScope
33HubSpot ConfigshubspotConfigshubspotConfigsHubSpotConfigTenant
34HubSpot Sync LogshubspotSyncLogshubspotSyncLogsHubSpotSyncLogTenant

Stakeholder Portal Collections

#Collection NameCode AliasFirestore PathTypeScript TypeScope
35Portal TokensportalTokensportalTokensPortalTokenTenant
36Portal SessionsportalSessionsportalSessionsPortalSessionTenant
37Portal CommentsportalCommentsportalCommentsPortalCommentTenant
38Portal Report AcksportalReportAcknowledgmentsportalReportAcknowledgmentsPortalReportAcknowledgmentTenant

Mission Credits & Gamification Collections

#Collection NameCode AliasFirestore PathTypeScript TypeScope
39Mission CreditsmissionCreditsmissionCreditsMissionCreditPer-user wallet
40Credit TransactionscreditTransactionscreditTransactionsCreditTransactionTenant
41Credit RedemptionscreditRedemptionscreditRedemptionsCreditRedemptionTenant
42BadgesbadgesbadgesBadgeTenant
43Gamification PrefsgamificationPreferencesgamificationPreferencesGamificationPreferencesPer-user
44CampaignscampaignscampaignsCampaignPlatform / Tenant

Impact / Monitoring & Evaluation Collections

#Collection NameCode AliasFirestore PathTypeScript TypeScope
45ME IndicatorsmeIndicatorsmeIndicatorsMEIndicatorTenant + Project
46ME Indicator TargetsmeIndicatorTargetsmeIndicatorTargetsMEIndicatorTargetTenant + Project
47ME Data PointsmeDataPointsmeDataPointsMEIndicatorDataPointTenant + Project
48ME Dashboard ConfigsmeDashboardConfigsmeDashboardConfigsMEDashboardConfigTenant + Project
49ME Kobo ConnectionsmeKoboConnectionsmeKoboConnectionsMEKoboConnectionTenant
50ME Kobo Form LinksmeKoboFormLinksmeKoboFormLinksMEKoboFormLinkTenant + Project
51ME Indicator SummariesmeIndicatorSummariesmeIndicatorSummariesMEIndicatorSummaryTenant (read-only)
52ME Grant Indicator ConfigsmeGrantIndicatorConfigsmeGrantIndicatorConfigsMEGrantIndicatorConfigTenant
53ME AI SuggestionsmeAISuggestionsmeAISuggestionsAIIndicatorSuggestionTenant + Project
54ME Workflow RulesmeWorkflowRulesmeWorkflowRulesMEWorkflowRuleTenant
55ME Workflow Exec LogsmeWorkflowExecutionLogsmeWorkflowExecutionLogsMEWorkflowExecutionLogTenant
56ME Org SettingsmeSettingsmeSettingsMEOrgSettingsTenant (1 doc/org)

Taxonomy Collections

#Collection NameCode AliasFirestore PathTypeScript TypeScope
57Budget CategoriesbudgetCategoriesbudgetCategoriesBudgetCategoryTenant
58Mission PillarsmissionPillarsmissionPillarsMissionPillarTenant
59DonorsdonorsdonorsTaxonomyItemTenant

Platform Management Collections (SuperAdmin)

#Collection NameCode AliasFirestore PathTypeScript TypeScope
60Imuseration SessionsimuserationSessionsimuserationSessionsImuserationSessionPlatform
61Auditor Access GrantsauditorAccessGrantsauditorAccessGrantsAuditorAccessGrantTenant
62Config SnapshotsconfigSnapshotsconfigSnapshotsConfigurationSnapshotTenant
63Audit Export JobsauditExportJobsauditExportJobsAuditExportJobTenant
64Platform MetricsplatformMetricsplatformMetricsPlatformMetricsPlatform
65User Growth MetricsuserGrowthMetricsuserGrowthMetricsUserGrowthMetricsPlatform
66Retention CohortsretentionCohortsretentionCohortsRetentionCohortPlatform
67Organization MetricsorganizationMetricsorganizationMetricsOrganizationMetricsPlatform
68Auditor ReportsauditorReportsauditorReportsAuditorReportTenant

Platform-Wide & Config Collections

#Collection NameCode AliasFirestore PathTypeScript TypeScope
69Grant OpportunitiesgrantOpportunitiesgrantOpportunitiesGrantOpportunityPlatform
70OrganizationsorganizationsorganizationsOrganizationPlatform
71ConfigconfigconfigmixedPlatform

Visual Collection Hierarchy


Root Collections (Tenant-Scoped) — Detail

All documents in these collections MUST contain an organizationId field for security-rule scoping.

1. Users (employees)

FieldTypeDescription
idstringFirebase Auth UID
organizationIdstringTenant FK
statusUserStatusACTIVE, INACTIVE, etc.
firstName, lastNamestringDisplay name parts
emailstringLogin email
rolestringPrimary RBAC role
Name-mapping gotcha: The Firestore collection is employees but stores User documents.

2. Projects (projects)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK
phaseProjectPhaseCurrent lifecycle phase
isArchivedbooleanSoft-delete flag

3. Journals (journals)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK
userIdstringAuthor
projectIdstringLinked project
Name-mapping gotcha: The Firestore collection is journals but stores JournalEntry documents.

4. Expenses (expenses)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK
userIdstringSubmitter
projectIdstringLinked project

5. Journal Submissions (journalSubmissions)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK
userIdstringAuthor
Name-mapping gotcha: journalSubmissions is the canonical collection for JournalSubmission documents.

6. Notifications (notifications)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK
recipientIdstringTarget user
isReadbooleanRead state

7. Referrals (referrals)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK
referrerIdstringUser who referred
refereeEmailstringInvitee email
statusReferralStatuspending / converted / etc.
creditAwardedboolean?Mission Credit tracking

8. Invitations (invitations)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK
tokenstringUnique invite token
emailstringInvitee email
statusInvitationStatuspending / accepted / expired
expiresAtstringISO timestamp

9. Grant Applications (grantApplications)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK

10. Grant Pipeline (grantPipeline)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK

11. Active Grants (activeGrants)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK

12. Expense Allocations (expenseAllocations)

FieldTypeDescription
idstringAuto-generated
grantIdstringFK to activeGrants
expenseIdstringFK to expenses
budgetLineIdstringFK to budget line item
amountnumberAllocated amount
allocatedBystringUser ID

13. Audit Logs (auditLogs)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK

14. Security Events (securityEvents)

FieldTypeDescription
idstringAuto-generated
typestringfailed_login, suspicious_login, unusual_access, etc.
userIdstring?Affected user
severitystringinfo / warning / critical
ipAddressstringSource IP
resolvedbooleanResolution state

15. System Events (systemEvents)

Generic event collection for Novu notification triggers. No fixed schema (Record<string, unknown>).

16. Deadlines (deadlines)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK
typeDeadlineTypeproject_end, report_due, etc.
titlestringHuman-readable title
dueDatestringISO date
projectIdstring?Optional project link
assignedTostring[]?User IDs
priorityDeadlinePrioritylow / medium / high / critical
statusDeadlineStatusupcoming / due_soon / overdue / completed / cancelled

17. Compliance Summaries (complianceSummaries)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK
periodStartstringStart of reporting period
periodEndstringEnd of reporting period
overall.statusComplianceStatusAggregated status
overall.scorenumber0-100 score
overall.riskLevelRiskLevellow / medium / high

18. Compliance Alerts (complianceAlerts)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK
typestringjournal / expense / report / budget
severityRiskLevellow / medium / high
statusstringactive / acknowledged / resolved
titlestringAlert title
resourceIdstringFK to triggering entity

Hierarchical Collections (Subcollections)

Organization Sub-structure

Path: organizations/{orgId}/
SubcollectionFirestore PathTypeScript TypePurpose
ConfigconfigAppSettingsApp settings & secrets
API KeysapiKeysApiKeyExternal integration keys
WebhookswebhooksWebhookConfigOutgoing event configs
IntegrationsintegrationsIntegrationRecordSync state with external apps
Compliance SummariescomplianceSummariesComplianceSummaryOrg-level compliance rollups
Compliance AlertscomplianceAlertsComplianceAlertOrg-level compliance alerts
Submission MetricssubmissionMetricsSubmissionMetricsAggregated submission stats
OnboardingonboardingOrganizationOnboardingChecklistOrg setup wizard state

Project Sub-structure

Path: projects/{projectId}/
SubcollectionFirestore PathTypeScript TypePurpose
Document ChunksdocumentChunksDocumentChunkRAG system text chunks
Processed DocumentsprocessedDocumentsProcessedDocumentFile processing metadata
Compliance RulescomplianceRulesCompliancePolicyProject-specific constraints
AI Processing LogsaiProcessingLogsAIProcessingLogGenkit processing audit trail
Budget ForecastsbudgetForecastsBudgetForecastFinancial projections
Budget AlertsbudgetAlertsBudgetAlertBudget threshold warnings

Grant Pipeline Sub-structure

Path: grantPipeline/{pipelineId}/
SubcollectionFirestore PathTypeScript TypePurpose
TaskstasksPipelineTaskTo-dos for a proposal
DocumentsdocumentsPipelineDocumentSupporting files/drafts
ActivitiesactivitiesPipelineActivityTimeline/Comment log

Rule Engine Collections

The Rule Engine supports a two-tier compliance system: platform-wide rules managed by SuperAdmins, and tenant-level rules that organizations can customize.

19. Compliance Rules / Policies (compliance_rules)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK (platform_default for built-in rules)
projectIdstring?Optional project scope
codestring?Rule code (e.g., F-01)
titlestring?Short name
categoryCompliancePolicyCategoryfinancial, reporting, procurement, etc.
policystringNatural language description
severityCompliancePolicySeveritySeverity level
policyStatusstringactive / draft / archived
isCustombooleanWhether custom or adopted from platform
donorTypesGrantorType[]Applicable donor types
The code aliases complianceRules and compliancePolicies both point to the same compliance_rules Firestore path.

20. Rule Templates (rule_templates)

FieldTypeDescription
idstringAuto-generated
donorTypeGrantorTypeTarget donor type
isPublicbooleanWhether visible to tenants
Platform-wide donor profile templates that organizations can adopt.

21. Grant Rules — Junction Table (grant_rules)

FieldTypeDescription
idstringAuto-generated
projectIdstringFK to projects
isActivebooleanWhether the rule-grant link is active
Tracks which compliance rules apply to which grants/projects.

22. Rule Violations (rule_violations)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK
projectIdstringFK to projects
statusstringactive / resolved
Detected violations of compliance rules.

23. Rule Analytics (rule_analytics)

FieldTypeDescription
idstringAuto-generated
Performance metrics for rule evaluation (execution time, violation rates, etc.).

24. Platform Rules (platform_rules)

FieldTypeDescription
idstringAuto-generated
codestring?Rule code
titlestring?Short name
policystringNatural language description
categoryCompliancePolicyCategoryCategory
severityCompliancePolicySeveritySeverity
policyStatusPolicyStatusACTIVE / DRAFT / ARCHIVED
isPublicbooleanWhether visible to tenants
donorTypesGrantorType[]Applicable donor types
frequencyPolicyFrequencyHow often to evaluate
automationPotentialPolicyAutomationPotentialAutomation level
No organizationId — these are SuperAdmin-managed, platform-wide.

25. Tenant Donor Configs (tenant_donor_configs)

FieldTypeDescription
idstringSame as organizationId
Tracks donor types an organization works with and rule recommendations. One document per organization.

Relations Module Collections

26. Contacts (contacts)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK
recordTypeContactRecordTypePERSON / ORGANIZATION
displayNamestringPrimary display name
emailstring?Email address
relationshipGroupsRelationshipGroup[]Tags: donor, partner, etc.
ownerstring?Assigned user ID

27. Interactions (interactions)

FieldTypeDescription
idstringAuto-generated
contactIdstringFK to contacts
organizationIdstringTenant FK
typeInteractionTypecall, email, meeting, note, etc.
titlestringSummary
timestampstringISO timestamp
createdBystringUser ID
hubspotSyncStatusobject?HubSpot engagement sync state

28. Contact Views (contactViews)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK
namestringView name
createdBystringOwner user ID
isDefaultbooleanDefault view flag
filtersobjectSaved filter criteria

Grantor Relationship Management Collections

29. Foundations (foundations)

FieldTypeDescription
idstringAuto-generated
Global registry of grant-making bodies. Typed as TaxonomyItem. Shared across tenants.

30. Grantor Interactions (grantorInteractions)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK
grantorIdstringFK to foundations
grantorNamestringDenormalized name
contactIdstring?Optional FK to contacts
typeInteractionTypecall, email, meeting, etc.
directionstringinbound / outbound
subjectstringInteraction subject
summarystringDescription
sentimentInteractionSentiment?positive / neutral / negative
followUpDatestring?Next follow-up ISO date
followUpCompletedbooleanFollow-up tracking

31. Reporting Deadlines (reportingDeadlines)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK
grantorIdstringFK to foundations
grantorNamestringDenormalized name
projectIdstring?Optional project scope
titlestringDeadline title
dueDatestringISO date
statusReportingDeadlineStatusupcoming / due-soon / overdue / completed / cancelled

32. Grantor Rule Conflicts (grantorRuleConflicts)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK
projectIdstringFK to projects
projectNamestringDenormalized
ruleCategoryComplianceMatrixCategoryCategory of conflicting rule
ruleNamestringRule name
statusstringactive / resolved
grantorsarrayList of conflicting grantors with their values

HubSpot Integration Collections

33. HubSpot Configs (hubspotConfigs)

FieldTypeDescription
idstringSame as organizationId
organizationIdstringTenant FK
accessTokenstringOAuth access token (encrypted at rest)
refreshTokenstringOAuth refresh token
expiresAtstringToken expiry ISO timestamp
portalIdstringHubSpot account ID
connectedBystringUser who connected
One document per organization.

34. HubSpot Sync Logs (hubspotSyncLogs)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK
syncTypeHubSpotSyncTypeType of sync operation
directionstringto_hubspot / from_hubspot
triggeredByHubSpotSyncTriggermanual / webhook / scheduled
startedAtstringISO timestamp
statusHubSpotSyncStatusStatus of the sync
totalRecordsnumberRecords processed
successCountnumberSuccessful records

Stakeholder Portal Collections

35. Portal Tokens (portalTokens)

FieldTypeDescription
idstringCrypto-random 32-char token (also document ID)
organizationIdstringTenant FK
projectIdstringProject being shared
createdBystringUser who created the link
stakeholderNamestringDisplay name for the stakeholder
expiresAtstring?Optional expiry
permissionsobjectGranular access flags

36. Portal Sessions (portalSessions)

FieldTypeDescription
idstringAuto-generated
tokenIdstringFK to portalTokens
organizationIdstringTenant FK
projectIdstringProject being viewed
startedAtstringSession start ISO timestamp
ipAddressstringAccessor IP
Audit trail for stakeholder access events.

37. Portal Comments (portalComments)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK
projectIdstringProject being discussed
tokenIdstring?Token ID if posted by stakeholder
authorTypestringorganization / stakeholder
authorNamestringDisplay name

38. Portal Report Acknowledgments (portalReportAcknowledgments)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK
projectIdstringProject the report belongs to
reportIdstringFK to generated report
tokenIdstringToken used to acknowledge
statusReportAcknowledgmentStatusAcknowledgment status
stakeholderNamestringWho acknowledged

Mission Credits & Gamification Collections

39. Mission Credits (missionCredits)

FieldTypeDescription
idstringSame as userId (one wallet per user)
userIdstringFK to employees
organizationIdstringTenant FK
balancenumberCurrent credit balance (EUR)
totalEarnednumberLifetime total earned
totalRedeemednumberLifetime total redeemed
referralCountnumberSuccessful referrals count

40. Credit Transactions (creditTransactions)

FieldTypeDescription
idstringAuto-generated
userIdstringFK to employees
organizationIdstringTenant FK
typeCreditTransactionTypeearn / redeem / adjustment
amountnumberPositive for earn, negative for redeem
balanceBeforenumberBalance before transaction
balanceAfternumberBalance after transaction
referralIdstring?If earned via referral
redemptionIdstring?If redeemed

41. Credit Redemptions (creditRedemptions)

FieldTypeDescription
idstringAuto-generated
userIdstringFK to employees
organizationIdstringTenant FK
redemptionTypeRedemptionTypegift_card / org_discount / etc.
amountnumberCredits spent
statusRedemptionStatuspending / processing / completed / failed
giftCardTypeGiftCardType?If gift card redemption

42. Badges (badges)

FieldTypeDescription
idstringAuto-generated
userIdstringFK to employees
organizationIdstringTenant FK
achievementTypeAchievementTypeBadge category
namestringBadge display name
iconstringEmoji or icon identifier
earnedAtstringISO timestamp

43. Gamification Preferences (gamificationPreferences)

FieldTypeDescription
idstringSame as userId (one doc per user)
User opt-in/out preferences for gamification features.

44. Campaigns (campaigns)

FieldTypeDescription
idstringAuto-generated
namestringCampaign name
multipliernumberCredit multiplier (e.g., 2 for double)
startDatestringISO date
endDatestringISO date
activebooleanActive flag
organizationIdstring?If org-specific; omit for platform-wide
createdBystringUser ID

Impact / Monitoring & Evaluation Collections

45. ME Indicators (meIndicators)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK
projectIdstring | nullnull = org-level library template
codestringShort code (e.g., OUT-1)
namestringIndicator name
typeIndicatorTypeoutput / outcome / impact
unitstringMeasurement unit
directionIndicatorDirectionincrease / decrease / maintain
frequencyReportingFrequencymonthly / quarterly / annual
dataSourcestringWhere data comes from
isArchivedbooleanSoft-delete flag
disaggregationsDisaggregationDimension[]Gender, age, etc.
tagsstring[]Classification tags

46. ME Indicator Targets (meIndicatorTargets)

FieldTypeDescription
idstringAuto-generated
indicatorIdstringFK to meIndicators
organizationIdstringTenant FK
projectIdstringFK to projects
periodLabelstringHuman-readable period name
periodStartstringISO date
periodEndstringISO date
targetValuenumberTarget value for the period

47. ME Data Points (meDataPoints)

FieldTypeDescription
idstringAuto-generated
indicatorIdstringFK to meIndicators
organizationIdstringTenant FK
projectIdstringFK to projects
periodStartstringISO date
periodEndstringISO date
valuenumberReported value
disaggregationValuesobjectBreakdown by dimension
sourceDataPointSourcemanual / kobo / import
approvalStatusDataPointApprovalStatusdraft / submitted / approved / rejected
submittedBystring?User ID
approvedBystring?User ID

48. ME Dashboard Configs (meDashboardConfigs)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK
projectIdstringFK to projects
keyIndicatorIdsstring[]Pinned indicators
narrativestringDashboard narrative text
One document per project.

49. ME Kobo Connections (meKoboConnections)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK
labelstringConnection label
serverUrlstringKoboToolbox server URL
apiTokenstringAPI token (encrypted at rest)
isActivebooleanActive flag
lastSyncAtstring?Last successful sync
FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK
projectIdstringFK to projects
connectionIdstringFK to meKoboConnections
koboFormIdstringKoboToolbox form ID
koboFormNamestringForm display name
indicatorMappingsarrayMaps Kobo questions to indicators
syncEnabledbooleanAuto-sync toggle

51. ME Indicator Summaries (meIndicatorSummaries)

FieldTypeDescription
idstringDeterministic: ${indicatorId}_${periodStart}
organizationIdstringTenant FK
projectIdstringFK to projects
indicatorIdstringFK to meIndicators
approvedValuenumber?Aggregated approved value
targetValuenumber?Denormalized target
totalDataPointsnumberCount of data points
Read-only on client — written by Cloud Functions aggregation pipeline.

52. ME Grant Indicator Configs (meGrantIndicatorConfigs)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK
projectIdstringFK to projects
grantIdstringFK to activeGrants
indicatorIdstringFK to meIndicators
grantTargetValuenumber?Per-grant target
weightnumber0-1 for weighted scoring
reportingRequiredbooleanWhether donor requires reporting
donorIndicatorCodestring?Donor’s own code
sdgAlignmentsSDGAlignment[]SDG mapping

53. ME AI Suggestions (meAISuggestions)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK
projectIdstringFK to projects
grantIdstring?Optional grant context
suggestedNamestringAI-suggested indicator name
suggestedCodestringAI-suggested code
rationalestringAI explanation
statusAIIndicatorSuggestionStatuspending / accepted / dismissed
acceptedIndicatorIdstring?FK to created indicator

54. ME Workflow Rules (meWorkflowRules)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK
namestringRule name
isActivebooleanActive toggle
triggerTypeWorkflowTriggerTypeevent / schedule / threshold
triggerSchedulestring?Cron expression
conditionsWorkflowCondition[]AND conditions
actionsWorkflowAction[]Executed in order
triggerCountnumberLifetime trigger count

55. ME Workflow Execution Logs (meWorkflowExecutionLogs)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK
ruleIdstringFK to meWorkflowRules
ruleNamestringDenormalized rule name
triggerTypestringWhat triggered execution
conditionsMatchedbooleanWhether conditions passed
actionsExecutedarrayActions that ran
actionResultsarraySuccess/failure per action
executedAtstringISO timestamp

56. ME Org Settings (meSettings)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK
defaultReportingFrequencyReportingFrequencyDefault for new indicators
requireDataApprovalbooleanEnable approval workflow
notifyOnSubmissionbooleanNotification preference
notifyOnAnomalybooleanAnomaly alert toggle
koboAutoSyncFrequencystringhourly / daily / weekly
One document per organization.

Taxonomy Collections

57. Budget Categories (budgetCategories)

Global taxonomy collection typed as BudgetCategory.

58. Mission Pillars (missionPillars)

Global taxonomy collection typed as MissionPillar.

59. Donors (donors)

Legacy taxonomy collection typed as TaxonomyItem. May overlap with settings-based donor configuration.

Platform Management Collections (SuperAdmin)

60. Imuseration Sessions (imuserationSessions)

FieldTypeDescription
idstringAuto-generated
superAdminIdstringThe SuperAdmin user ID
targetOrganizationIdstringOrg being imuserated into
reasonstringRequired justification
startedAtstringISO timestamp
isActivebooleanActive session flag
ipAddressstringSource IP

61. Auditor Access Grants (auditorAccessGrants)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK
auditorIdstringUser ID with AUDITOR role
grantedBystringAdmin who granted access
grantedAtstringISO timestamp
expiresAtstringAccess expiry
scopestringfull / limited
limitedToProjectIdsstring[]?If limited scope

62. Config Snapshots (configSnapshots)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK
createdBystringAuditor ID
snapshotTypestringmanual / scheduled / pre_audit
snapshotobjectCaptured configuration state

63. Audit Export Jobs (auditExportJobs)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK
requestedBystringAuditor or Admin ID
statusstringpending / processing / completed / failed
formatstringcsv / json / pdf
filtersobjectDate range, user IDs, actions, etc.

64. Platform Metrics (platformMetrics)

FieldTypeDescription
timestampstringSnapshot timestamp
totalUsersnumberPlatform-wide total
activeUsersnumberActive in last 30 days
totalOrganizationsnumberTotal tenants
totalProjectsnumberTotal across all tenants

65. User Growth Metrics (userGrowthMetrics)

FieldTypeDescription
periodstringYYYY-MM format
newUsersnumberNew signups
activeUsersnumberActive during period
churnedUsersnumberLost users
retentionRatenumberPercentage
growthRatenumber% change from previous period

66. Retention Cohorts (retentionCohorts)

FieldTypeDescription
cohortMonthstringYYYY-MM when users joined
totalUsersnumberCohort size
retentionByMonthobjectRetention at month 1, 2, 3, 6, 12

67. Organization Metrics (organizationMetrics)

FieldTypeDescription
organizationIdstringTenant FK
organizationNamestringDisplay name
subscriptionTierSubscriptionTierCurrent plan
totalUsersnumberUser count
healthScorenumber0-100
riskLevelstringChurn risk: low / medium / high

68. Auditor Reports (auditorReports)

FieldTypeDescription
idstringAuto-generated
organizationIdstringTenant FK
projectIdstring?Optional project scope
generatedBystringUser ID
reportTypestringactivity_eligibility, category_compliance, staff_allocation, objective_alignment

Platform-Wide & Config Collections

69. Grant Opportunities (grantOpportunities)

FieldTypeDescription
idstringAuto-generated
Platform-wide marketplace / external grant library. No organizationId.

70. Organizations (organizations)

FieldTypeDescription
idstringAuto-generated (tenant ID)
Root-level tenant documents. Parent for organization subcollections.

71. Config (config)

Global platform settings. Contains singleton documents:
Document IDTypePurpose
referralProgramReferralProgramConfigReferral program settings
roles{ defaultRoles: Role[] }Default RBAC roles
Subcollection: config/security/policiesSecurityPolicy documents.

Name-Mapping Gotchas

These collections have Firestore path names that differ from their logical domain:
Logical DomainCode AliasActual Firestore PathTypeScript Type
UsersusersemployeesUser
Journals (time tracking)journalsjournalsJournalEntry
Journal SubmissionsjournalSubmissionsjournalSubmissionsJournalSubmission

Storage Structure (Cloud Storage)

Standardized folder structure for binary files:
  • tenants/{orgId}/users/{userId}/avatar: Profile pictures.
  • tenants/{orgId}/projects/{projectId}/docs: Project-specific files.
  • tenants/{orgId}/grants/{grantId}/contracts: Legal documentation.
  • tenants/{orgId}/expenses/{expenseId}/receipts: Proof of spend.

Maintenance

Update this document when:
  • Creating a new directory in src/features.
  • Adding a new collection() call in src/core/firestoreCollections.ts.
  • Changing the Firestore Security Rules (firestore.rules).

Update Checklist

  1. Add collection to src/core/firestoreCollections.ts.
  2. Update this Markdown file with the new entry.
  3. Verify organizationId is present in the document type definition.