Skip to main content
OpenWorkflow uses a configuration file to connect to your database, locate your workflow files, and set worker options. The CLI reads this file automatically for all commands. If you ran npx @openworkflow/cli init, this file was created for you. This page covers all available options. If you’re using the PostgreSQL backend, install the Postgres driver:

Config File

Create openworkflow.config.ts (or .js) in your project root:
The CLI automatically finds this file by searching up from the current directory. If your config lives somewhere else, pass an explicit path:

Verify Configuration

After creating or updating the config, run:
This confirms that your config can be loaded, the backend can be reached, and your workflows can be found.

Configuration Options

backend (required)

The storage backend for workflow state. See PostgreSQL or SQLite.

dirs

Directory or directories to scan for workflow files. Defaults to ["./openworkflow"].
The CLI recursively scans these directories for files with extensions: .ts, .mts, .cts, .js, .mjs, .cjs.

ignorePatterns

Glob patterns to exclude when discovering workflow files:
The pattern **/*.run.* is ignored by default to exclude runner scripts.

worker

Worker configuration options:

Full Example

Environment-Based Configuration

Use environment variables for different environments:

Loading Environment Variables

The CLI loads .env files automatically. Add your database URL and other secrets there:

Supported Extensions

Config files can use these extensions:
  • openworkflow.config.ts
  • openworkflow.config.mts
  • openworkflow.config.cts
  • openworkflow.config.js
  • openworkflow.config.mjs
  • openworkflow.config.cjs