Requirements
- Dart SDK 3.13 or higher
- Flutter only when using inspector, editor, or feature packages
Authenticate with pub.vyuh.tech first
`vyuh_workflow_engine` is hosted on the private pub.vyuh.tech registry. Before running pub get, register a Bearer token issued by Vyuh Technologies based on your plan.
Run the one-time setup:
dart pub token add https://pub.vyuh.techDon't have a token yet? Email [email protected] to request one. For full details (CI, Docker, rotation, troubleshooting), see the Pub Token Setup guide.
Add Dependencies
Add vyuh_workflow_engine to your pubspec.yaml as a hosted dependency:
Then resolve dependencies:
Setup
1. Pick storage
Tests and local harnesses use the in-memory adapter:
import 'package:vyuh_workflow_engine/vyuh_workflow_runtime.dart';
final storage = InMemoryWorkflowStorage();PostgreSQL deployments install the durable schema once, then use SupabaseWorkflowStorage:
dart run vyuh_workflow_storage_supabase:install \
--output supabase/migrations/install_workflow_runtime.sqlimport 'package:vyuh_workflow_storage_supabase/vyuh_workflow_storage_supabase.dart';
final storage = SupabaseWorkflowStorage(
client: serviceRoleClient,
schema: WorkflowRuntimeInstaller.defaultSchema,
);The default schema is workflow_runtime. Products share it through tenant_id and application_id on every run.
2. Register a module
final orders = WorkflowModule(
name: 'orders',
workflows: [orderApproval],
activities: [
ActivityBinding.from(reserve, ReservationHandler()),
],
userTasks: [approve],
);Do not register definitions one-by-one after startup. A product exports one module; the server installs it at construction.
3. Construct the runtime
final runtime = WorkflowRuntime(
storage: storage,
modules: [orders],
);Embedded tests can start runs on this runtime. Production hosts start WorkflowServerApplication instead so the HTTP API, workers, timers, and recovery share the same module list.
4. Start a run
final run = await runtime.start(
orderApproval.ref,
order,
metadata: WorkflowRunMetadata(
tenantId: tenantId,
applicationId: applicationId,
startedBy: actorId,
idempotencyKey: requestId,
),
);JSON gateways use startEncoded('orders.approval:v1', payload).