Skip to content

Installation

Install the packages that match the surface you are building.

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.tech

Don'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:

pubspec.yaml

Then resolve dependencies:

Setup

1. Pick storage

Tests and local harnesses use the in-memory adapter:

dart
import 'package:vyuh_workflow_engine/vyuh_workflow_runtime.dart';

final storage = InMemoryWorkflowStorage();

PostgreSQL deployments install the durable schema once, then use SupabaseWorkflowStorage:

sh
dart run vyuh_workflow_storage_supabase:install \
  --output supabase/migrations/install_workflow_runtime.sql
dart
import '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

dart
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

dart
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

dart
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).

Optional Packages

PackageUse when
vyuh_workflow_storage_supabasePersist the durable runtime in PostgreSQL.
vyuh_workflow_serviceDeploy the product and operations API.
vyuh_workflow_testkitDrive the runtime with a typed test harness.
vyuh_workflow_inspectorInspect history and recover failed work.
cdx_workflow_typesShare approval and inbox contracts.
cdx_workflow_templatesInstall the canonical approval definition.
cdx_feature_workflowsRender inbox widgets in a Vyuh Flutter app.

What's Next?