Documentation Index
Fetch the complete documentation index at: https://grantmaster.dev/llms.txt
Use this file to discover all available pages before exploring further.
How Do I…?
Quick-reference task router for AI agents and new developers. Each entry lists the exact files to touch (in order) and links to deeper docs.Routes & Navigation
Add a new route
- Create your page component in
src/features/[feature]/components/pages/ - Add a route entry in the appropriate domain file under
src/routes/config/:- Grant-related:
src/routes/config/grantDomainRoutes.tsx - Operations (finance, docs, journals, users):
src/routes/config/operationsRoutes.tsx - Platform/admin:
src/routes/config/platformLegacyRoutes.tsx - Public/core:
src/routes/config/publicCoreRoutes.tsx
- Grant-related:
- Use
createLazyRoute()fromsrc/routes/routeLazy.tsxfor code splitting: - Optionally wrap with
withPageGuard()for permission-gated routes
Add a sidebar menu item
- Edit
src/components/layout/navConfig.ts - Add an entry to the appropriate section with
path,label,icon(fromlucide-react), and optionalpermission
Features
Create a new feature module
- Create folder:
src/features/[name]/ - Create subfolders:
components/,hooks/,services/,types/,constants/ - Create barrel export:
src/features/[name]/index.ts - Create context:
src/features/[name]/[Name]Context.tsx - Create service:
src/features/[name]/services/[Name]Service.ts(extendBaseService) - Register modals:
src/features/[name]/modals.registry.ts - Add route (see “Add a new route” above)
- Add nav item (see “Add a sidebar menu item” above)
src/features/expenses/
See: Feature Checklist
Add a new service
- Create
src/features/[feature]/services/[Name]Service.ts - Extend
BaseService<T>fromsrc/core/BaseService.ts - Set
protected collectionNameandprotected serviceName - Return
ServiceResult<T>from all operations - Use
this.withErrorBoundary()for error handling - Use
this.validateInput()for input validation - Use
this.logSuccess()for audit logging
src/features/expenses/services/ExpenseService.ts
See: Service Patterns
Add EventBus events
- Define event type in
@grantmaster/shared/events(SystemEventTypeenum) - Add payload to
EventPayloadMap - Emit from service (never from components):
- Consume in services that need to react
src/features/expenses/services/ExpenseWorkflowService.ts
See: Base Service and EventBus
UI
Create a new page
PageTabs — render content externally, not via the tab content prop:
Add a modal
- Create modal component in
src/features/[feature]/components/ - Register in
src/features/[feature]/modals.registry.ts:
Add a secondary sidebar
Add a data table
- Define columns using
@tanstack/react-tableColumnDef<T>[] - Use
react-windowfor virtual scrolling on large datasets - Add filter/sort state with React hooks
Forms
Create a validated form
UseuseZodForm from @/hooks/useZodForm (NOT useValidatedForm — deprecated).
Testing
Write a unit test
- Create test file colocated with source:
src/features/[feature]/services/MyService.test.ts - Use Vitest:
- Run:
npm run test(watch mode) ornpx vitest run path/to/test.ts
Write an E2E test
- Create test in
tests/e2e/organized by role - Use Playwright:
- Run:
npm run test:e2eornpm run test:e2e:ui
Data
Add a Firestore collection
- Add typed collection reference in
src/core/firestoreCollections.ts(re-exports fromfirestoreCollections.legacy.ts) - Define the document type in
src/features/[feature]/types/ - Create a Zod schema for validation in
src/schemas/
Add a new type
- Create
src/features/[feature]/types/[name].types.ts - Export from barrel:
src/features/[feature]/index.ts - For shared types used across features:
packages/shared/src/orsrc/types/