Diffinery

homeflare/celldpublic

celld/examples/README.md
45 lines · 1.8 KBRaw History
1# Examples
2
3These small Wrangler projects demonstrate progressively more of the Worker and
4Durable Object surface supported by `celld`:
5
6- `hello/` — a stateless Worker `fetch` handler
7- `webapi/` — common Web Platform APIs
8- `counter/` — a SQLite-backed Durable Object
9- `vectordb/` — nearest-color search with a per-object `vec0` index
10- `d1/` — a guestbook on a D1 database
11- `r2/` — object reads, writes, and deletes on an R2 bucket
12- `kv/` — key reads, writes, and deletes in a KV namespace
13- `async/` — a timer and asynchronous Durable Object storage
14- `body/` — request and response bodies
15- `router/` — Worker-to-Durable-Object routing
16- `wsecho/` — WebSocket echo with hibernation
17- `wsclient/` — outbound WebSocket client from a Durable Object
18- `alarm/` — a Durable Object alarm handler
19- `cron/` — a cron trigger that logs each tick
20- `workflow/` — a Workflow that builds a report in one durable step
21- `rpc/` — Durable Object method calls through JS RPC
22- `wasm/` — a Durable Object counter in Rust, compiled to Wasm with
23 [workers-rs](https://github.com/cloudflare/workers-rs); needs a build step
24 first (see its [README](wasm/README.md))
25
26Deploy an example from its directory to the same bucket the nodes use:
27
28```sh
29celld deploy . --bucket s3://my-cells-bucket
30```
31
32The counter example uses the `name` query parameter as the Durable Object
33name. It uses `default` when the parameter is absent. Send requests for
34different names to demonstrate independent cells:
35
36```sh
37curl 'http://127.0.0.1:8080/increment?name=alpha'
38curl 'http://127.0.0.1:8080/increment?name=beta'
39curl 'http://127.0.0.1:8080/increment?name=alpha'
40```
41
42A fleet can place the named cells on different nodes, and each cell keeps an
43independent counter.
44
45They are examples, not the complete compatibility test suite.