smithers() wrapper that produces a runnable SmithersWorkflow.
createSmithers is synchronous and SQLite-only. The other factories exist for
the cases it cannot serve: Postgres/PGlite backends, environment-resolved
backends, store migration, and non-JSX (external) build functions.
smithers, useCtx, outputs, tables, and db are returned by the factory.
The factory also returns workflow-context-bound component primitives such as
Workflow and Task; those primitives are additionally exported from
smithers-orchestrator for direct imports. The Components
reference covers that component set; this page covers
the factories themselves.createSmithers
Schema-driven workflow API over a local SQLite database. The schemas you pass become both the output tables and the typedoutputs accessor. This is the
default entry point for almost every workflow.
A map of output name to Zod object schema. Each key becomes a property on
outputs and a backing table. Use the reserved input key to type the
workflow’s run input.Optional metadata and storage configuration.
The typed authoring surface.
create.js · CreateSmithersApi.ts · Tests create-unit.test.js · See also Get started, JSX overview
createSmithersPostgres
PostgreSQL or PGlite equivalent ofcreateSmithers. Asynchronous because it
opens a connection, and it returns an extra close(). Reach for it when a run
must outlive a single process or be shared across hosts.
Same as
createSmithers.Extends
CreateSmithersOptions with the backend connection. A discriminated
union on provider.The same API as
createSmithers, plus close() to release the connection
pool. Call it when the process is done with the backend.create.js · See also Control-plane deployment, migrateSmithersStore
openSmithersBackend
Resolve the backend from the environment instead of hard-coding it. Readssmithers.config / env vars and returns whichever of SQLite, PGlite, or Postgres
they select. Use it in shared CLIs and servers that should honor a deployment’s
configured store.
Optional output schemas. Omit to open the backend without registering tables.
Extends
CreateSmithersOptions.The authoring API for the resolved backend.
close() is present when the
backend holds a connection (PGlite/Postgres).openSmithersBackend.js · Tests openSmithersBackend.test.js · See also Package configuration
migrateSmithersStore
Copy an existing SQLite store into PGlite or Postgres, table by table, and write a migration marker. Use it once when graduating a project from the local SQLite default to a shared backend.migrateSmithersStore.js · Tests migrateSmithersStore.test.js
createExternalSmithers
Build aSmithersWorkflow from a plain build function instead of JSX. The build
function returns a HostNodeJson tree that maps 1:1 to what the JSX renderer
produces, so a workflow can be authored in any language that can emit that JSON.
A runnable workflow plus its backing
tables and a cleanup() to release the
database.external/index.js · Tests create-unit.test.js · See also SerializedCtx, HostNodeJson
Once you have a
SmithersWorkflow, run it with the Runtime API
or the CLI. For the full type surface, see the
Types reference.