Approval Workflow System • 2024

Building flexible approval workflows for any business process.

A flexible and configurable approval workflow engine that supports complex multi-layer approval processes. The system handles both sequential (step-by-step) and parallel (any-approver) approval methods. It's designed to be reusable across multiple modules including leave management, loan applications, and purchase requisitions.

Role
Backend Engineer
Company
Sidmach Technologies
Type
Multi-tenant SaaS
ASP.NET Core 7.0 C# 11 SQL Server 2022 Strategy Pattern State Machine SignalR
MY ROLE AND SUMMARY

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.

Add anime GIF here
(Determined/Let's build moment)

Key Achievement: Built a reusable workflow engine powering approvals across 3+ modules, handling both sequential and parallel approval patterns with real-time notifications.

CHALLENGE, EMPATHY AND PLAN

How do you build one workflow engine that handles every approval process?

Every organization has different approval rules. Some need sequential approvals—manager, then director, then CEO. Others want parallel approvals—any one of these three people can approve. Some have escalation rules—if not approved in 48 hours, escalate to the next level.

And different processes have different needs. Leave requests might need 2 levels of approval. Loan applications might need 4. Purchase requisitions might need approvals based on amount—small purchases need one approval, large ones need three.

Add anime GIF here
(Thinking/Problem-solving)

For employees: They wanted transparency. Where is my request? Who's reviewing it? Why is it taking so long?

For approvers: They needed context. What am I approving? What's the impact? Can I delegate this? Can I reject with comments?

For HR/Admin: They needed control. Set approval chains once, have them apply automatically. Track bottlenecks, identify delays, generate audit trails.

The technical reality: We needed a state machine to track workflow states, a strategy pattern for different approval methods, real-time notifications, escalation handling, and complete audit trails. And it all had to be reusable across modules.

The core question: How do we build a workflow engine that's generic enough for any process yet specific enough to be useful?

THE SOLUTION

State machines meet strategy patterns for flexible workflows.

I built the workflow engine using a combination of State Machine pattern (for tracking states) and Strategy Pattern (for different approval methods). This made the system both flexible and maintainable.

The state machine: Every approvable item goes through states—Pending, In Review, Approved, Rejected. The state machine ensures valid transitions and prevents invalid states. You can't approve something already rejected. You can't reject something already approved.

Sequential vs Parallel approvals: I implemented two strategies. Sequential means approvals must happen in order—level 1, then level 2, then level 3. Parallel means any approver at a level can approve. Organizations configure which strategy per workflow.

Real-time notifications: Using SignalR for real-time updates. When someone approves/rejects, the requester gets notified immediately. When a request lands on your desk, you get notified. No more email delays.

Escalation handling: Configurable escalation rules. If an approval sits pending for X hours, it automatically escalates to the next level or notifies supervisors. Prevents requests from getting stuck.

Add anime GIF here
(Coding/Working hard)

The backend systems powering payroll automation.

Backend Framework
ASP.NET Core 7.0, C# 11, State Machine pattern for workflow states, Strategy pattern for approval methods.
Core Design Patterns
State Machine for state transitions, Strategy pattern for Sequential/Parallel approvals, Observer pattern for notifications, Chain of Responsibility for approval routing.
Real-time Communication
SignalR for real-time notifications, WebSocket connections for live updates, Push notifications for mobile devices, Email notifications for offline users.
Workflow Features
Multi-level approval chains, Sequential approval method, Parallel (any-approver) method, Approval delegation, Comments and rejection reasons.
Advanced Capabilities
Automatic escalation rules, Timeout handling, Approval history tracking, Audit trail for compliance, Reusable across multiple modules.
Integration Design
IApprovable interface for any entity, Generic workflow orchestrator, Event-driven architecture, Module-agnostic implementation.

Visual breakdown of the technical implementation.

Add system architecture diagram here

Entity relationships and data structure.

Add database schema diagram here
IMPACT AND LEARNING

Results that matter.

0
Modules Powered
0
Monthly Approvals
0
Faster Processing
0
Uptime

The workflow engine became the backbone of our approval processes. One engine now powers leave approvals, loan applications, and purchase requisitions. Organizations configure their approval chains once, and the engine handles the rest—routing requests, tracking states, sending notifications.

The real-time notifications using SignalR meant approvers respond faster—75% improvement in average processing time. The escalation rules prevent requests from getting stuck. The audit trail gives complete visibility into who approved what, when, and why.

Add anime GIF here
(Celebration/Success)

What I learned from this:

Design patterns aren't academic—they solve real problems. The State Machine pattern made workflow states manageable. The Strategy pattern made different approval methods pluggable. Without these patterns, the code would have been a mess of if-else statements.

Reusability requires interfaces. Making the workflow truly reusable meant designing the right abstractions. The IApprovable interface was key—any entity implementing it could use the workflow. This took several iterations to get right.

Real-time matters more than you think. The difference between polling for updates and getting real-time notifications isn't just technical—it changes user behavior. People respond faster when they get immediate alerts.

State management is hard. Handling concurrent approvals, preventing race conditions, ensuring valid state transitions—this was more complex than anticipated. Proper locking and transaction handling were crucial.