Documentation Index
Fetch the complete documentation index at: https://grantmaster.dev/llms.txt
Use this file to discover all available pages before exploring further.
Workflow Engine Architecture
The GrantMaster Workflow Engine is a decoupled orchestration layer designed to handle complex business logic, approvals, and escalations across the platform.Core Components
1. Approval Routing
The engine uses Approval Domains to categorize and route approval requests.- Service:
ApprovalRoutingService - Logic: Each domain (e.g.,
grant_proposal,expense_report) has a configuration that defines the routing logic (linear, parallel, or threshold-based).
2. Escalation & SLAs
Service Level Agreements (SLAs) are enforced via escalation rules.- Service:
EscalationRuleService - Functionality: Defines timeouts and actions (e.g., re-assigning, notifying a manager) when a workflow step is stalled.
3. Monitoring & Execution Logs
Every workflow execution is logged for auditability and performance monitoring.- Service:
WorkflowMonitorService - Metrics: Tracks rules executed, failures, pending approvals, and delivery stats for notifications.
Execution Flow
- Trigger: An event is emitted (e.g.,
DOCUMENT_SUBMITTED). - Evaluation: The platform evaluates active Workflow Rules to determine if any actions (Approvals, Notifications, etc.) are required.
- Execution: The
PlatformWorkflowRuleServiceexecutes the matched rules. - Observation:
WorkflowMonitorServicerecords the outcome.
Technical Drivers
- Firebase Firestore: Stores configurations (
approvalRoutingConfigs,escalationRules) and logs (platformWorkflowExecutionLogs). - EventBus: Orchestrates communication between the workflow engine and other feature modules.
- Zod: Ensures data integrity of workflow configurations.