@@ -24,37 +24,25 @@ bunx @openworkflow/cli init
2424
2525## What is OpenWorkflow?
2626
27- OpenWorkflow is a TypeScript framework for building durable, resumable workflows
28- that can pause for seconds or months, survive crashes and deploys, and resume
29- exactly where they left off - all without extra servers to manage.
30-
31- Build your first workflow in a few lines:
27+ OpenWorkflow is a TypeScript framework that makes multi-step operations durable.
28+ Wrap each operation in a step, and OpenWorkflow remembers which steps already
29+ finished. If anything crashes, the workflow picks up right where it left off —
30+ completed steps are never re-run.
3231
3332``` ts
3433import { defineWorkflow } from " openworkflow" ;
3534
36- export const sendWelcomeEmail = defineWorkflow (
37- { name: " send-welcome-email " },
35+ export const processOrder = defineWorkflow (
36+ { name: " process-order " },
3837 async ({ input , step }) => {
39- const user = await step .run ({ name: " fetch-user" }, async () => {
40- return await db .users .findOne ({ id: input .userId });
41- });
42-
43- await step .run ({ name: " send-email" }, async () => {
44- return await resend .emails .send ({
45- from: " me@example.com" ,
46- to: user .email ,
47- replyTo: " me@example.com" ,
48- subject: " Welcome!" ,
49- html: " <h1>Welcome to our app!</h1>" ,
50- });
38+ // if the server crashes after this step, the card is NOT charged again
39+ await step .run ({ name: " charge-card" }, async () => {
40+ await payments .charge (input .orderId );
5141 });
5242
53- await step .run ({ name: " mark-welcome-email-sent " }, async () => {
54- await db . users . update ( input .userId , { welcomeEmailSent: true });
43+ await step .run ({ name: " send-confirmation " }, async () => {
44+ await emails . send ({ to: input .email , subject: " Order confirmed! " });
5545 });
56-
57- return { user };
5846 },
5947);
6048```
@@ -64,16 +52,24 @@ export const sendWelcomeEmail = defineWorkflow(
6452<div className = " flex flex-col gap-2" >
6553 <div >
6654 <Icon icon = " shield-check" /> ** Durable** - Workflows survive process
67- restarts and server crashes.
55+ restarts and server crashes. Completed steps are never repeated.
6856 </div >
6957 <div >
70- <Icon icon = " rotate-right" /> ** Resumable** - Workflows resume execution from
71- the last completed step.
58+ <Icon icon = " rotate-right" /> ** Resumable** - After a crash or deploy,
59+ workflows pick up from the last completed step automatically.
60+ </div >
61+ <div >
62+ <Icon icon = " clock" /> ** Pausable** - Workflows can sleep for seconds or
63+ months without tying up resources.
7264 </div >
7365 <div >
7466 <Icon icon = " code" /> ** Type Safe** - First-class TypeScript support for
7567 inputs and outputs.
7668 </div >
69+ <div >
70+ <Icon icon = " database" /> ** No Extra Servers** - Uses your existing database
71+ (PostgreSQL or SQLite). No separate queue or orchestration service.
72+ </div >
7773</div >
7874
7975## Get Started
@@ -82,4 +78,7 @@ export const sendWelcomeEmail = defineWorkflow(
8278 <Card title = " Quick Start" icon = " bolt" href = " /docs/quickstart" >
8379 Build your first workflow in 5 minutes.
8480 </Card >
81+ <Card title = " How It Works" icon = " book" href = " /docs/overview" >
82+ Understand the core concepts: workflows, steps, and workers.
83+ </Card >
8584</CardGroup >
0 commit comments