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.

Engineering reference: For service contracts, EventBus events, and data-layer details see src/features/users/users.md.

last_updated: 2026-02-22

HR & Users Subsystems

StatusUpdatedCovered Files
🟢 Stable2026-02-22src/features/users/, src/features/users/contracts.ts, src/shared/auth/contracts.ts

Overview

The Users feature is the largest feature module in GrantMaster, providing comprehensive human-resource management capabilities beyond basic user authentication. It manages the full employee lifecycle — from onboarding and role assignment through capacity planning, cost allocation, time-off tracking, training, and offboarding.
Collection gotcha: The Firestore collection is named employees but stores User documents. See src/core/firestoreCollections.ts.

Service Layer (16+ Services)

ServiceResponsibility
UserServiceCore CRUD — create, update, deactivate, search users
UserPreferencesServiceTheme, locale, notification, dashboard preferences
UserDocumentsServiceUpload/manage personal documents (contracts, IDs, certs)
ContactServiceEmergency contacts and external contact records
CostAllocationServiceAllocate employee cost across grants/projects by percentage
EffortCertificationServiceGenerate and sign quarterly effort certifications (OMB Uniform Guidance)
PayrollExportServiceExport payroll data in CSV/Excel for external payroll systems
StaffAllocationServiceAssign staff to projects with FTE percentages and date ranges
TrainingServiceTraining records, certifications, expiry tracking
VolunteerServiceVolunteer profiles, hours, and contribution tracking
OrgChartServiceOrganizational hierarchy, reporting structure, and vacancy management
ContractorServiceIndependent contractor profiles, contract lifecycle, and payment tracking
UserDocumentsServicePersonal document vault with compliance and expiry tracking
timeOffServiceLeave requests, balances, approval workflows
teamMemberRequestsStaff requisition and onboarding requests
userManagementBulk operations — invite, deactivate, role changes

Selector Hooks (11)

All hooks are exported from UserContext and provide optimized, memoized access to user data:
HookReturns
useUser(id)Single user by ID
useUsers()Full user context (list, loading, current user)
useActiveUsers()Only active (non-deactivated) users
useCurrentUser()Currently authenticated user’s profile
useUsersByRole(role)Users filtered by project role
useUsersBySystemRole(role)Users filtered by system role (Admin, Manager, etc.)
useUsersByStatus(status)Users by employment status
useUsersByManager(managerId)Direct reports for a manager
useUserByEmail(email)Lookup by email address
useUsersByIds(ids)Batch lookup by ID array
useInvitedUsers()Users in invited status (pending onboarding)

Component Library (32+ Components)

Core Views

ComponentDescription
UsersMain user list with filters, search, and bulk actions
UserDetailFull user profile with tabbed sections
UserProfileRead-only public profile card
UserPreferencesSettings page (theme, notifications, locale)
UserFiltersFilter bar (role, status, department, manager)
UserToolbarAction toolbar (invite, export, bulk operations)

Modals

ComponentDescription
InviteUserModalSend invitation emails with role pre-assignment
DeactivateUserModalOffboarding confirmation with data retention options
UserDetailsModalQuick-view user details overlay
UserProfileModalEdit profile modal

Subsystem Dashboards

ComponentDescription
StaffAssignmentPlannerDrag-and-drop staff-to-project allocation
StaffingOverviewOrganization-wide staffing summary
EffortCertificationDashboardQuarterly effort cert generation and signing
VolunteerManagementVolunteer onboarding, hours, recognition
TrainingDashboardTraining records, compliance, expiry alerts
UserDocumentsDashboardPersonal document vault (contracts, IDs)
OrgChartDashboardInteractive organizational hierarchy (Tree, Matrix, and List views)
ContractorsDashboardContractor profiles, contract management, and compliance
UserDocumentsDashboardPersonal document vault with compliance status and alerts
CapacityDashboardTeam capacity planning and FTE forecasting

Subsystem Details

Cost Allocation

Distribute employee salary/fringe costs across multiple grants and projects:
interface CostAllocation {
  employeeId: string;
  allocations: {
    grantId: string;
    projectId?: string;
    percentage: number;         // Must sum to 100%
    effectiveDate: string;
    endDate?: string;
  }[];
}
Used for indirect cost recovery calculations and funder billing.

Effort Certification

Complies with OMB Uniform Guidance (2 CFR 200) requirements:
  1. System generates quarterly certification from journal (journal) data
  2. Employee reviews and electronically signs
  3. Supervisor countersigns
  4. Certification stored as auditable record

Staff Allocation

Allocation percentages are date-bounded and must not exceed 100% FTE at any point.

Time-Off Management

FeatureDescription
Leave balancesAccrue PTO, sick, personal days per policy
Request workflowEmployee requests → Manager approves/rejects
Calendar viewTeam-wide leave calendar overlay
Carryover rulesConfigurable year-end carryover limits

Org-Chart & Vacancy Management

The Org-Chart system provides three distinct views for visualizing the organization:
  1. Tree View: Traditional hierarchical layout.
  2. Matrix View: Visualizes reporting lines and cross-functional teams.
  3. List View: Searchable, flat list for quick lookups.
Vacancy Management: Admins can mark positions as vacant and initiate the staff requisition workflow directly from the Org-Chart.

Contractor Management

Comprehensive tracking for independent contractors:
  • Contract Lifecycle: Draft, Active, Expiring, and Terminated states.
  • Compliance: Automatic tracking of mandatory documents (Insurance, NDAs, Licenses) with expiry alerts.
  • Payment Metrics: Integrated view of contract value vs. payments made.

Key Files Reference

FilePurpose
src/features/users/index.tsBarrel export — services, hooks, components
src/features/users/UserContext.tsxReact context with 11 selector hooks
src/features/users/services/UserService.tsCore user CRUD
src/features/users/services/CostAllocationService.tsGrant cost allocation
src/features/users/services/EffortCertificationService.tsOMB effort certs
src/features/users/services/StaffAllocationService.tsProject staffing
src/features/users/services/CapacityService.tsTeam capacity planning
src/features/users/services/timeOffService.tsLeave request management
src/features/users/contracts.tsUser/Employee type definitions