RepoReplicateReplicatepublished Feb 11, 2025seen 5d

replicate/getting-started-cloudflare-workers

JavaScript

Open original ↗

Captured source

source ↗

replicate/getting-started-cloudflare-workers

Description: Template app using Cloudflare Workers, Hono, and Replicate to generate images using Flux Schnell

Language: JavaScript

Stars: 19

Forks: 5

Open issues: 1

Created: 2025-02-11T18:09:24Z

Pushed: 2025-02-13T00:03:09Z

Default branch: main

Fork: no

Archived: no

README:

Getting started with Cloudflare Workers and Replicate

This is a template for a simple web app using Cloudflare Workers, Hono, and Replicate to generate images using Flux Schnell, a fast and high-quality open-source image generation model.

🍿 Watch the 60-second demo on YouTube

---

!screenshot

Stack

  • Cloudflare Workers is a serverless platform for building web applications. You can run "serverless" functions in a Node.js-like environment, plus serve static web pages and assets.
  • Hono is a minimalist web framework for building serverless applications. It's built and maintained by Cloudflare.
  • Replicate is a platform for building and running machine learning models.
  • Flux Schnell is a fast and high-quality open-source image generation model, made by the original creators of Stable Diffusion.

Prerequisites

  • Node.js - You'll need a recent version of Node.js installed to run the app locally.
  • Cloudflare account - You'll need a Cloudflare account to deploy the app.
  • Replicate account - You'll need a Replicate account to run the Flux Schnell model.

Getting started

To create a new Cloudflare Workers project using this repo as a template, run this command:

npm create cloudflare@latest -- cloudflare-replicate-demo --template replicate/getting-started-cloudflare-workers

This will run you through an interactive series of prompts to create a new project, create a Git repository, install dependencies, and optionally deploy it to Cloudflare.

Development

To run the app locally, create a Replicate API token and copy it to a .dev.vars file.

Install your dependencies:

npm install

Run local server:

npm run dev

Hit the b key to open the server in your browser.

Deployment

To deploy your app to Cloudflare, you'll need to upload your Replicate API token as a Cloudflare secret:

npx wrangler secret put REPLICATE_API_TOKEN

Then, deploy your app:

npm run deploy

Notability

notability 2.0/10

Low stars, routine tutorial repo