Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,22 @@ jobs:
- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
ci-bun:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2
- run: bun ci
Comment thread
jamescmartinez marked this conversation as resolved.
- run: bun run ci:bun
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"scripts": {
"build": "turbo build",
"ci": "npm run format && npm run build && npm run lint && npm run typecheck && npm run test:coverage",
"ci:bun": "bun run build && bun run test:bun",
"db:migrate": "tsx ./packages/openworkflow/postgres/scripts/db-migrate.ts",
"db:reset": "tsx ./packages/openworkflow/postgres/scripts/db-reset.ts",
"format": "prettier --check . --ignore-path .gitignore --ignore-path .prettierignore",
Expand All @@ -21,6 +22,7 @@
"pghero": "sh ./packages/openworkflow/postgres/scripts/pghero.sh",
"squawk": "tsx ./packages/openworkflow/postgres/scripts/squawk.ts",
"test": "vitest run",
"test:bun": "bun run --bun vitest run",
"test:coverage": "vitest run --coverage",
"test:coverage:browse": "open ./coverage/index.html",
"test:watch": "vitest",
Expand Down
35 changes: 35 additions & 0 deletions packages/docs/docs/cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ npm install -D @openworkflow/cli
pnpm add -D @openworkflow/cli
```

```bash bun
bun add -D @openworkflow/cli
```

</CodeGroup>

## Commands
Expand All @@ -34,6 +38,10 @@ npx @openworkflow/cli init
pnpx @openworkflow/cli init
```

```bash bun
bunx @openworkflow/cli init
```

</CodeGroup>

This interactive command:
Expand All @@ -59,6 +67,10 @@ npx @openworkflow/cli worker start
pnpx @openworkflow/cli worker start
```

```bash bun
bunx @openworkflow/cli worker start
```

</CodeGroup>

Options:
Expand All @@ -77,6 +89,11 @@ npx @openworkflow/cli worker start --concurrency 4
pnpx @openworkflow/cli worker start --concurrency 4
```

```bash bun
# Run with 4 concurrent workflows
bunx @openworkflow/cli worker start --concurrency 4
```

</CodeGroup>

The worker:
Expand All @@ -100,6 +117,10 @@ npx @openworkflow/cli dashboard
pnpx @openworkflow/cli dashboard
```

```bash bun
bunx @openworkflow/cli dashboard
```

</CodeGroup>

This launches the OpenWorkflow dashboard on `http://localhost:3000`. See
Expand All @@ -118,6 +139,10 @@ npx @openworkflow/cli doctor
pnpx @openworkflow/cli doctor
```

```bash bun
bunx @openworkflow/cli doctor
```

</CodeGroup>

This command checks:
Expand Down Expand Up @@ -164,6 +189,10 @@ npx @openworkflow/cli --version
pnpx @openworkflow/cli --version
```

```bash bun
bunx @openworkflow/cli --version
```

</CodeGroup>

### `--help`
Expand All @@ -183,6 +212,12 @@ pnpx @openworkflow/cli worker --help
pnpx @openworkflow/cli worker start --help
```

```bash bun
bunx @openworkflow/cli --help
bunx @openworkflow/cli worker --help
bunx @openworkflow/cli worker start --help
```

</CodeGroup>

## Environment Variables
Expand Down
4 changes: 4 additions & 0 deletions packages/docs/docs/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ npm i openworkflow postgres
pnpm add openworkflow postgres
```

```bash bun
bun add openworkflow postgres
```

</CodeGroup>

## Config File
Expand Down
4 changes: 4 additions & 0 deletions packages/docs/docs/core-concepts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ npx @openworkflow/cli worker start
pnpx @openworkflow/cli worker start
```

```bash bun
bunx @openworkflow/cli worker start
```

</CodeGroup>

## How it Works
Expand Down
4 changes: 4 additions & 0 deletions packages/docs/docs/dashboard.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ npx @openworkflow/cli dashboard
pnpx @openworkflow/cli dashboard
```

```bash bun
bunx @openworkflow/cli dashboard
```

</CodeGroup>

The dashboard starts on `http://localhost:3000`.
Expand Down
12 changes: 12 additions & 0 deletions packages/docs/docs/migration-v6.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ npm uninstall @openworkflow/backend-postgres @openworkflow/backend-sqlite
pnpm remove @openworkflow/backend-postgres @openworkflow/backend-sqlite
```

```bash bun
bun remove @openworkflow/backend-postgres @openworkflow/backend-sqlite
```

</CodeGroup>

If you're using PostgreSQL, install the `postgres` driver directly:
Expand All @@ -49,6 +53,10 @@ npm install postgres
pnpm add postgres
```

```bash bun
bun add postgres
```

</CodeGroup>

Your `package.json` should now look like:
Expand Down Expand Up @@ -79,6 +87,10 @@ npx @openworkflow/cli init
pnpx @openworkflow/cli init
```

```bash bun
bunx @openworkflow/cli init
```

</CodeGroup>

The CLI now generates code with the new import paths automatically.
Expand Down
9 changes: 9 additions & 0 deletions packages/docs/docs/namespaces.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ NAMESPACE=staging pnpm run worker
NAMESPACE=production pnpm run worker
```

```bash bun
# Development
NAMESPACE=development bun run worker
# Staging
NAMESPACE=staging bun run worker
# Production
NAMESPACE=production bun run worker
```

</CodeGroup>

### Multi-Tenancy
Expand Down
4 changes: 4 additions & 0 deletions packages/docs/docs/postgres.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ npm i openworkflow postgres
pnpm add openworkflow postgres
```

```bash bun
bun add openworkflow postgres
```

</CodeGroup>

## Setup
Expand Down
4 changes: 4 additions & 0 deletions packages/docs/docs/production.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ npx @openworkflow/cli dashboard
pnpx @openworkflow/cli dashboard
```

```bash bun
bunx @openworkflow/cli dashboard
```

</CodeGroup>

- Review step attempts and errors for failed workflows
Expand Down
18 changes: 17 additions & 1 deletion packages/docs/docs/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Get up and running with OpenWorkflow

## Prerequisites

- Node.js
- Node.js or Bun
- PostgreSQL (and/or SQLite)

## 1. Install
Expand All @@ -21,6 +21,10 @@ npx @openworkflow/cli init
pnpx @openworkflow/cli init
```

```bash bun
bunx @openworkflow/cli init
```

</CodeGroup>

The CLI will help you set up OpenWorkflow, create your `openworkflow.config.ts`,
Expand All @@ -37,6 +41,10 @@ npx @openworkflow/cli worker start
pnpx @openworkflow/cli worker start
```

```bash bun
bunx @openworkflow/cli worker start
```

</CodeGroup>

This starts the worker using `openworkflow.config.{ts,js}` and auto-loads
Expand All @@ -59,6 +67,10 @@ pnpx tsx openworkflow/hello-world.run.ts
node openworkflow/hello-world.run.js
```

```bash bun
bun openworkflow/hello-world.run.ts
```

</CodeGroup>

This script runs the `helloWorld` workflow and waits for it to complete.
Expand All @@ -81,6 +93,10 @@ npx @openworkflow/cli dashboard
pnpx @openworkflow/cli dashboard
```

```bash bun
bunx @openworkflow/cli dashboard
```

</CodeGroup>

The dashboard provides a UI for monitoring workflow runs, viewing step details,
Expand Down
4 changes: 4 additions & 0 deletions packages/docs/docs/retries.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,8 @@ npx @openworkflow/cli dashboard
pnpx @openworkflow/cli dashboard
```

```bash bun
bunx @openworkflow/cli dashboard
```

</CodeGroup>
3 changes: 2 additions & 1 deletion packages/docs/docs/sqlite.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ description: Lightweight SQLite storage for development and testing
The SQLite backend is perfect for local development, testing, and single-server
deployments. It requires no external database server.

Requires Node.js 22.5+ for `node:sqlite`.
Uses `bun:sqlite` for Bun and `node:sqlite` for Node.js (requires Node.js
22.5+).

## Setup

Expand Down
24 changes: 24 additions & 0 deletions packages/docs/docs/workers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ npx @openworkflow/cli worker start
pnpx @openworkflow/cli worker start
```

```bash bun
bunx @openworkflow/cli worker start
```

</CodeGroup>

This command:
Expand Down Expand Up @@ -68,6 +72,10 @@ npx @openworkflow/cli worker start --concurrency 10
pnpx @openworkflow/cli worker start --concurrency 10
```

```bash bun
bunx @openworkflow/cli worker start --concurrency 10
```

</CodeGroup>

<Note>
Expand Down Expand Up @@ -107,6 +115,13 @@ pnpx @openworkflow/cli worker start --concurrency 10
pnpx @openworkflow/cli worker start --concurrency 10
```

```bash bun
# Terminal 1
bunx @openworkflow/cli worker start --concurrency 10
# Terminal 2
bunx @openworkflow/cli worker start --concurrency 10
```

</CodeGroup>

Workers coordinate through the database:
Expand Down Expand Up @@ -145,6 +160,15 @@ pnpx @openworkflow/cli worker start
# [info] Worker stopped
```

```bash bun
# The worker handles Ctrl+C gracefully
bunx @openworkflow/cli worker start
^C
# [info] Shutting down worker...
# [info] Waiting for active workflows to complete...
# [info] Worker stopped
```

</CodeGroup>

## Workflow Discovery
Expand Down
4 changes: 4 additions & 0 deletions packages/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ npx @openworkflow/cli init
pnpx @openworkflow/cli init
```

```bash bun
bunx @openworkflow/cli init
```

</CodeGroup>

![OpenWorkflow Dashboard](/assets/dashboard.png)
Expand Down
11 changes: 7 additions & 4 deletions packages/openworkflow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,15 @@ export const sendWelcomeEmail = defineWorkflow(

## Quick Start

**Prerequisites:** Node.js & PostgreSQL (or SQLite)

### Install

```bash
# npm
npx @openworkflow/cli init

# pnpm
pnpx @openworkflow/cli init

# bun
bunx @openworkflow/cli init
```

The CLI will guide you through setup and generate everything you need to get
Expand Down
Loading
Loading