| 1 | <div align="center"> |
| 2 | |
| 3 | <a href="https://alchemy.run"> |
| 4 | <img src="https://raw.githubusercontent.com/alchemy-run/alchemy/main/images/readme-hero.webp" alt="Alchemy — Infrastructure as Effects" width="360" /> |
| 5 | </a> |
| 6 | |
| 7 | <br /> |
| 8 | |
| 9 | [](https://www.npmjs.com/package/alchemy) |
| 10 | [](./LICENSE) |
| 11 | [](https://alchemy.run/discord) |
| 12 | |
| 13 | **Infrastructure-as-Effects** — cloud infrastructure and application logic as a single, type-safe [Effect](https://effect.website) program. |
| 14 | |
| 15 | [Docs](https://alchemy.run) · [Tutorial](https://alchemy.run/tutorial/part-1) · [Examples](./examples) · [Discord](https://alchemy.run/discord) |
| 16 | |
| 17 | </div> |
| 18 | |
| 19 | --- |
| 20 | |
| 21 | A Worker bound to a R2 bucket and serving objects from it: |
| 22 | |
| 23 | ```typescript |
| 24 | const Bucket = Cloudflare.R2.Bucket("bucket"); |
| 25 | |
| 26 | export default Cloudflare.Worker( |
| 27 | "api", |
| 28 | { main: import.meta.url }, |
| 29 | Effect.gen(function* () { |
| 30 | const bucket = yield* Cloudflare.R2.ReadWriteBucket(Bucket); |
| 31 | return { |
| 32 | fetch: Effect.gen(function* () { |
| 33 | const request = yield* HttpServerRequest; |
| 34 | const object = yield* bucket.get(request.url); |
| 35 | return HttpServerResponse.stream(object!.body); |
| 36 | }) |
| 37 | }; |
| 38 | }).pipe(Effect.provide(Cloudflare.R2.ReadWriteBucketBinding)), |
| 39 | ); |
| 40 | ``` |
| 41 | |
| 42 | One `ReadWriteBucket(Bucket)` call wires the binding, env var, and typed client — at deploy time and at runtime. |
| 43 | |
| 44 | --- |
| 45 | |
| 46 | - **One program, one language.** Resources, Lambdas/Workers, IAM, and SDKs live in the same Effect program — no YAML, no second runtime. |
| 47 | - **Bindings, not glue code.** `S3.GetObject(bucket)` wires the IAM policy, env var, and a typed SDK call in a single line. |
| 48 | - **Errors in the type system.** Every cloud API failure is a tagged Effect error you handle — or don't — on purpose. |
| 49 | - **AWS + Cloudflare today.** S3, SQS, DynamoDB, Kinesis, Lambda, EC2 / Workers, R2, D1, Durable Objects, Containers. |
| 50 | - **Same code, every stage.** Local dev, `plan` / `deploy`, smoke tests, and CI all share one mental model. |
| 51 | |
| 52 | ```sh |
| 53 | bun add alchemy@latest effect@rc |
| 54 | ``` |
| 55 | |
| 56 | ## GitHub Action |
| 57 | |
| 58 | Use the root action to deploy `prod` from `main`, deploy PR previews as |
| 59 | `staging-{number}`, and destroy PR previews when the PR closes: |
| 60 | |
| 61 | ```yaml |
| 62 | - uses: alchemy-run/alchemy@v1 |
| 63 | env: |
| 64 | CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }} |
| 65 | CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} |
| 66 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 67 | ``` |
| 68 | |
| 69 | The workflow must install the `alchemy` CLI before this action runs. |
| 70 | |
| 71 | ## Bootstrap with an AI coding agent |
| 72 | |
| 73 | Paste this into Claude Code, Cursor, or any agent that can fetch a URL: |
| 74 | |
| 75 | ``` |
| 76 | You are an Alchemy expert. Read https://alchemy.run/llms.txt to load the |
| 77 | full documentation index, then act as my pair on this project. |
| 78 | |
| 79 | Goal: help me set up, build, test, and deploy a cloud application with |
| 80 | `alchemy` (Infrastructure-as-Effects, powered by Effect). |
| 81 | |
| 82 | Follow the patterns from the docs and the /examples folder. Stay idiomatic |
| 83 | to Effect: use Layers for wiring, return Effects from lifecycle code, and |
| 84 | keep infra and runtime in the same program. Ask before introducing new |
| 85 | dependencies or breaking conventions. |
| 86 | ``` |
| 87 | |
| 88 | ## Learn more |
| 89 | |
| 90 | - [What is Alchemy?](https://alchemy.run/what-is-alchemy) — the framework in 2 minutes |
| 91 | - [Getting Started](https://alchemy.run/getting-started) — your first Stack |
| 92 | - [Tutorial](https://alchemy.run/tutorial/part-1) — five-part walkthrough to a tested, CI-deployed app |
| 93 | - [Examples](./examples) — runnable projects on AWS and Cloudflare |
| 94 | - [llms.txt](https://alchemy.run/llms.txt) — agent-ready documentation index |
| 95 | |
| 96 | > **alchemy** is in alpha. Expect breaking changes. Come hang in our [Discord](https://alchemy.run/discord). |
| 97 | |
| 98 | ## Credits |
| 99 | |
| 100 | ### Blacksmith |
| 101 | |
| 102 | Thanks to [Blacksmith](https://blacksmith.sh/?ref=alchemy.run) for sponsoring our CI runners. Their fast Linux, macOS, and Windows runners help us test our packages across platforms and deploy our content-heavy website in mere minutes. |
| 103 | |
| 104 | ## License |
| 105 | |
| 106 | Licensed under the [Apache License 2.0](./LICENSE). See |
| 107 | [Third-Party Licenses](./THIRD_PARTY_LICENSES.md) for code incorporated from |
| 108 | upstream projects. |