Skip to content

Commit b4d1a8d

Browse files
committed
Docs: Small improvements to the How it works pages
1 parent 804976d commit b4d1a8d

File tree

2 files changed

+32
-6
lines changed

2 files changed

+32
-6
lines changed

docs/content/docs/how-it-works/code-transform.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ flowchart LR
5454

5555
### Comparison Table
5656

57-
| Mode | Used In | Purpose | Output Location | Applied To | Required? |
58-
|----------|------------|--------------------------------|------------------------------------|--------------------|-----------|
59-
| Step | Build time | Bundles step handlers | `.well-known/workflow/v1/step.js` | `"use step"` only | Yes |
60-
| Workflow | Build time | Bundles workflow orchestrators | `.well-known/workflow/v1/flow.js` | Both directives | Yes |
61-
| Client | Build/Runtime | Provides workflow IDs and types to `start` | Your application code | `"use workflow"` only | Optional* |
57+
| Mode | Used In | Purpose | Output API Route | Required? |
58+
|----------|------------|--------------------------------|------------------------------------|-----------|
59+
| Step | Build time | Bundles step handlers | `.well-known/workflow/v1/step` | Yes |
60+
| Workflow | Build time | Bundles workflow orchestrators | `.well-known/workflow/v1/flow` | Yes |
61+
| Client | Build/Runtime | Provides workflow IDs and types to `start` | Your application code | Optional* |
6262

6363
\* Client mode is **recommended** for better developer experience—it provides automatic ID generation and type safety. Without it, you must manually construct workflow IDs or use the build manifest.
6464

@@ -232,7 +232,7 @@ Most invalid patterns cause **build-time errors**, catching issues before deploy
232232
- Handles workflow execution, replay, and resumption
233233
- Returns execution results to the orchestration layer
234234

235-
<Callout type="warning">
235+
<Callout type="info">
236236
**Why a VM?** Workflow functions must be deterministic to support replay. The VM sandbox prevents accidental use of non-deterministic APIs or side effects. All side effects should be performed in [step functions](/docs/foundations/workflows-and-steps#step-functions) instead.
237237
</Callout>
238238

docs/content/docs/how-it-works/framework-integrations.mdx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,32 @@ module.exports = {
316316

317317
Route the three endpoints to the generated handlers. The exact implementation depends on your framework's routing API.
318318

319+
In the bun example above, we left routing to the user. Essentially, the user has to serve routes like this:
320+
321+
```typescript title="server.ts" lineNumbers
322+
import flow from "./.well-known/workflow/v1/flow.js";
323+
import step from "./.well-known/workflow/v1/step.js";
324+
import * as webhook from "./.well-known/workflow/v1/webhook.js";
325+
326+
// Expose the 3 generated routes
327+
const server = Bun.serve({
328+
routes: {
329+
"/.well-known/workflow/v1/flow": {
330+
POST: (req) => flow.POST(req),
331+
},
332+
"/.well-known/workflow/v1/step": {
333+
POST: (req) => step.POST(req),
334+
},
335+
// webhook exports handlers for GET, POST, DELETE, etc.
336+
"/.well-known/workflow/v1/webhook/:token": webhook,
337+
},
338+
});
339+
```
340+
341+
Production framework integrations should handle this routing in the plugin instead of leaving it to the user, and this depends on each framework's unique implementaiton.
342+
Check the Workflow DevKit source code for examples of production framework implementations.
343+
In the future, the Workflow DevKit will emit more routes under the `.well-known/workflow` namespace.
344+
319345
---
320346

321347
## Security

0 commit comments

Comments
 (0)