Skip to content

Crate Layout

Fabric is organized as a Cargo workspace with 14 crates (13 libraries + 1 binary).

CrateTypePurpose
fabric-domainlibTyped IDs (JobId, RunId, WorkflowId, etc.), shared models, errors, time utilities
fabric-protolibProtobuf definitions and codegen (prost/tonic) — canonical Rust types, gRPC service stubs
fabric-authlibJWT validation (Supabase HS256), API key hashing/verification (fab_* prefix), principal resolution, auth middleware
fabric-tenancylibOrganizations, teams, memberships, invitations repository layer
fabric-policylibRBAC evaluation, effective permission computation, resource/action evaluation, authz_guard
fabric-workflowslibDAG definitions, validation (Kahn’s algorithm), runs, node models, context propagation
fabric-executorlib/binStep claiming (SELECT ... FOR UPDATE SKIP LOCKED), node dispatch (Native/Tool/Provider/Wasm), retries, leases, worker loop
fabric-eventslibDomain events, in-process broadcast, persistence, SSE/WebSocket/webhook delivery, audit logs
fabric-assetslibAsset metadata, S3/GCS/local object store abstraction, signed URLs
fabric-providerslibProvider abstraction, registry, routing — OpenAI, Anthropic, Ollama, Whisper, ComfyUI, ONNX, Candle, Echo
fabric-storagelibPersistence abstraction — Postgres (sqlx) + in-memory repos, unified Store enum, usage persistence
fabric-apilibaxum routes, gRPC services, request/response envelopes, auth extraction, validation, jobs API, rate limiter, quotas
fabricbinServer binary with serve (control plane) and executor (execution plane) subcommands

The crates build in dependency order:

1. fabric-proto (protobuf codegen)
2. fabric-domain (pure domain types)
3. fabric-auth ─┐
fabric-tenancy │ (depend on domain + proto)
fabric-workflows ─┘
4. fabric-policy (depends on tenancy + domain)
5. fabric-events (depends on domain)
6. fabric-assets (depends on domain)
7. fabric-providers (depends on domain)
8. fabric-storage (depends on all domain crates)
9. fabric-executor (depends on workflows + providers + storage)
10. fabric-api (depends on all lib crates)
11. fabric (binary, depends on api + executor)
  • tokio — Async runtime
  • axum — HTTP framework (control plane)
  • tonic / prost — gRPC framework and protobuf codegen
  • sqlx — Async Postgres driver
  • serde — Serialization/deserialization
  • uuid — Canonical ID generation
  • time — Timestamp handling
  • tracing — Structured logging
  • onnx-runtime — Actual ONNX inference via ort
  • candle — HuggingFace model loading via Candle
  • wasm-runtime — Wasmtime plugin execution
  • Protobuf is canonical for message contracts — fabric-proto generates the types consumed by all other crates
  • Pure domain layerfabric-domain has no I/O dependencies
  • Storage abstraction — All persistence goes through fabric-storage, which supports both Postgres and in-memory backends
  • Layered architecture — Each crate has a clear boundary and minimal dependencies