This repo contains a CloudFlare worker called "placeholder-zoo". The worker runs image generation models on Replicate, stores the output files in CloudFlare, and serves them with dynamic image resizing using Cloudflare Transformations.
👉 Follow the guide at https://replicate.com/docs/guides/cloudflare-image-cache
- A Cloudflare account. You can sign up and run workers for free.
- A Replicate account
- Node.js 20 or later
- Git, for storing your code changes as you build.
Read the guide for step-by-step instructions to create this app, or jump right into using it with the commands below.
First, clone this repo:
git clone https://github.com/replicate/cloudflare-image-cache
cd cloudflare-image-cache
Then, install dependencies:
npm install
Then, set up secrets for your worker. You'll need these secrets:
REPLICATE_API_TOKEN
CLOUDFLARE_ACCOUNT_ID
CLOUDFLARE_API_TOKEN
CLOUDFLARE_IMAGE_ACCOUNT_HASH
Then run your worker locally:
npm run dev