MCPcopy Index your code
hub / github.com/alchemy-run/alchemy

github.com/alchemy-run/alchemy @v0.93.12

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.93.12 ↗ · + Follow
3,154 symbols 9,473 edges 873 files 702 documented · 22%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Alchemy

Ask DeepWiki

Alchemy is an embeddable, TypeScript-native Infrastructure-as-Code (IaC) library for modeling Resources that are Created, Updated and Deleted automatically.

Unlike similar tools like Pulumi, Terraform, and CloudFormation, Alchemy is implemented in pure ESM-native TypeScript code.

Resources are simple memoized async functions that can run in any JavaScript runtime, including the browser, serverless functions and durable workflows.

import alchemy from "alchemy";

// initialize the app (with default state $USER)
const app = await alchemy("cloudflare-worker");

// create a Cloudflare Worker
export const worker = await Worker("worker", {
  name: "my-worker",
  entrypoint: "./src/index.ts",
  bindings: {
    COUNTER: counter,
    STORAGE: storage,
    AUTH_STORE: authStore,
    GITHUB_CLIENT_ID: alchemy.secret(process.env.GITHUB_CLIENT_ID),
    GITHUB_CLIENT_SECRET: alchemy.secret(process.env.GITHUB_CLIENT_SECRET),
  },
});

// finalize the alchemy app (triggering deletion of orphaned resources)
await app.finalize();

Features

  • JS-native - no second language, toolchains, processes, services, etc. to lug around.
  • Async-native - resources are just async functions - no complex abstraction to learn.
  • ESM-native - built exclusively on ESM, with a slight preference for modern JS runtimes like Bun.
  • Embeddable - runs in any JavaScript/TypeScript environment, including the browser!
  • Extensible - implement your own resources with a simple function.
  • AI-first - alchemy actively encourages you to use LLMs to create/copy/fork/modify resources to fit your needs. No more waiting around for a provider to be implemented, just do it yourself in a few minutes.
  • No service - state files are stored locally in your project and can be easily inspected, modified, checked into your repo, etc.
  • No strong opinions - structure your codebase however you want, store state anywhere - we don't care!

Examples

Getting Started

See the Getting Started Guide.

Extension points exported contracts — how you extend this code

StateStore (Interface)
(no doc) [6 implementers]
alchemy/src/state.ts
Env (Interface)
(no doc)
alchemy-web/src/router.ts
Env (Interface)
(no doc)
example-monorepo/apps/frontend/types/env.d.ts
ResourceTypeProperty (Interface)
(no doc)
scripts/generate-aws-control-types.ts
ResourceTypeProperty (Interface)
(no doc)
scripts/generate-aws-control.ts
Env (Interface)
(no doc)
tests/smoke-test-flatten-website/types/env.d.ts
Env (Interface)
(no doc)
examples/cloudflare-vite/src/env.d.ts
Env (Interface)
(no doc)
examples/cloudflare-worker-loader/src/env.ts

Core symbols most depended-on inside this repo

get
called by 580
alchemy/src/state.ts
destroy
called by 487
alchemy/src/destroy.ts
destroy
called by 243
alchemy/src/context.ts
Worker
called by 210
alchemy/src/cloudflare/worker.ts
replace
called by 157
alchemy/src/context.ts
Resource
called by 136
alchemy/src/resource.ts
toString
called by 134
alchemy/src/scope.ts
delete
called by 117
alchemy/src/cloudflare/worker-bundle.ts

Shape

Function 1,397
Interface 856
Method 709
Class 192

Languages

TypeScript100%
Go1%

Modules by API surface

alchemy/src/planetscale/api/sdk.gen.ts154 symbols
alchemy/src/neon/api/sdk.gen.ts108 symbols
alchemy/src/clickhouse/api/sdk.gen.ts62 symbols
alchemy/src/util/ignore-matcher.ts49 symbols
alchemy/src/aws/ec2/nat-gateway.ts44 symbols
alchemy/src/scope.ts39 symbols
alchemy/src/cloudflare/bucket.ts35 symbols
alchemy/bin/commands/init.ts35 symbols
alchemy/src/cloudflare/bindings.ts34 symbols
alchemy/src/cloudflare/worker-bundle.ts31 symbols
alchemy/src/aws/control/error.ts31 symbols
alchemy/src/planetscale/database-extensions.ts30 symbols

Datastores touched

(mysql)Database · 1 repos
mydbDatabase · 1 repos
postgresDatabase · 1 repos
(mongodb)Database · 1 repos
mydbDatabase · 1 repos
dbnameDatabase · 1 repos
dbnameDatabase · 1 repos
mydatabaseDatabase · 1 repos

For agents

$ claude mcp add alchemy \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page