Introducing WorkflowEngine – Flexible Approval Workflows in .NET 8

Jul 30, 2025 min read

Introducing WorkflowEngine – A .NET 8 Library for Building Flexible Approval Workflows

I’ve recently published WorkflowEngine, a .NET 8 library designed to handle multi-step approval workflows in enterprise systems.
The project started as an internal component in a large system. After identifying reusable patterns across different use cases, I extracted and generalized the logic into a clean, standalone NuGet package.

GitHub: github.com/ThamerMashni/WorkflowEngine
NuGet Packages:


Why This Library Exists

Most enterprise systems, regardless of industry, end up implementing some form of approval workflow. Whether you’re dealing with procurement requests, project proposals, policy changes, or HR forms, the process usually follows a familiar pattern:

  • A request passes through multiple stages (e.g., Manager → Finance → Legal).
  • Each stage is associated with specific roles and allowed actions.
  • Business logic often dictates different routes based on request type, urgency, or requester role.

Despite this commonality, many teams still implement workflows from scratch in each application, leading to duplicated logic, inconsistent behavior, and increased maintenance overhead.

WorkflowEngine was created to solve this problem in a reusable and maintainable way. It provides a general-purpose engine that allows you to:

  • Define your own approval stages and routes using clean, type-safe enums.
  • Assign permissions and allowed actions per role at each stage.
  • Reuse workflow templates across projects with minimal configuration.
  • Integrate directly into your domain models without forcing new architecture patterns.

By abstracting the workflow behavior and exposing a consistent API, WorkflowEngine helps reduce time-to-implementation and improves maintainability in complex systems.

It’s not a one-size-fits-all black box, it’s a flexible foundation that fits naturally into enterprise-grade applications.


Key Features

  • Supports multi-route workflows with conditional activation logic.
  • Defines stage-level permissions (Create, Edit, Approve, Deny, etc.).
  • Includes a fluent builder API to define workflows in a readable way.
  • Uses an integer-based tagging system for flexibility and type safety.
  • Provides ASP.NET Core integration through a DI extension package.
  • Minimal dependencies (Newtonsoft.Json, Microsoft.Extensions.Logging).

Example

var workflow = new SimpleWorkflowBuilder("Document Review", "Document")
    .AddRoute(1)
    .AddStage(1, FlowStageActions.Create | FlowStageActions.Edit, "Author")
    .AddStage(2, FlowStageActions.Approve | FlowStageActions.Deny, "Manager")
    .Build();

Architecture Notes

  • Clean design using:
    • Builder pattern
    • Repository abstraction
    • Extension methods
  • Supports embedding the workflow engine directly into domain entities
  • Workflow data can be persisted via interface-based implementations

Use Cases

  • Document approvals (e.g., policies, procedures, legal reviews)
  • Project and budget proposal workflows
  • HR workflows (leave requests, reimbursements)
  • IT change and release management

What’s Included

  • Core engine in WorkflowEngine.Core
  • ASP.NET Core integration via WorkflowEngine.Extensions.DependencyInjection
  • MVC sample application in the GitHub repository
  • Full documentation and usage examples
  • MIT License

Current Status

  • Version: 0.9.0 (Beta)
  • Target Framework: .NET 8
  • Development Status: Actively maintained and open to community contributions

You can explore the code, try the sample app, or integrate the engine into your own projects.
Feedback, suggestions, and pull requests are welcome.

GitHub Repo: https://github.com/ThamerMashni/WorkflowEngine