Ananya-m0140/WorkflowEngine

★ 0Forks 0C#GitHub ↗Compare

README

Workflow Engine (Minimal State Machine in .NET)

This is a simple state machine engine built using ASP.NET Core. It allows defining workflows (states and transitions), starting workflow instances, executing actions, and tracking the workflow's current state. This project can be extended for business workflows, approval systems, and automation processes.


Features

  • Create and store workflow definitions.
  • Start and execute workflow instances.
  • Track current state of each workflow instance.
  • REST API support for all operations.

Prerequisites


Getting Started

Step 1: Clone the Repository

git clone https://github.com/Ananya-m0140/WorkflowEngine
cd WorkflowEngine

Step 2: Build and Run

dotnet clean
dotnet build
dotnet run

API Testing Using Postman

1. Create Workflow Definition

Endpoint:

POST http://localhost:5000/WorkflowDefinitions

Request Body:

{
  "id": "flow1",
  "states": [
    {
      "id": "start",
      "name": "Start",
      "isInitial": true,
      "isFinal": false,
      "enabled": true
    },
    {
      "id": "end",
      "name": "End",
      "isInitial": false,
      "isFinal": true,
      "enabled": true
    }
  ],
  "actions": []
}

2. Get All Workflow Definitions

GET http://localhost:5000/WorkflowDefinitions

3. Get Workflow Definition by ID

GET http://localhost:5000/WorkflowDefinitions/flow1
Screenshot 2025-07-17 200322

4. Create Workflow Instance

POST http://localhost:5000/WorkflowInstances?definitionId=flow1
Screenshot 2025-07-17 200346

5. Execute Workflow Instance

POST http://localhost:5000/WorkflowInstances/{instanceId}/execute

Replace {instanceId} with the actual instance ID received from the instance creation response.


6. Get All Workflow Instances

GET http://localhost:5000/WorkflowInstances

Contributors

Ananya-m0140

Issues