Infrastructure as effects
Sam relates runtime clients, business logic, infrastructure policies, and deployed resources in one typed program16. The compiler can check these relationships before deployment.¶
Contract → surfaces
A contract18 defines shared input, output, failures, and metadata. Projections turn registered capabilities into command line, HTTP, MCP tools, browser RPC, and code mode21 surfaces. Each surface23 derives its input and failure definitions from the same schemas.¶
Code → bindings → resources
A client operation can imply a policy requirement supplied when the function is built. Sam describes bindings23 as permissions and environment variables together at 37:09. An Alchemy Layer can declare the cloud resources behind a service. The Stack8 declares cloud resources.¶
Plan → review → deploy
A plan model7 describes infrastructure changes before they apply. Sam connects Effect purity with a reviewable plan and a concrete deployment result at 12:22. Tests using real infrastructure check behavior after deployment at 16:01.¶
The compiler checks the joins
Effect9 tracks required services in its type. Effects and Layers let the type system track the resource providers a Stack needs at 07:01. Sam describes a type error when code still requires a removed binding23 at 15:25. The compiler can check these relationships before deployment: Happy Path 116, 28:00.¶
Cartridges
A cartridge36 is a package that owns one job and the resources it needs. Replacing its Layer changes the implementation and dependencies without changing callers.¶
Lifecycles
Use an XState machine20 for named states, retries, cancellation, or a lifecycle to resume or inspect. Model the states and the events that move between them.¶
The fence
The fence39 is the compiler checks, lint rules, tests, and hooks that enforce project rules. These rules cannot establish whole-program behavior.¶
Cloud as a library
Sam’s phrase is that the whole cloud becomes a library7, at 29:50. He argues that infrastructure tools can retain application-code properties such as debugging and tests at 03:50.¶
The joins at a glance
| Join | What the program checks | Where to read more |
|---|---|---|
| Contract → surfaces | Shared input and failure schemas | One capability, every surface |
| Code → bindings → resources | Required services and resource providers | Bindings · Infrastructure as Effects, Office Hours 27 |
| Plan → review → deploy | Changes before application; real-infrastructure behavior after deployment | Plan model |
| Compiler → joins | Relationships before deployment; code that requires a removed binding | Happy Path 116 |
| Cartridges | Removal leaves no loose resources or broken imports | Cartridges |
| Lifecycles | Named states and the events between them | Lifecycles are machines |
| Fence | Project rules; whole-program behavior remains outside these checks | The fence |
| Cloud as a library | Debugging and tests for infrastructure code | Cloud as a library |
Sources
- #116 Infrastructure as Effects with Sam Goodwin - YouTube. Sam Goodwin. Client and policy discussion; used for resource requirements implied by runtime operations. Accessed 2026-10-01.
- Alchemy, Infrastructure as Effects | Office Hours 27 🔥 - YouTube. Sam Goodwin. Bundle separation discussion; used for keeping providers out of runtime code. Accessed 2026-10-01.
- Sam Goodwin - Alchemy - devtools.fm. devtools.fm. Plan model and cloud as a library discussions. Accessed 2026-10-11.
Last changed 2026-10-11 in c7848fe. Source on GitHub. Change log.
Linked from
- Agent guide. An Effect stack so pure (aspirational) Kit Langton will blush.
Infrastructure as effects — Sam Goodwin relates application operations to infrastructure requirements in one typed program.
- Agent rules for rat-stack (AGENTS.md). What you may change, which commands to run, and which changes need approval.
Link context
83 ( Infrastructure as Effects) for every cloud resource; declared in apps/infra/alchemy.run.ts, authenticated through Alchemy profiles, never through env vars in this repo
- CAFE names the Cloudflare, Alchemy, Foldkit and Effect stack. CAFE is a named stack: Cloudflare runs the app, Alchemy declares it, Foldkit draws the UI, and Effect does the typed work.
See one capability, every surface and infrastructure as effects.¶
- Change log. What changed in the files served here, newest first.
Infrastructure as effects — edited: feat(lore): explain infrastructure joins with responsive grounded art
- Context and requirements. Effect requirements make a computation's needed services visible in its type.
See Effect basics and infrastructure as effects.¶
- Full agent guide. An Effect stack so pure (aspirational) Kit Langton will blush.
- Rat King binds agents into one encrypted network. Rat King plans an encrypted AT Protocol agent network built on rat-stack.
Alchemy owns infrastructure.¶
- Rat Stack lore | rat-stack. Short, source-grounded notes on the ideas and decisions behind rat-stack.
Infrastructure as effects — Sam Goodwin relates application operations to infrastructure requirements in one typed program.
- Rat's Nest keeps the code public and the inventory private. Joel's purpose-built on-prem cloud uses rat-stack and Alchemy, with private inventory outside the public repo.
It uses rat-stack and Alchemy to declare infrastructure as code.¶
- Source change history (log.md). The generated change log as Markdown.
Infrastructure as effects — edited: feat(lore): explain infrastructure joins with responsive grounded art