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.

Data Flow Traces

End-to-end traces showing how data flows through the GrantMaster system for key workflows. Each trace follows the path from user action to final state.

Trace 1: Expense Submission & Approval

Submit an Expense

StepFileFunction/Method
Form validationsrc/hooks/useZodForm.tshandleSubmit()
Create expensesrc/features/expenses/services/ExpenseService.tscreate()
Submit for approvalsrc/features/expenses/services/ExpenseWorkflowService.tssubmitExpenses()
EventBus emission@/core/eventBusemit(EXPENSE_SUBMITTED)
Firestore collectionexpensesDocument type: Expense

Approve an Expense

StepFileFunction/Method
Manager clicks ApproveApproval UI componenthandleApprove()
Status transitionExpenseWorkflowService.tsapproveExpenses()
Firestore updateexpenses collectionstatus: 'approved'
EventBus emission@/core/eventBusemit(EXPENSE_APPROVED)
Notification to submitterNotification serviceAutomatic via event listener
Audit logauditLogs collectionAutomatic via logSuccess()

Trace 2: Grant Application Lifecycle

Discovery → Pipeline → Application → Submission

StepFirestore CollectionDocument Type
Pipeline trackinggrantPipelinePipeline entry
Application draftgrantApplicationsGrant application
Active grant (post-award)activeGrantsActive grant record
Key services:
  • src/features/grants/services/ — grant discovery, pipeline, application services
  • src/features/grantors/services/ — grantor/funder relationship management

Trace 3: User Onboarding

Sign-Up → Auth → Tenant Provisioning → Guided Tour

StepFileNotes
Authenticationsrc/features/onboarding/components/Auth.tsxEmail/password, Google SSO, invitation links
MFA setupsrc/features/onboarding/components/MfaSetup.tsxOptional, prompted for admins
Tenant provisioningTenant provisioning wizard9 steps: org details → team → settings
Firestore writesemployees (users), organizationsGotcha: employees stores User documents
Guided tour@onboardjs/reactRole-specific steps and checklists

Trace 4: Generic Request Lifecycle (Full Stack)

Generic trace showing every middleware layer a request passes through. Use this to understand where to add logging, validation, or auth checks.

Reading a Trace

Each trace documents:
  • User action — what the user clicks/submits
  • Component — React component handling the interaction
  • Hook — custom hook managing state/mutations
  • Service method — BaseService method processing the operation
  • Firestore collection(s) — where data is written
  • EventBus event(s) — what gets emitted for side effects
  • Side effects — notifications, audit logs, cache invalidation

Key Architectural Invariants

  1. UI → Hook → Service → Firestore — data always flows through the service layer
  2. EventBus only in services — components never emit events directly
  3. All writes validated — Zod schemas enforce data integrity at the service boundary
  4. All queries limited — every Firestore query has explicit limit()
  5. Audit trail automaticlogSuccess() in BaseService handles audit logging