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
| Status | Updated | Covered Directories |
|---|---|---|
| 🟢 Stable | 2026-02-16 | src/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
organizationIdscoping. - 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
systemEventscollection 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:
BaseServicemethods requireorganizationIdfor scoping. - Client Context: The
OrganizationContextprovides the current active tenant ID.
4. Data Layer
- NoSQL: Firestore provides flexible schemas for diverse grant types.
- Type-Safe Access: The
collectionsanddocshelpers insrc/core/firestoreCollections.tsprovide strongly-typed references to all data.
Technology Stack
| Layer | Technology |
|---|---|
| Foundation | React 19, TypeScript, Vite |
| Logic | BaseService (Custom), EventBus (Custom), Zod |
| Backend | Firebase (Auth, Firestore, Functions, Storage, Analytics) |
| Notifications | Internal system (src/features/notifications) + Postmark (email) + FCM (push) |
| Styling | Tailwind CSS, shadcn/ui |
| Testing | Vitest, Playwright, Firebase Emulators |
| Observability | Sentry |
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.