rust-viewflow
A Rust business workflow package inspired by viewflow/viewflow, designed for loose coupling and production usage.
Documentation Languages
Language index: docs/README.md
Usage Docs (Multilingual)
- English Usage
- 简体中文使用文档
- 繁體中文使用文件
- Deutsch Nutzung
- Español Uso
- Français Utilisation
- Italiano Utilizzo
- 日本語 使い方
- 한국어 사용 가이드
- Português Uso
- Русский Использование
- Српски Употреба
- Қазақша Қолдану
Highlights
- Workflow core engine independent of web framework
- Optional web adapters for Axum and Actix-web
- Database abstraction trait (
WorkflowDatabase) with pluggable backends - Built-in SQLx backends: SQLite / MySQL / PostgreSQL
- In-memory backend for tests and lightweight deployments
- API abstraction layer (
WorkflowApi) separated from transport - Multi-language task labels in sample flow (
en,zh-CN,zh-TW)
Architecture
src/core: workflow domain model + engine + workflow definitionssrc/db: database trait and backend implementationssrc/api: API contract + Axum/Actix adaptersexamples: runnable demo apps
The coupling direction is one-way:
- Web layer depends on API trait
- API depends on workflow engine trait
- Engine depends on workflow/database traits
- Custom implementations can replace any layer
Install
Feature Flags
axum(default): enables Axum router integrationactix: enables Actix-web scope integration
Examples:
Quick Start (Axum + SQLite)
use Arc;
use ;
use SqlitePool;
# async
Leave Request Sample
The sample leave_request flow includes:
- Manager approval task
- HR approval task (if manager approves)
- Workflow completion or cancellation
You can run:
Then test endpoints:
API Endpoints
POST /workflows- create a workflow instanceGET /workflows/{id}- get workflow detailsGET /workflows/{id}/tasks- list workflow tasksPOST /tasks/{id}/complete- complete a task with payload
Language Support
Like Viewflow's i18n-friendly model, task naming can be locale-aware. In sample workflow:
locale=zh-CN: Chinese (Simplified)locale=zh-TW: Chinese (Traditional)- default: English
You can extend this by implementing your own WorkflowDefinition with custom localization strategy.
Development
Release
One-shot release helper:
Common flows:
# Local preflight only (no commit/push/publish)
# Push to GitHub, run checks, create and push tag
# Full release to crates.io
License
Dual-licensed under either of:
- MIT License (LICENSE-MIT)
- Apache License, Version 2.0 (LICENSE-APACHE)
at your option.