Skip to main content
Alchemy is embeddable Infrastructure-as-Code — Write infrastructure in pure TypeScript that runs in any JavaScript runtime, including browsers, serverless functions, and durable workflows.

What is Alchemy?

Alchemy is a modern Infrastructure-as-Code (IaC) library that lets you model cloud resources using pure TypeScript. Unlike traditional IaC tools like Pulumi, Terraform, and CloudFormation, Alchemy is implemented in pure ESM-native TypeScript code with no additional toolchains or processes required. Resources are simple memoized async functions that automatically handle Create, Update, and Delete lifecycles.
import alchemy from "alchemy";
import { Worker } from "alchemy/cloudflare";

// Initialize the app
const app = await alchemy("my-app");

// Create a Cloudflare Worker
export const worker = await Worker("api", {
  name: "my-worker",
  entrypoint: "./src/index.ts",
  bindings: {
    API_KEY: alchemy.secret(process.env.API_KEY),
  },
});

console.log(`Deployed to: ${worker.url}`);

// Finalize (triggers deletion of orphaned resources)
await app.finalize();

Why Alchemy?

JS-Native

No second language, toolchains, processes, or services. Just TypeScript.

Async-Native

Resources are async functions — no complex abstraction to learn.

ESM-Native

Built exclusively on modern ESM with preference for fast runtimes like Bun.

Embeddable

Runs in any JavaScript/TypeScript environment, including the browser!

Extensible

Implement your own resources with a simple function.

AI-First

LLM-friendly design — create/fork/modify resources in minutes, not days.

No Service

State files stored locally in your project — inspect, modify, or commit to your repo.

No Strong Opinions

Structure your codebase however you want. We don’t care!

Key Features

Type-Safe Infrastructure

Every resource is fully typed with TypeScript. Get autocomplete, type checking, and refactoring support right in your IDE.
import { Worker, R2Bucket, D1Database } from "alchemy/cloudflare";

const bucket = await R2Bucket("storage", {
  name: "my-bucket",
});

const db = await D1Database("database", {
  name: "my-db",
  migrationsDir: "./migrations",
});

const worker = await Worker("api", {
  entrypoint: "./src/index.ts",
  bindings: {
    BUCKET: bucket,    // Type-safe binding!
    DATABASE: db,      // Full autocomplete!
  },
});

Encrypted Secrets

Secrets are automatically encrypted in state files using your password.
const app = await alchemy("my-app", {
  password: process.env.ALCHEMY_PASSWORD,
});

const worker = await Worker("api", {
  entrypoint: "./src/index.ts",
  bindings: {
    // Secrets are encrypted in .alchemy/my-app/stage/worker.json
    GITHUB_CLIENT_ID: alchemy.secret(process.env.GITHUB_CLIENT_ID),
    GITHUB_CLIENT_SECRET: alchemy.secret(process.env.GITHUB_CLIENT_SECRET),
  },
});

Resource Adoption

Adopt existing infrastructure into your Alchemy app seamlessly.
const app = await alchemy("my-app");

// Adopt existing Cloudflare Worker
const worker = await Worker("legacy-api", {
  name: "existing-worker-name",
  adopt: true,  // Won't fail if already exists
  entrypoint: "./src/index.ts",
});

Local Development

Develop and test infrastructure locally before deploying to production.
// Run with: bun ./alchemy.run.ts --local
const app = await alchemy("my-app");

// Resources run in Miniflare locally
const worker = await Worker("api", {
  entrypoint: "./src/index.ts",
  dev: { remote: false },  // Use local simulator
});

console.log(worker.url);  // http://localhost:8787

Supported Providers

Alchemy supports multiple cloud providers and services:

Cloudflare

Workers, R2, D1, KV, Durable Objects, and more

AWS

Lambda, DynamoDB, S3, IAM, and CloudControl API

GitHub

Repositories, Secrets, Actions

Neon

Serverless Postgres databases

PlanetScale

MySQL databases with branching

Docker

Containers and images

Stripe

Payment infrastructure

Sentry

Error tracking and monitoring

Upstash

Serverless Redis and Kafka

Next Steps

Quickstart

Deploy your first Cloudflare Worker in under 5 minutes

Installation

Install Alchemy and set up your development environment

Core Concepts

Learn about Resources, Scopes, and State management

Examples

Browse complete example projects and patterns
New to Infrastructure-as-Code? Alchemy makes it easy to get started. Follow the Quickstart to deploy your first resource in minutes.

Build docs developers (and LLMs) love