# Workflow Engine – Infonetica Task
A minimal backend service in .NET 8 / C# to manage configurable workflow state machines.
---
## Features
- Define workflows (states + actions)
- Start workflow instances
- Execute actions with full validation
- Query workflows, states, actions, and instances
---
## Requirements
- [.NET 8 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)
- [Postman](https://www.postman.com/downloads/) (for testing)
---
## Running Locally (Windows)
1. Open terminal (PowerShell or CMD)
2. Navigate to project root: /cd WorkflowEngine-
Run the app:
dotnet build dotnet run
-
Service runs at:
http://localhost:5000
- POST
http://localhost:5000/workflows - Body (raw, JSON):
{
"states": [
{ "id": "start", "name": "Start", "isInitial": true },
{ "id": "review", "name": "Review" },
{ "id": "done", "name": "Done", "isFinal": true }
],
"actions": [
{ "id": "toReview", "name": "To Review", "fromStates": ["start"], "toState": "review" },
{ "id": "complete", "name": "Complete", "fromStates": ["review"], "toState": "done" }
]
}- POST
http://localhost:5000/instances - Body:
{
"workflowId": "<copy-from-previous-response>"
}-
To move from
start→review:POST /instances/{instanceId}/actions/toReview
-
Then from
review→done:POST /instances/{instanceId}/actions/complete
- GET
http://localhost:5000/instances/{instanceId}
The app generates random GUIDs like:
82921a6b-b0b2-48e5-ae30-6366cf971fa2
- Data is stored in-memory; restarting the app resets everything.
- Minimal error messages are returned for invalid transitions or states.
- Designed using ASP.NET Core Minimal API and clean service structure.
| Method | Endpoint | Purpose |
|---|---|---|
| POST | /workflows |
Create a new workflow |
| GET | /workflows |
List all workflow definitions |
| GET | /workflows/{id} |
Get a workflow by ID |
| POST | /instances |
Start a new instance |
| GET | /instances |
List all instances |
| GET | /instances/{id} |
Get instance state + history |
| POST | /instances/{id}/actions/{actionId} |
Execute an action transition |
WorkflowEngine/
├── Models/ # State, Action, WorkflowDefinition, WorkflowInstance
├── Services/ # Business logic
├── Program.cs # API endpoints
├── WorkflowEngine.csproj
└── README.md
- No database used
- No extra dependencies added
- All logic is self-contained
Please refer to folder /results in main