rust-viewflow 0.1.0

Rust workflow library inspired by Viewflow, compatible with Axum and Actix-web
Documentation
# Usage Guide

## Prerequisites

- Rust stable toolchain
- Cargo
- Optional: SQLite/MySQL/PostgreSQL

## 1) Build and test

```bash
cargo check --all-features --examples
cargo test --all-features
```

## 2) Run sample service (Axum)

```bash
cargo run --example leave_request
```

Service endpoint: `http://127.0.0.1:3000`

## 3) Create a leave workflow

```bash
curl -X POST http://127.0.0.1:3000/workflows \
  -H "Content-Type: application/json" \
  -d '{
    "workflow_type": "leave_request",
    "data": {
      "employee_id": "emp-001",
      "manager_id": "mgr-001",
      "hr_id": "hr-001",
      "start_date": "2026-03-01",
      "end_date": "2026-03-03",
      "reason": "annual leave",
      "locale": "en"
    }
  }'
```

## 4) Query workflow and tasks

```bash
curl http://127.0.0.1:3000/workflows/{workflow_id}
curl http://127.0.0.1:3000/workflows/{workflow_id}/tasks
```

## 5) Complete a task

```bash
curl -X POST http://127.0.0.1:3000/tasks/{task_id}/complete \
  -H "Content-Type: application/json" \
  -d '{"data": {"approved": true, "locale": "en"}}'
```

## 6) Actix example

```bash
cargo run --example leave_request_actix --features actix
```

Service endpoint: `http://127.0.0.1:3001`

## 7) Database backends

- SQLite: easiest local startup
- PostgreSQL/MySQL: production deployment
- Memory backend: tests and lightweight runtime

## 8) API summary

- `POST /workflows`
- `GET /workflows/{id}`
- `GET /workflows/{id}/tasks`
- `POST /tasks/{id}/complete`

## License

MIT