Prerequisites
- Node.js 18+ or Bun
- A Cloudflare account with an API token (create one here)
Install Alchemy
1
Create a new project
Create a new directory and initialize your project:
2
Install Alchemy
3
Set up credentials
Create a
.env file with your Cloudflare credentials:Create your first deployment
1
Create the Worker code
Create a file
src/worker.ts with your Worker code:src/worker.ts
2
Create the deployment script
Create
alchemy.run.ts to define your infrastructure:alchemy.run.ts
3
Deploy to Cloudflare
Run the deployment script:You should see output like:
4
Test your Worker
Visit the URL in your browser or use curl:Response:
Make updates
Update your Worker code insrc/worker.ts, then re-run the deployment script. Alchemy will detect the changes and update only what’s necessary:
Tear down
To delete all resources:What’s next?
Core concepts
Learn about resources, scopes, and lifecycle
Local development
Develop and test locally with Miniflare
Manage secrets
Securely handle API keys and credentials
More examples
Browse complete examples