# CAFE names the Cloudflare, Alchemy, Foldkit and Effect stack

> For agents: start with the [agent guide](https://ratstack.sh/llms.txt). Every page is Markdown by default; add `Accept: text/html` for HTML.

New on /news: [@potion.run/emulate runs third-party APIs as Effect layers](/news).

CAFE is a named stack. Each letter has one job.

Read the [CAFE news](/news) and browse the [project directory](/directory).

[Maxwell Brown](https://github.com/IMax153) coined the name; [Justin Bennett](https://github.com/just-be-dev) spread it with his template on 8 October 2026. That day, [Devin Jameson](https://github.com/devinjameson), Maxwell and [Sam Goodwin](https://github.com/sam-goodwin) streamed a CAFE build, and [Sebastian Lorenz](https://github.com/fubhy) wrote the explainer people share.

- **C**:
  - Part: Cloudflare
  - Job: Runs the app: Workers, Durable Objects, storage, static assets.
- **A**:
  - Part: Alchemy
  - Job: Declares the cloud resources as an Effect program.
- **F**:
  - Part: Foldkit
  - Job: Draws the UI with the Elm Architecture on Effect.
- **E**:
  - Part: Effect
  - Job: Does the typed work between the UI and the cloud.

A request follows one path. The [Alchemy](/skills/learn-alchemy) Stack declares every box on it.

```text
┌─ Alchemy Stack ──────────────────────────────────┐
│                                                  │
│  Foldkit app (browser)                           │
│      │  HTTP or RPC, typed by a shared schema    │
│      ▼                                           │
│  Worker (Effect)                                 │
│      │                                           │
│      ▼                                           │
│  Durable Object or storage                       │
│                                                  │
└──────────────────────────────────────────────────┘
```

The browser and the Worker import the same schemas. Alchemy reads the same program to deploy and to test.

## The canonical example

[Effect-TS/cafe](https://github.com/Effect-TS/cafe) is a chat app from the Effect organization. Its README defines CAFE. [Sam Goodwin](/lore/sam-goodwin), who wrote Alchemy, built it. Maxwell Brown also commits to it.

It shows these patterns:

- `@cafe/api` holds the HTTP and [RPC](/skills/learn-rat-stack) schemas. It may import only `effect`, so the browser can import it safely. A lint rule enforces this.
- The Worker serves an Effect `HttpApi`. [PR #6](https://github.com/Effect-TS/cafe/pull/6) moves chat events to Effect RPC over a `Cloudflare.RpcDurableObject`, one per chat.
- The frontend is a Foldkit single-page app. Side effects are `Command.define` definitions. [PR #2](https://github.com/Effect-TS/cafe/pull/2) streamed socket frames with `Subscription.fromEvent`; PR #6 later replaced the socket with RPC.
- Story tests check update, Messages, and Commands. Scene tests drive the rendered view. Both are pure.
- Live tests deploy the Stack with `Test.make` from `alchemy/Test/Vitest`. The end-to-end test drives Chromium through Playwright.
- CI deploys one stage per pull request and destroys it when the pull request closes.
- `stacks/github.ts` is an Alchemy Stack that writes the CI Cloudflare credentials as repository secrets.
- Configuration comes from `effect/Config`. Its `AGENTS.md` forbids `process.env`.
- The repository carries the Foldkit agent skills.

## Other CAFE apps

- **[just-be-dev/effect-cloudflare-foldkit-template](https://github.com/just-be-dev/effect-cloudflare-foldkit-template)**: A template with tooling and guardrails for Effect 4, Foldkit, and Alchemy 2 on Cloudflare.
- **[NigelThorne/foldkit-demo](https://github.com/NigelThorne/foldkit-demo)**: Live shared sessions on Durable Objects with SQLite and hibernatable WebSockets.
- **[mwarger/corefour](https://github.com/mwarger/corefour)**: A poster app with an Effect `HttpApi` Worker, Foldkit server rendering, and KV and R2 storage.
- **[Manzanita-Research/foldkit-dials](https://github.com/Manzanita-Research/foldkit-dials)**: Live tuning controls for Foldkit apps. See the next section.
- **[Manzanita-Research/pleat](https://github.com/Manzanita-Research/pleat)**: Typed styles for Foldkit and Effect 4. MIT.
- **[Effect-TS/slopcop](https://github.com/Effect-TS/slopcop)**: Several Effect Workers with D1 and Queues, declared in one Alchemy Stack.

Pleat treats a style as a value:

- Styles merge by fixed laws.
- Every rule compiles to atomic CSS when its module loads.
- Recipe variants are typed by Effect [Schema](/lore/schemas-define-the-boundary).
- A model that generates UI can choose styles, but it can never write CSS.

[Jem](https://github.com/jem-computer) at Manzanita Research builds actively in the CAFE space: Pleat, foldkit-dials, and [foldkit-native](https://github.com/Manzanita-Research/foldkit-native).

## foldkit-dials

[Manzanita-Research/foldkit-dials](https://github.com/Manzanita-Research/foldkit-dials) gives a Foldkit app live tuning controls, after DialKit. It is MIT licensed, at version 0.1.0.

- The dials are an Effect Schema.
- Every dial edit is a Message.
- Foldkit DevTools records each edit.
- Time travel replays it.
- Story and Scene tests can drive it.

Its demo deploys with Alchemy. A `stacks/github.ts` Stack bootstraps its CI credentials, as in cafe.

foldkit-dials is a clear example of the Foldkit rule that every change is a Message. A tool that follows the rule gets recording, replay, and tests from the runtime.

## Where rat-stack sits

rat-stack is a CAFE stack with [the fence](/lore/the-fence) around it. The table compares it with cafe at rat-stack commit `3fb103b`.

- **Alchemy Worker shape**:
  - rat-stack: Class form: `Cloudflare.Worker<Mischief>()`, `Cloudflare.Workers.RpcWorker`, `Cloudflare.Website.Foldkit`
  - cafe: `Cloudflare.Worker`, `Cloudflare.RpcDurableObject`, `Cloudflare.Website.Foldkit`
- **Runtime tests**:
  - rat-stack: `alchemy/Test/Vitest` with fixture Workers in `apps/site/test/*-runtime.test.ts`
  - cafe: `Test.make` deploys the whole Stack; Playwright drives Chromium
- **API surface**:
  - rat-stack: One contract projected to RPC, HTTP, MCP, and CLI by `packages/capability`
  - cafe: Hand-written `HttpApi` and `RpcGroup`
- **Foldkit**:
  - rat-stack: `Runtime.makeApplication`, `Command.define`, `@foldkit/oxlint-plugin`, Story and Scene tests
  - cafe: The same, plus the Foldkit agent skills
- **Config**:
  - rat-stack: varlock `.env.schema` into Effect `Config`; no `process.env` in source
  - cafe: `effect/Config`; no `process.env`
- **Pull request stages**:
  - rat-stack: `scripts/deploy-preview.sh` deploys a Website and RpcBackend preview by hand; no live end-to-end test
  - cafe: CI deploys one stage per pull request, runs live tests, and destroys it on close
- **Tracing**:
  - rat-stack: `Cloudflare.Telemetry`, opt-in, off by default
  - cafe: Not enabled

The largest difference is the API [surface](/lore/one-schema-three-surfaces). See [one capability, every surface](/lore/one-capability-every-surface) and [infrastructure as effects](/lore/infrastructure-as-effects).

## Sources

- [Effect-TS/cafe](https://github.com/Effect-TS/cafe)
- [foldhub/awesome-foldkit](https://github.com/foldhub/awesome-foldkit), Foldhub's community list for Foldkit, announced by Taras Kornichuk
- [Foldkit](https://foldkit.dev)
- [Alchemy](https://alchemy.run)
- [Effect](https://effect.website)

## Sources

1. [Effect-TS/cafe · GitHub](https://github.com/Effect-TS/cafe)
   GitHub Effect-TS. README, AGENTS.md, package layout, CI workflows, and commit history; used for the canonical example. Accessed 2026-10-09.

2. [refactor: stream socket frames with Subscription.fromEvent · Effect-TS/cafe#2](https://github.com/Effect-TS/cafe/pull/2)
   GitHub Effect-TS. Used for the Subscription.fromEvent step. Accessed 2026-10-09.

3. [refactor: stream chat events over Effect RPC · Effect-TS/cafe#6](https://github.com/Effect-TS/cafe/pull/6)
   GitHub Effect-TS. Used for the move to Effect RPC over a Durable Object. Accessed 2026-10-09.

4. [Manzanita-Research/foldkit-dials · GitHub](https://github.com/Manzanita-Research/foldkit-dials)
   GitHub Manzanita-Research. README and package manifest; used for the foldkit-dials section. Accessed 2026-10-09.

5. [Manzanita-Research/pleat · GitHub](https://github.com/Manzanita-Research/pleat)
   GitHub Manzanita-Research. README; used for the Pleat row. Accessed 2026-10-09.

6. [Manzanita-Research/foldkit-native · GitHub](https://github.com/Manzanita-Research/foldkit-native)
   GitHub Manzanita-Research. Repository description; used for the Manzanita Research credit. Accessed 2026-10-09.

7. [just-be-dev/effect-cloudflare-foldkit-template · GitHub](https://github.com/just-be-dev/effect-cloudflare-foldkit-template)
   GitHub just-be-dev. Repository description; used for the other CAFE apps table. Accessed 2026-10-09.

8. [NigelThorne/foldkit-demo · GitHub](https://github.com/NigelThorne/foldkit-demo)
   GitHub NigelThorne. Repository description; used for the other CAFE apps table. Accessed 2026-10-09.

9. [mwarger/corefour · GitHub](https://github.com/mwarger/corefour)
   GitHub mwarger. README; used for the other CAFE apps table. Accessed 2026-10-09.

10. [Effect-TS/slopcop · GitHub](https://github.com/Effect-TS/slopcop)
    GitHub Effect-TS. alchemy.run.ts; used for the other CAFE apps table. Accessed 2026-10-09.

11. [foldhub/awesome-foldkit · GitHub](https://github.com/foldhub/awesome-foldkit)
    GitHub foldhub. Community list for Foldkit libraries and apps. Accessed 2026-10-09.

## Lore on this page

- [Workers answer requests; Durable Objects own named state](/lore/workers-answer-requests-durable-objects-own-named-state)
- [Web](/systems/web)
- [One schema, three surfaces](/lore/one-schema-three-surfaces)

## Linked from

- A browser send follows one path to the capability → In the Foldkit docs browser, a search is a Message, then an update, then a named Command that calls the search capability over RPC on a cache miss and returns a result Message. → [Read page](https://ratstack.sh/lore/a-browser-send-follows-one-path)

- Agent guide → An Effect stack so pure (aspirational) Kit Langton will blush. → [Read page](https://ratstack.sh/llms.txt)

- Agent rules for rat-stack (AGENTS.md) → What you may change, which commands to run, and which changes need approval. → [Read page](https://ratstack.sh/AGENTS.md)

- Alchemy Domain models a business as commands, aggregates, and events → Alchemy Domain is a domain-driven design framework for Effect whose one model runs in memory for tests and on Cloudflare Durable Objects in production. → [Read page](https://ratstack.sh/lore/alchemy-domain)

- Build and run rat-stack (README.md) → What is in the repo, how the example works, and how to run it. → [Read page](https://ratstack.sh/README.md)

- CAFE all stars → Public profiles of people and channels who build with Cloudflare, Alchemy, Foldkit and Effect, served by five read-only capabilities. → [Read page](https://ratstack.sh/systems/all-stars)

- Capabilities → Named application actions exposed through generated interfaces share one definition and one server-side implementation. → [Read page](https://ratstack.sh/systems/capabilities)

- Change log → What changed in the files served here, newest first. → [Read page](https://ratstack.sh/log)

- Dependency vendoring rules (vendor/README.md) → How to pin an unpublished package and when to remove the local copy. → [Read page](https://ratstack.sh/vendor/README.md)

- Effect + Alchemy peer patterns → Source-grounded patterns from repos on nearby Effect and Alchemy pins. → [Read page](https://ratstack.sh/resources/same-version-repos)

- Effect + Alchemy peers → Public repositories that share rat-stack's prerelease lines. → [Read page](https://ratstack.sh/resources/peers)

- Effect 4 study: September 2026 → Dated Effect 4 source studies from September 2026; current versions live in pins.md. → [Read page](https://ratstack.sh/resources/effect-4-reference-projects)

- Full agent guide → An Effect stack so pure (aspirational) Kit Langton will blush. → [Read page](https://ratstack.sh/llms-full.txt)

- Hosted agent interfaces → Discovery documents, HTTP, MCP, A2A, and bounded code mode expose the public reference to agents. → [Read page](https://ratstack.sh/systems/agent-front-door)

- Infrastructure as effects → Sam Goodwin relates application operations to infrastructure requirements in one typed program. → [Read page](https://ratstack.sh/lore/infrastructure-as-effects)

- Lint and type escape ledger (debt.md) → A source-linked count of repo-owned lint and type escapes. → [Read page](https://ratstack.sh/debt.md)

- Motion → @rat-stack/motion gives Foldkit apps Penner and CSS easings, tweens, fixed-step springs and interpolation, held in the Model and checked by properties. → [Read page](https://ratstack.sh/systems/motion)

- One prompt serves people and agents → Source-owned agent prompts with typed discovery and copyable browser pages. → [Read page](https://ratstack.sh/systems/prompts)

- Rat Stack lore | rat-stack → Short, source-grounded notes on the ideas and decisions behind rat-stack. → [Read page](https://ratstack.sh/lore)

- Rat Stack systems | rat-stack → The systems rat-stack ships, the standard each keeps, and how to check it. → [Read page](https://ratstack.sh/systems)

- Sam Goodwin → Sam Goodwin presents Alchemy as infrastructure built from Effect programs and typed requirements. → [Read page](https://ratstack.sh/lore/sam-goodwin)

- Source change history (log.md) → The generated change log as Markdown. → [Read page](https://ratstack.sh/log.md)

- test-behaviour → Pick the test shape that proves a behaviour. Use when you ask "how do I test this?", add a test, test a domain rule, a lifecycle, a retry, a session, a UI interaction, a timer, or a race, or review a test that might be tautological. → [Read page](https://ratstack.sh/skills/test-behaviour)

- UI behaviour is a scene → A Foldkit Scene drives update, view, and subscriptions with input and time as plain data, then asserts on what the view shows. → [Read page](https://ratstack.sh/lore/ui-behaviour-is-a-scene)

- uncomplect → Find responsibilities that a rat-stack design combines, separate them into capabilities, cartridges, machines, features, and clients, and enforce that separation through types and checks. Use when asked to simplify, review, or replace a design, "what would Rich Hickey do", "optimize for deletion", or "define this error out of existence". → [Read page](https://ratstack.sh/skills/uncomplect)

- Web → The Foldkit reader renders on the server and prerenders its public pages; the browser hydrates the same view. → [Read page](https://ratstack.sh/systems/web)
