Documentation Index
Fetch the complete documentation index at: https://grantmaster.dev/llms.txt
Use this file to discover all available pages before exploring further.
Engineering reference: For service contracts, EventBus events, and data-layer details see src/features/grantors/grantors.md.
Grantors Feature
Comprehensive Funder Relationship Management (FRM) system for managing grantor (donor/funding agency) relationships, interactions, deadlines, compliance, and analytics.Overview
The Grantors feature provides tools for nonprofits to:- Manage Funder Relationships: Track and organize all grantor/donor information in a CRM-style system
- Log Interactions: Record touchpoints (emails, calls, meetings, site visits, proposals, reports) with funders
- Track Reporting Deadlines: Auto-generate deadlines from grantor requirements and monitor compliance
- Portfolio Analytics: View performance metrics across all funders (win rate, funding, diversification)
- Compliance Matrix: Identify conflicting requirements across multiple funders on shared projects
- Stakeholder Portal: Token-authenticated external portal for funders to view project progress
TaxonomyItem records in the foundations Firestore collection, with bidirectional links to contacts and projects.
Page Organization
Route:/grantors/:tab — 5 tabs:
| Tab | Value | Description |
|---|---|---|
| Overview | overview | Portfolio-level KPIs, relationship health summary, and operational insights |
| Directory | directory | Searchable grantor list with CRUD, detail sheets, and editor modals |
| Analytics | analytics | Performance charts, concentration risk, funding diversification |
| Reporting | reporting | Reporting obligations calendar and compliance tracking |
| Compliance | compliance | Compliance matrix for cross-funder requirement comparison |
buildGrantorModuleData() which assembles relationships, compliance tracking, and reporting obligations from multiple data sources. Relationship health is classified as Strong, Stable, At Risk, or Dormant.
Note: The legacy tabs Relationships and Stakeholders were retired and consolidated into the remaining 5 tabs.
Key Features
1. Interaction Tracking (CRM)
- Log all funder interactions: emails, calls, meetings, site visits, events, proposals, reports
- Track sentiment (positive/neutral/negative), participants, duration, follow-ups
- Filter by interaction type, date range, sentiment, or funder
- Pending follow-up reminders and completion tracking
- Auto-update grantor’s
lastInteractionDate
2. Reporting Deadlines & Calendar
- Manually create deadlines with due dates, assignees, and notes
- Auto-generate deadlines from
TaxonomyItem.reportingSchedule(frequency + offset days) - Recurring deadline support (monthly, quarterly, semi-annual, annual)
- Deadline status tracking: upcoming → due-soon → overdue → completed
- Calendar view grouped by month with statistics
- Reminder tracking (30, 14, 7, 1 day reminders)
3. Engagement Scoring
- Automated engagement score (0–100) based on:
- Interaction recency (30% weight)
- Communication frequency in last 90 days (30%)
- Project success rate (20%)
- Renewal rate (20%)
- Engagement levels: hot (75+), active (50–74), at-risk (25–49), cold (<25)
- Stored on grantor record as
engagementScore: { score, level, lastCalculated, factors }
4. Portfolio Analytics
Portfolio-level metrics (GrantorPortfolioAnalytics):
- Total grantors, active grantors, active funding value
- Year-over-year growth, diversification score
- Funding breakdown by grantor type
- Win rate, average grant size, grant duration, overhead recovery rate
- Engagement distribution (hot/active/at-risk/cold)
- Concentration risk (Herfindahl-Hirschman Index + top grantor analysis)
- Funding pipeline value and performance
GrantorAnalytics):
- Funding awarded (total, active, completed), average & largest grant
- Project metrics (total, active, completed, success rate)
- Application metrics (total applications, win rate, time-to-decision)
- Relationship duration and renewal rate
- Interaction frequency and recency
- Reporting compliance rate and overdue reports
5. Grantor-Contact Linking
- Link contacts (staff, board) to grantors with roles:
'program-officer' | 'executive-director' | 'board-member' | 'grant-administrator' | 'other' - Mark primary contact for each grantor
- Bidirectional navigation: grantor → contacts, contact → grantors
- Stored as
contacts[]array onTaxonomyItem
6. Compliance Matrix
- Track compliance rules by category: time-tracking, cost-eligibility, reporting, procurement, documentation, audit
- Compare requirements across grantors on shared projects
- Detect conflicts (e.g., Funder A allows X, Funder B disallows X)
- View compliance status per grantor-rule pair: applicable/not-applicable/conflict
- Export compliance matrix for audit trails
7. Grantor Portal
- External token-authenticated portal for stakeholders (funders, auditors, partners) to view project progress
- Separate Vite app at
portal/served onimpact.grantmaster.ai - Portal access managed via
GrantorPortalTabin main app - Token-based auth with expiration and revocation
- 12 visibility flags control what stakeholders see (budget, timeline, team, compliance, impact metrics)
- Stakeholders can submit documents, acknowledge reports, send messages
Data Model
Core Collections
| Collection | Primary Key | Purpose |
|---|---|---|
foundations | id | Grantors/donors (TaxonomyItem with extensions) |
grantorInteractions | id | CRM-style touchpoints with funders |
reportingDeadlines | id | Funder reporting requirements & deadlines |
contacts | id | Funder contacts (shared with other features) |
portalTokens | id | Access tokens for external stakeholder portal |
Grantor (TaxonomyItem) Extensions
Key Types
GrantorInteractionService Contract
GrantorRelationshipService
Interaction ManagementfetchInteractions(organizationId: string)— All interactionsfetchInteractionsByGrantor(organizationId, grantorId)— Filter to grantorcreateInteraction(input)— Log new interaction, auto-update grantor’slastInteractionDateupdateInteraction(id, updates)— Update interaction detailsdeleteInteraction(id)— Remove interactionfetchPendingFollowUps(organizationId)— Interactions with uncompleted follow-upscompleteFollowUp(id, notes?)— Mark follow-up as done
linkContact(grantorId, contactId, role, isPrimary)— Create grantor-contact linkunlinkContact(grantorId, contactId)— Remove linkupdateContactRole(grantorId, contactId, role, isPrimary?)— Change role/primary status
calculateEngagementScore(organizationId, grantorId)— Compute score (0–100) and level (hot/active/at-risk/cold), store on grantor
ReportingCalendarService
Deadline ManagementfetchDeadlines(organizationId)— All deadlines with status recalculationfetchUpcomingDeadlines(organizationId)— Not completedfetchOverdueDeadlines(organizationId)— Past due datecreateDeadline(input)— Manually create deadlineupdateDeadline(id, updates)— Modify deadlinecompleteDeadline(id, completedBy)— Mark completeddeleteDeadline(id)— Remove deadline
generateDeadlinesFromSchedule(organizationId, grantor, project?, createdBy)— Auto-create recurring deadlines fromgrantor.reportingSchedulefor a project date range
getCalendarView(organizationId, startMonth, endMonth)— Group deadlines by month with stats (upcoming, due-soon, overdue, completed)
GrantorAnalyticsService
Portfolio AnalyticscalculatePortfolioAnalytics(organizationId)— Aggregate metrics across all grantors and projects
calculateGrantorAnalytics(organizationId, grantorId)— Relationship metrics for single grantor
Events (Emitted/Consumed)
EventBus Rule Compliance
The grantors feature does not currently emit EventBus events for the following operations:createInteraction— Should emit event when interaction is loggedcompleteFollowUp— Should emit event when follow-up is completedcreateDeadline— Should emit event when deadline is createdcompleteDeadline— Should emit event when deadline is completed (especially for overdue tracking)calculateEngagementScore— Should emit event when engagement level changes (risk escalation)
GRANTOR_INTERACTION_LOGGED— New CRM touchpoint recordedGRANTOR_FOLLOW_UP_COMPLETED— Follow-up task completedREPORTING_DEADLINE_CREATED— New deadline setREPORTING_DEADLINE_OVERDUE— Deadline passed due date (compliance alert)GRANTOR_ENGAGEMENT_LEVEL_CHANGED— Engagement level changed (e.g., active → at-risk)
Events Consumed
The grantors feature does not subscribe to any EventBus events. It is read-only from projects/contacts/foundations data.Dependencies
Internal Features
- projects —
Projectdata, funding source links, project phase tracking - relations —
Contactrecords for grantor-contact linking - organizations —
TaxonomyItemtype, grantor taxonomy
External Libraries
- Firebase — Firestore collections, queries, batch operations
- React Query — Server state caching (via hooks using services)
- React Context — Organization/tenant context (
useCurrentTenant) - Toast notifications — User feedback on CRUD operations
- Recharts (in components) — Data visualization for analytics
Core Services
- BaseService — Inheritance for service pattern, validation, logging
- EventBus — Available but not currently emitting events
- Logger — Operation tracking and error logging
File Structure
Usage Examples
Logging an Interaction
Creating a Deadline
Calculating Engagement Score
Fetching Portfolio Analytics
Testing
- Unit Tests (
tests/*.test.ts) — Compliance matrix logic, compliance detection - Component Tests (
tests/*.test.tsx) — Grantor cards, matrix table rendering - Factories (
tests/factories/) — Test data generation
Key Behaviors
- Interaction Recency —
lastInteractionDateon grantor is auto-updated when any interaction is created - Status Recalculation — Deadline status (upcoming/due-soon/overdue) is computed on each fetch based on current date
- Engagement Decay — Engagement score decreases with interaction recency (−2 points per day without contact)
- Conflict Detection — Compliance conflicts are identified when multiple grantors on a project have conflicting rules (e.g., Funder A allows cost, Funder B disallows)
- Auto-Generation — Deadlines are generated from
reportingSchedulefor the full project date range on deadline creation - Portal Token Validation — Tokens are checked for
isActive === trueandexpiresAt > nowbefore granting portal access
Known Limitations
- Analytics are calculated on-demand (not real-time subscribed)
- No EventBus events currently emitted for compliance/deadline changes (should be added per EventBus rule)
- Compliance matrix requires manual rule definition; no auto-extraction from grant agreements
- Portal is a separate Vite app requiring separate deployment