I designed and built this approval workflow engine from scratch. The goal was creating something flexible enough to handle different approval processes across different modules—leave requests, loan applications, purchase requisitions—without duplicating code.
I implemented this using the Strategy Pattern combined with a State Machine. Organizations can configure approval chains—how many levels, who approves at each level, whether approvals are sequential or parallel. The system tracks state transitions, handles escalations, and sends real-time notifications.
The challenging part was making it truly reusable. The workflow engine doesn't care what it's approving—it works with any entity that implements the IApprovable interface. This meant leave requests, loans, and purchase orders could all use the same workflow logic.