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/grants/grants.md.
Grants
Overview
The Grants feature provides comprehensive grant management across four interconnected modules: Discovery (finding opportunities), Pipeline (tracking applications), Application (managing proposals), and Post-Award (managing active grants). It enables organizations to discover funding, evaluate eligibility, submit proposals with AI-assisted writing, track applications through a Kanban pipeline, and manage compliance, disbursements, and reporting for awarded grants. This feature is the grant lifecycle hub, connecting funders (via Grantors), projects (via GrantAward links), and financial tracking (via expenses and budget allocations).Data Model
Firestore Collections
| Collection | Document Type | Description |
|---|---|---|
grantOpportunities | GrantOpportunity | Discoverable grant opportunities from external sources or manual entries; contains eligibility, funding, deadlines, and AI-enhanced match scoring. |
grantPipeline | GrantPipelineEntry | Opportunities tracked through application stages (prospect → won/lost); includes probability, weighted value, team assignments, tasks, documents, and activity. |
grantApplications | GrantApplication | Formal grant applications linked to pipeline entries; contains proposal sections, budget, compliance checks, and submission metadata. |
activeGrants | ActiveGrant | Post-award active grants with award details, disbursement schedule, reporting obligations, and impact goals; represents a won grant under execution. |
pipelineTasks— Task items within a grant workspacepipelineDocuments— Documents uploaded to a grant workspacepipelineActivities— Activity log entries (comments, status changes, uploads)
Key TypeScript Types
GrantOpportunity- Core fields:
title,description,grantorId,source(EU Portal, fundsforNGOs, etc.) - Funding:
fundingRange(min/max, currency) - Eligibility:
geographicScope,sectors,organizationTypes - Deadlines:
openDate,closeDate,rollingDeadline - AI:
matchScore(0–100 per org),sdgAlignment(UN goals),extractedRequirements,tags - Status:
active|closed|upcoming|archived
- State:
stage(prospect, preparation, submitted, won, lost, dead),probability(0–100) - Financial:
requestedAmount,weightedValue(amount × probability/100) - Dates:
targetSubmissionDate,actualSubmissionDate,decisionDate,expectedDecisionDate - Team:
assignedTo(user IDs),leadContact - Workspace metadata:
tasksCount,documentsCount,commentsCount,lastActivityAt - History:
stageHistoryarray tracking stage transitions with timestamps and reasons - Notes:
notes,rejectionReason
- Links:
pipelineId,opportunityId(empty if not discovery-linked) - Content:
proposal(array ofProposalSectionwith word counts),budget(line items + total) - Compliance:
complianceChecks(status + findings array) - Submission:
submittedAt,submittedBy,confirmationNumber
- Award details:
awardedAmount,startDate,endDate,grantNumber,awardDate - Budget tracking:
approvedBudget(line items),totalSpent,budgetUtilization(percentage) - Disbursements:
disbursementSchedule(tranches with expected/actual dates and status) - Reporting:
reports(type + dueDate + status) per reporting rule - Links:
projectId|projectIds(one or many per award),allowsProjectSplitflag - Status:
active|completed|terminated|suspended
- Tasks:
pipelineId,title,assignedTo,dueDate,status(todo, in_progress, completed),priority(low, medium, high) - Documents:
pipelineId,name,type(proposal, budget, supporting, contract, report),storageUrl(Firebase path), versioning - Activities:
pipelineId,type(comment, status_change, document_upload, task_update, assignment),userId,userName,content,metadata
Key Behaviors
Grant Discovery
Module:src/features/grants/discovery/
Route: /grant-discovery/:tab — Tabs: Search (default), Recommendations, Deadlines
View Modes: Grid, List, Table (with virtual scrolling via @tanstack/react-virtual)
- Grant Opportunity Search: Fetch opportunities from external sources or browse manual entries, with advanced filtering via
GrantFiltersPanel(funding range, eligibility, sector, deadline, AI match score). - Eligibility Evaluation: Assess organization eligibility against geographic scope, organization type, and sectoral criteria; flag ineligible opportunities.
- AI-Enhanced Matching: Calculate match score (0–100) and SDG alignment for each opportunity relative to organization’s mission and sectors. Recommendations tab highlights high-match opportunities.
- Deadline Calendar: Deadlines tab shows upcoming close dates with severity visualization.
- Manual Entry: Create custom opportunities for known funders or tracking external grants not in automated sources.
- Source Display: Color-coded source badges (RVO, EU Portal, DUS-I, ZonMw, Overheid.nl, Rijksoverheid, Manual).
Pipeline Management (Grant Tracker)
Module:src/features/grants/tracker/
Route: /grant-tracker/:tab — Tabs: Pipeline (default), Deadlines, Analytics, Archive
- Pipeline (Kanban): Drag-and-drop board for transitioning opportunities through stages (prospect → preparation → submitted → won/lost/dead). Filter by stage, probability, and conversion status.
- Probability & Weighted Value: Assign probability per stage (prospect: 10%, preparation: 25%, submitted: 40%, won: 100%); calculate weighted value for revenue forecasting.
- Deadlines Tab: Deadline-based severity visualization (overdue, within 7 days, within 30 days) across all pipeline entries.
- Analytics Tab: Conversion rates, average deal size, time-to-decision metrics, and stage stats with count and weighted value.
- Archive Tab: Won, lost, and dead grants for historical review.
- Stage History: Track all stage transitions with timestamp, user, and optional reason; support reversals and case history.
- Workspace Artifacts: Organize tasks, documents, and comments per pipeline entry; auto-count and surface via metadata.
Grant Application & Proposal Writing
Module:src/features/grants/application/
Route: /grant-application/:tab — Tabs: Active (default), Pipeline, Archive
The page organizes applications across three lifecycle tabs. Within each application, the editing workflow provides Proposal Editor, Budget Builder, and Compliance Check capabilities.
- Active Tab: Current in-progress applications with editing and submission capabilities.
- Pipeline Tab: Kanban-style view of applications in different stages.
- Archive Tab: Completed, submitted, and archived applications.
- Proposal Editor: Create and edit multi-section proposals with word-count tracking and section-level requirements (max words, mandatory).
- AI-Assisted Writing: Leverage Genkit + Gemini to generate proposal sections, refine language, and assess quality; ProposalAIService provides context-aware suggestions.
- Budget Builder: Construct line-item budgets (personnel, equipment, travel, etc.) with quantity/unit-cost calculations; link to grant’s requested amount.
- Compliance Check: Automated assessment against eligibility criteria, sectoral restrictions, and organizational constraints; flag warnings and failures with dynamic compliance percentage badges.
- Application State: Save drafts, resubmit, and track submission metadata (confirmation number, timestamp).
Post-Award Grant Management (Grant Control)
Module:src/features/grants/post-award/
Route: /grant-control/:tab — Tabs: Overview (default), Financials, Milestones, Reports, Contacts
The page features a grant selection sidebar on the left for switching between active grants, with tab content on the right. Uses OperatingKpiStrip and OperatingInsightStrip for contextual KPIs and alerts.
- Overview Tab: Award summary, KPIs (awarded amount, budget utilization, disbursements, reporting status), and operational insights.
- Financials Tab: Budget progress visualization with color-coded budget lines, disbursement schedule with expected/actual tracking.
- Milestones Tab: Project milestones and deliverables linked to the grant.
- Reports Tab: Reporting obligations tracking (financial, narrative, impact, interim, final) per funder rules.
- Contacts Tab: Grantor contacts and portal token management for stakeholder visibility.
- Award Registration: Convert a won pipeline entry to an ActiveGrant, capturing award amount, start/end dates, disbursement schedule, and reporting rules.
- Project Linking: Link award to one project (default) or multiple projects (if split allowed); seed project timelines with reporting deadlines.
- Grant Lifecycle Status: Track as active, completed, terminated, or suspended; auto-mark at-risk if budget utilization exceeds 90%.
Service Contract
| Service | Owns | Key Methods |
|---|---|---|
| GrantService | All CRUD operations, validation, event emission, audit logging | getOpportunities(), addToPipeline(), createOpportunity(), getPipeline(), updatePipelineStage(), updatePipelineEntry(), removePipelineEntry(), getTasks/addTask/updateTask/removeTask(), getDocuments/addDocument/removeDocument(), getActivities/addActivity(), getApplications(), saveApplication(), submitApplication(), getActiveGrants(), convertToActiveGrant(), updateActiveGrant() |
| useGrantsList (Query Hook) | Aggregated query of all four collections per organization, powered by React Query | useGrantsList() returns { opportunities, pipeline, applications, activeGrants } with individual loading states |
| useGrantMutations (Mutation Hook) | Mutation wrappers for all write operations with optimistic updates and error handling | updatePipelineStage(), updatePipelineEntry(), saveApplication(), submitApplication(), convertToActiveGrant(), updateActiveGrant(), etc. |
Events
Emitted
| Event | Trigger | Severity | Persisted |
|---|---|---|---|
GRANT_ADDED_TO_PIPELINE | addToPipeline() — opportunity added to pipeline | INFO | Yes |
GRANT_PIPELINE_STAGE_CHANGED | updatePipelineStage() — entry transitioned between stages | INFO | Yes |
GRANT_APPLICATION_SUBMITTED | submitApplication() — application formally submitted | INFO | Yes |
GRANT_WON | convertToActiveGrant() — pipeline entry awarded and converted | INFO | Yes |
GRANT_ADDED_TO_PIPELINE:pipelineId,opportunityId,grantTitle,grantorName,requestedAmount,currency,addedBy,addedAtGRANT_WON:grantId,pipelineId,opportunityId,grantTitle,grantorName,awardedAmount,currency,startDate,endDate
emitCanonicalSystemEvent() with non-critical execution (errors logged but do not fail the operation) to ensure notifications flow without blocking core workflows.
Consumed
The Grants feature does not consume system events; it is a producer of workflow events that other features (e.g., Projects, Notifications, Auditor) can subscribe to for downstream actions.Dependencies
-
Depends on:
- Grantors — Uses grantor/funder entities (stored as Contacts)
- Projects — Links active grants to projects via
projectId(one-to-one or one-to-many split mode) - Expenses — Reads expenses to calculate grant spending and budget utilization
- AI — Uses Genkit (ProposalAIService) for proposal writing assistance
- Documents — Stores proposal, budget, and supporting documents in Firebase Storage
-
Depended on by:
- Projects — Consumes award details (budget, deadlines) when a GrantAward links to a project
- Auditor — Subscribes to grant events for compliance tracking and audit logging
- Reports — Includes grant KPIs and post-award financials in organization-wide reports
- Notifications — Consumes grant events to notify stakeholders of submissions and awards
File Structure
Last Updated: April 2026 Architecture: Modular; four sub-modules (Discovery, Tracker, Application, Post-Award) organized by concern with shared GrantService and hooks. Each module has URL-driven tabs with automatic legacy redirect mapping.