|
1 | | -# Vercel Restate World |
| 1 | +# Restate + useworkflow.dev |
2 | 2 |
|
3 | | -A TypeScript monorepo demonstrating Restate integration with Vercel Workflow. See [DEVELOPMENT.md](./DEVELOPMENT.md) for comprehensive monorepo documentation. |
| 3 | +Use Restate with [useworkflow.dev](http://useworkflow.dev). |
4 | 4 |
|
5 | | -# Warning |
| 5 | +> [!IMPORTANT] |
| 6 | +> This integration is a proof of concept. |
6 | 7 |
|
7 | | -This integration is currently under construction. |
| 8 | +## How to use it |
8 | 9 |
|
9 | | -## Packages |
| 10 | +To run this integration, you'll need: |
10 | 11 |
|
11 | | -- **`@restatedev/world`**: Package using typed client to implement World by talking to Restate virtual objects/services |
12 | | -- **`@restatedev/backend`**: Collection of Restate virtual objects and services |
13 | | -- **`@restatedev/common`**: Common types package (private, not publishable) |
14 | | -- **`@restatedev/workflow`**: Example package built using `workflow` package |
| 12 | +* The `@restatedev/world` package |
| 13 | +* Restate + Restate `World` backend |
| 14 | +* An example workflow from Vercel `workflow-examples` repo. |
15 | 15 |
|
16 | | -## Quick Start |
| 16 | +### Prepare the `@restatedev/world` package |
17 | 17 |
|
18 | | -```bash |
19 | | -# Install dependencies |
| 18 | +1. Clone this repo |
| 19 | +```shell |
| 20 | +git clone https://github.com/restatedev/vercel-workflow.git |
| 21 | +cd vercel-workflow |
| 22 | +``` |
| 23 | + |
| 24 | +2. Build it |
| 25 | +```shell |
20 | 26 | pnpm install |
| 27 | +pnpm build |
| 28 | +pnpm package |
| 29 | +``` |
21 | 30 |
|
22 | | -# Start dev mode (type checking) |
23 | | -pnpm dev |
| 31 | +### Run Restate and the Restate `world` backend |
24 | 32 |
|
25 | | -# Run workflow example |
26 | | -pnpm examples:dev |
| 33 | +Run in the root of this repo: |
27 | 34 |
|
28 | | -# Build and run backend service |
29 | | -pnpm build |
30 | | -pnpm backend:run |
| 35 | +```shell |
| 36 | +docker compose up |
| 37 | +``` |
31 | 38 |
|
32 | | -# Inspect workflows |
33 | | -pnpm inspect |
| 39 | +To start Restate, together with the service implementing the `World` backend. |
34 | 40 |
|
35 | | -# Run all checks (before committing) |
36 | | -pnpm verify |
| 41 | +### Run a Workflow example |
| 42 | + |
| 43 | +Grab any of the Vercel workflow examples, e.g., the Flight booking example, cloning it in a new directory: |
| 44 | + |
| 45 | +```shell |
| 46 | +git clone https://github.com/vercel/workflow-examples |
| 47 | +cd workflow-examples/flight-booking-app |
| 48 | +``` |
| 49 | + |
| 50 | +Each example might require additional setup, e.g. the flight booking app requires a Vercel API Gateway key in the `.env.local` file: |
| 51 | + |
| 52 | +```shell |
| 53 | +touch .env.local |
| 54 | +echo "API_GATEWAY_KEY=<YOUR_KEY>" >> .env.local |
37 | 55 | ``` |
38 | 56 |
|
39 | | -## Documentation |
| 57 | +Then install `@restatedev/world`: |
| 58 | + |
| 59 | +```shell |
| 60 | +pnpm add <DIR_WHERE_YOU_CLONED_THIS_REPO>/restatedev-vercel-world-0.0.0.tgz |
| 61 | +``` |
| 62 | + |
| 63 | +Now setup Vercel to use `@restatedev/world`: |
| 64 | + |
| 65 | +```shell |
| 66 | +export WORKFLOW_TARGET_WORLD=@restatedev/vercel-world |
| 67 | +``` |
| 68 | + |
| 69 | +And you're ready to run the example: |
| 70 | + |
| 71 | +```shell |
| 72 | +pnpm dev |
| 73 | +``` |
| 74 | + |
| 75 | +Head over to http://localhost:3000 and you're ready to use the example. |
| 76 | +You can access the Restate UI at http://localhost:9070. |
| 77 | + |
| 78 | +You can also use the Vercel inspection UI with: |
| 79 | + |
| 80 | +```shell |
| 81 | +npx workflow inspect run --web |
| 82 | +``` |
40 | 83 |
|
41 | | -- **[DEVELOPMENT.md](./DEVELOPMENT.md)** - Complete monorepo guide (PNPM, Turbo, tsdown, Vitest, Changesets) |
42 | | -- **[AGENTS.md](./AGENTS.md)** - Guide for AI coding assistants with commands, code style, and best practices |
| 84 | +Enjoy! |
0 commit comments