Skip to content

Commit 164822c

Browse files
committed
Tweaks Workflows overview with code and different explanation
1 parent 29d3a9f commit 164822c

File tree

2 files changed

+99
-20
lines changed

2 files changed

+99
-20
lines changed

src/content/docs/workflows/index.mdx

Lines changed: 98 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,18 @@ sidebar:
1010
head:
1111
- tag: title
1212
content: Cloudflare Workflows
13-
1413
---
1514

16-
import { CardGrid, Description, Feature, LinkTitleCard, Plan, RelatedProduct } from "~/components"
15+
import {
16+
CardGrid,
17+
Description,
18+
Feature,
19+
LinkTitleCard,
20+
Plan,
21+
RelatedProduct,
22+
Tabs,
23+
TabItem,
24+
} from "~/components";
1725

1826
<Description>
1927

@@ -23,11 +31,60 @@ Build durable multi-step applications on Cloudflare Workers with Workflows.
2331

2432
<Plan type="workers-all" />
2533

26-
Workflows is a durable execution engine built on Cloudflare Workers. Workflows allow you to build multi-step applications that can automatically retry, persist state and run for minutes, hours, days, or weeks. Workflows introduces a programming model that makes it easier to build reliable, long-running tasks, observe as they progress, and programatically trigger instances based on events across your services.
27-
28-
Refer to the [get started guide](/workflows/get-started/guide/) to start building with Workflows.
34+
With Workflows, you can build applications that chain together multiple steps, automatically retry failed tasks,
35+
and persist state for minutes, hours, or even weeks - with no infrastructure to manage.
36+
37+
This gives you:
38+
39+
- Reliable multi-step operations without worrying about timeouts
40+
- Automatic retries and error handling
41+
- Built-in observability for long running operations
42+
- Simple and expressive code for complex processes
43+
44+
<Tabs>
45+
<TabItem label="index.ts">
46+
```ts
47+
export class CheckoutWorkflow extends WorkflowEntrypoint {
48+
async run (event, step) {
49+
const processorResponse = await step.do( 'submit payment', async () => {
50+
let resp = await submitToPaymentProcessor(event.params.payment) ;
51+
return await resp.json<any>();
52+
}) ;
53+
54+
const textResponse = await step.do( 'send confirmation text', sendConfirmation);
55+
await step.sleep('wait for feedback', '2 days');
56+
await step.do('send feedback email', sendFeedbackEmail);
57+
await step.sleep('delay before marketing', '30 days');
58+
await step.do( 'send marketing follow up', sendFollowUp);
59+
}
60+
}
61+
62+
````
63+
</TabItem>
64+
<TabItem label="wrangler.jsonc">
65+
66+
```json
67+
{
68+
"name": "my-worker-with-workflow",
69+
"main": "src/index.js",
70+
"compatibility_date": "2025-02-27",
71+
"workflows": [
72+
{
73+
"name": "checkout-workflow",
74+
"binding": "CHECKOUT",
75+
"class_name": "CheckoutWorkflow"
76+
}
77+
]
78+
}
79+
````
80+
81+
</TabItem>
82+
83+
</Tabs>
84+
85+
See the [getting started guide](/workflows/get-started/guide/) to start building with Workflows.
2986
30-
***
87+
---
3188
3289
## Features
3390
@@ -49,48 +106,69 @@ Learn how to trigger Workflows from your Workers applications, via the REST API,
49106
50107
</Feature>
51108
52-
***
109+
---
53110
54111
## Related products
55112
56113
<RelatedProduct header="Workers" href="/workers/" product="workers">
57114
58115
Build serverless applications and deploy instantly across the globe for exceptional performance, reliability, and scale.
59116
60-
61117
</RelatedProduct>
62118
63119
<RelatedProduct header="Pages" href="/pages/" product="pages">
64120
65121
Deploy dynamic front-end applications in record time.
66122
67-
68123
</RelatedProduct>
69124
70-
***
125+
---
71126
72127
## More resources
73128
74129
<CardGrid>
75130
76-
<LinkTitleCard title="Pricing" href="/workflows/reference/pricing/" icon="seti:shell">
77-
Learn more about how Workflows is priced.
131+
<LinkTitleCard
132+
title="Pricing"
133+
href="/workflows/reference/pricing/"
134+
icon="seti:shell"
135+
>
136+
Learn more about how Workflows is priced.
78137
</LinkTitleCard>
79138
80-
<LinkTitleCard title="Limits" href="/workflows/reference/limits/" icon="document">
81-
Learn more about Workflow limits, and how to work within them.
139+
<LinkTitleCard
140+
title="Limits"
141+
href="/workflows/reference/limits/"
142+
icon="document"
143+
>
144+
Learn more about Workflow limits, and how to work within them.
82145
</LinkTitleCard>
83146
84-
<LinkTitleCard title="Storage options" href="/workers/platform/storage-options/" icon="document">
85-
Learn more about the storage and database options you can build on with Workers.
147+
<LinkTitleCard
148+
title="Storage options"
149+
href="/workers/platform/storage-options/"
150+
icon="document"
151+
>
152+
Learn more about the storage and database options you can build on with
153+
Workers.
86154
</LinkTitleCard>
87155
88-
<LinkTitleCard title="Developer Discord" href="https://discord.cloudflare.com" icon="discord">
89-
Connect with the Workers community on Discord to ask questions, show what you are building, and discuss the platform with other developers.
156+
<LinkTitleCard
157+
title="Developer Discord"
158+
href="https://discord.cloudflare.com"
159+
icon="discord"
160+
>
161+
Connect with the Workers community on Discord to ask questions, show what you
162+
are building, and discuss the platform with other developers.
90163
</LinkTitleCard>
91164
92-
<LinkTitleCard title="@CloudflareDev" href="https://x.com/cloudflaredev" icon="x.com">
93-
Follow @CloudflareDev on Twitter to learn about product announcements, and what is new in Cloudflare Developer Platform.
165+
<LinkTitleCard
166+
title="@CloudflareDev"
167+
href="https://x.com/cloudflaredev"
168+
icon="x.com"
169+
>
170+
Follow @CloudflareDev on Twitter to learn about product announcements, and
171+
what is new in Cloudflare Developer Platform.
94172
</LinkTitleCard>
95173
96174
</CardGrid>

src/env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference path="../.astro/types.d.ts" />

0 commit comments

Comments
 (0)