Skip to content
GitHubXDiscordRSS

Assets

Learn how to deploy and manage static assets on Cloudflare using Alchemy for optimal performance and delivery.

The Assets resource lets you add static assets to your Cloudflare Workers.

Create a basic assets bundle from a local directory:

import { Assets } from "alchemy/cloudflare";
const staticAssets = await Assets({
path: "./src/assets",
});

Bind the assets to a worker to serve them:

import { Worker, Assets } from "alchemy/cloudflare";
const staticAssets = await Assets({
path: "./src/assets",
});
const worker = await Worker("frontend", {
name: "frontend-worker",
entrypoint: "./src/worker.ts",
bindings: {
ASSETS: staticAssets,
},
});