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.

Architecture Overview

StatusUpdatedCovered Directories
🟢 Stable2026-02-16src/core, src/shared

System Context

GrantMaster is a multi-tenant SaaS platform designed for NGOs to manage the full lifecycle of grants, projects, budgets, and compliance. It centralizes data for diverse stakeholders (Admins, Project Managers, Auditors, and Funder Portals).

High-Level Architecture

Core Architectural Patterns

1. Service Layer (BaseService)

All business logic is encapsulated in services that extend BaseService. This enforces:
  • Type Safety: Runtime validation via Zod.
  • Tenancy: Mandatory organizationId scoping.
  • Auditability: Automatic logging of successful and failed operations.
  • Resilience: Centralized error handling and reporting.

2. Event-Driven Orchestration (EventBus)

The system uses a lightweight in-memory EventBus to decouple modules.
  • Decoupling: Services emit events (e.g., GRANT_AWARDED) without knowing who reacts to them.
  • Side Effects: Listeners handle notifications, cache invalidation, and cross-module updates.
  • Persistence: Critical system events are persisted to Firestore in the systemEvents collection for long-term auditing.

3. Multi-Tenancy

GrantMaster uses a Logical Isolation model:
  • Tenant ID: Every document in root collections contains an organizationId.
  • Enforcement:
    • Security Rules: Firestore rules prevent cross-tenant reads/writes.
    • Service Layer: BaseService methods require organizationId for scoping.
    • Client Context: The OrganizationContext provides the current active tenant ID.

4. Data Layer

  • NoSQL: Firestore provides flexible schemas for diverse grant types.
  • Type-Safe Access: The collections and docs helpers in src/core/firestoreCollections.ts provide strongly-typed references to all data.

Technology Stack

LayerTechnology
FoundationReact 19, TypeScript, Vite
LogicBaseService (Custom), EventBus (Custom), Zod
BackendFirebase (Auth, Firestore, Functions, Storage, Analytics)
NotificationsInternal system (src/features/notifications) + Postmark (email) + FCM (push)
StylingTailwind CSS, shadcn/ui
TestingVitest, Playwright, Firebase Emulators
ObservabilitySentry

Maintenance

Update this document when:
  • Adding a major third-party integration.
  • Changing the foundation layer (e.g., migrating from SPA to Next.js).
  • Modifying the core inheritance pattern of BaseService.