Infrastructure as effects
Sam relates runtime clients, business logic, infrastructure policies, and deployed resources in one typed program21. 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 surface25 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 model8 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 cartridge38 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 machine26 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 fence45 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
- Contract β surfaces:
- What the program checks: Shared input and failure schemasΒΆ
- Where to read more: One capability, every surface18ΒΆ
- Code β bindings β resources:
- What the program checks: Required services and resource providersΒΆ
- Where to read more: Bindings23 Β· Infrastructure as Effects, Office Hours 278ΒΆ
- Plan β review β deploy:
- What the program checks: Changes before application; real-infrastructure behavior after deploymentΒΆ
- Where to read more: Plan model8ΒΆ
- Compiler β joins:
- What the program checks: Relationships before deployment; code that requires a removed bindingΒΆ
- Where to read more: Happy Path 1168ΒΆ
- Cartridges38:
- What the program checks: Removal leaves no loose resources or broken importsΒΆ
- Where to read more: Cartridges38ΒΆ
- Lifecycles:
- What the program checks: Named states and the events between themΒΆ
- Where to read more: Lifecycles are machines26ΒΆ
- Fence45:
- What the program checks: Project rules; whole-program behavior remains outside these checksΒΆ
- Where to read more: The fence45ΒΆ
- Cloud as a library7:
- What the program checks: Debugging and tests for infrastructure codeΒΆ
- Where to read more: Cloud as a library7ΒΆ
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-24 in c525d23. Source on GitHub. Change log.
Linked from
- Agent guide. An Effect stack so pure (aspirational) Kit Langton will blush.
sam-goodwin: Listed first among the contributors to alchemy-run/alchemy, which GitHub describes as β Infrastructure as Effectsβ.
- Agent rules for rat-stack (AGENTS.md). What you may change, which commands to run, and which changes need approval.
Link context
run/sql providers ( 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: fix(site): replace published Markdown tables with lists and fence reader output
- 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: fix(site): replace published Markdown tables with lists and fence reader output