Skip to main content

Requirements

Alchemy requires one of the following JavaScript runtimes:
  • Node.js 18.0.0 or higher
  • Bun 1.0.0 or higher (recommended for best performance)
We recommend Bun for the best developer experience. It’s significantly faster than Node.js and has built-in TypeScript support.

Package Installation

Install Alchemy using your preferred package manager:

TypeScript Configuration

Alchemy is built with TypeScript and works best with a properly configured tsconfig.json. Create or update your tsconfig.json:
tsconfig.json
The "types": ["@cloudflare/workers-types"] is only needed if you’re using Cloudflare Workers. Remove it if you’re using other providers.

Provider-Specific Setup

Depending on which cloud providers you plan to use, you may need additional dependencies.

Cloudflare

For Cloudflare Workers, R2, D1, KV, and other services:
Environment Variables:
.env
  1. Account ID: Log into Cloudflare dashboard, find it on the right sidebar
  2. API Token: Create at API Tokens page
    • Use “Edit Cloudflare Workers” template
    • Grant Account > Workers Scripts > Edit
    • Grant Account > Account Settings > Read
  3. Password: Choose a strong password for encrypting secrets

AWS

For AWS Lambda, DynamoDB, S3, and other services:
Environment Variables:
.env

GitHub

For managing GitHub repositories, secrets, and actions:
Environment Variables:
.env

Database Providers

.env

Project Structure

Here’s a recommended project structure for an Alchemy project:

.gitignore Configuration

Make sure to ignore sensitive files:
.gitignore
Never commit .alchemy/ or .env files to version control. They contain encrypted secrets and sensitive state.

Verify Installation

Create a simple test file to verify everything is working:
test-alchemy.ts
Run it:
You should see:

CLI Commands

Alchemy scripts support several CLI flags for different operations:

Deployment Commands

Common Flag Combinations

IDE Setup

VS Code

Install recommended extensions:
  1. TypeScript and JavaScript Language Features (built-in)
  2. ESLint - For linting
  3. Prettier - For code formatting
Add to .vscode/settings.json:
.vscode/settings.json

IntelliJ / WebStorm

  1. Enable TypeScript support: Settings → Languages & Frameworks → TypeScript
  2. Set TypeScript version to project version
  3. Enable ESLint and Prettier in settings

Troubleshooting

Module Resolution Errors

If you see “Cannot find module ‘alchemy’”:
  1. Make sure alchemy is in your package.json dependencies
  2. Run npm install or bun install
  3. Check that "moduleResolution": "bundler" is in your tsconfig.json

Type Errors with Workers Types

If you see type errors with Cloudflare Workers:
  1. Install types: npm install -D @cloudflare/workers-types
  2. Add to tsconfig.json:

Permission Errors

If deployment fails with permission errors:
  1. Verify your API credentials in .env
  2. Check that your API token has the required permissions
  3. For Cloudflare: Ensure you have Workers Scripts > Edit permission

State File Corruption

If state files are corrupted:
  1. Back up .alchemy/ directory
  2. Delete corrupted state files
  3. Run with --adopt to re-adopt existing resources

Next Steps

Quickstart

Deploy your first Cloudflare Worker in 5 minutes

Core Concepts

Learn about Resources, Scopes, and State

Providers

Explore all available cloud providers

Examples

Browse complete example projects
Need help? Join our Discord community or open an issue on GitHub.