Theofilos Paraskevas logo
All posts
Case Study 4 min read

Building an Automated Approval Workflow System with Blazor, .NET and Token-Based Actions

Introduction

Many business applications require processes where an action cannot be completed immediately and needs approval from another user or department.

Common examples include:

  • Document approvals
  • Purchase requests
  • Change requests
  • Service requests
  • Internal workflows

Without automation, these processes often rely on emails, manual follow-ups, and disconnected systems.

This project focused on designing a reusable approval workflow system using Blazor, .NET, automated notifications, and secure token-based actions.

The goal was to create a flexible workflow where requests could be submitted, reviewed, approved, rejected, and tracked through their complete lifecycle.


The Challenge

Traditional approval processes often have several problems:

  • Manual communication between users
  • Lack of visibility into request status
  • No centralized approval history
  • Difficulty enforcing business rules
  • No secure way for external users to respond

The system needed to provide:

  • Automated approval routing
  • Controlled state transitions
  • Secure response links
  • Notification handling
  • Clear workflow tracking

System Architecture

The application was built using a layered architecture:

Blazor Frontend
        |
        |
Application Services
        |
        |
Workflow Engine
        |
        |
Database
        |
        |
Notification Service

Main components:

  • Request Management UI
  • Workflow Service
  • Validation Layer
  • Approval Handler
  • Notification Service
  • Token Validation System

Workflow Design

The workflow dynamically determines the required approval path based on predefined rules.

Example:

Request Created
        |
        ↓
Validation
        |
        ├── Approval Not Required
        |
        └── Approval Required
                |
                ↓
        Await Approval Decision
                |
        ├── Approved
        |
        └── Rejected

This allows different workflows to be implemented without changing the core application structure.


State-Based Workflow Management

The system uses explicit states to control the lifecycle of each request.

Example:

Created
   |
   ↓
Pending Approval
   |
   ├── Approved
   |
   ├── Rejected
   |
   ↓
Completed

State management prevents invalid actions.

Examples:

  • A rejected request cannot continue.
  • A completed request cannot be modified.
  • An approval step cannot be skipped.

This approach makes workflows easier to maintain and extend.


Secure Token-Based Actions

To simplify external approval scenarios, users can perform actions through secure email links without requiring a full application login.

Example:

/response?token=xxxx&action=approve

Each token includes:

  • Random generated value
  • Expiration timestamp
  • Purpose identifier
  • Usage status

Before processing a response, the system validates:

Token Exists        ✓
Token Not Expired   ✓
Token Not Used      ✓
Correct Context     ✓

After a successful action:

Token Used = True

This ensures that every approval action is secure and can only be performed once.


Component Architecture

The application was structured into reusable components.

Request Creation Component

Responsibilities:

  • Data input
  • Validation
  • Workflow initialization
  • Submission handling

Request Editing Component

Responsibilities:

  • Loading existing requests
  • Updating information
  • Applying workflow restrictions
  • Managing available actions

Response Component

Responsibilities:

  • Token validation
  • Processing approval decisions
  • Updating workflow state
  • Displaying feedback

Notification Service

Responsibilities:

  • Sending automated emails
  • Generating action links
  • Informing users about workflow changes

Business Rule Enforcement

Rules were implemented at the application layer to ensure consistency.

Validation Rules

IF requirements are satisfied

    Allow submission

ELSE

    Request additional approval

Locking Rules

After reaching a final workflow stage:

Status = Completed

Result:
Read-only mode

This prevents unwanted changes after completion.


Technology Stack

Frontend

  • Blazor
  • Razor Components
  • Component-based architecture

Backend

  • .NET
  • C#
  • Service-oriented architecture

Data Layer

  • Entity Framework Core
  • SQL Database

Integration

  • Email Services
  • Token Authentication
  • REST-based communication

Engineering Decisions

Why State Machines?

Using explicit workflow states provides:

  • Better control
  • Easier debugging
  • Clear business rules
  • Improved maintainability

Why Token-Based Actions?

Benefits:

  • No additional login requirement
  • Simple user experience
  • Secure temporary access
  • Audit-friendly actions

Benefits

The workflow system provides:

Automation

Reduces manual communication and repetitive tasks.

Transparency

Every request has a clear status and history.

Security

Approval actions are controlled through expiring one-time tokens.

Scalability

New workflow scenarios can be added without redesigning the entire system.


Conclusion

A modern approval system is more than a database record with a status field. It requires controlled state transitions, secure user actions, notifications, and clear business rules.

By combining Blazor, .NET, workflow logic, and token-based approvals, it is possible to build flexible enterprise applications that automate complex processes while maintaining security and traceability.

The same architecture can be applied to many scenarios, including document approvals, purchase workflows, change management, and internal request systems.

Blazor.NETC#WorkflowArchitecture