Redwood
Deploy a RedwoodJS application to Cloudflare Pages with automatically configured defaults. This resource handles the deployment of RedwoodJS applications with optimized settings for Cloudflare Workers.
Minimal Example
Section titled “Minimal Example”Deploy a basic RedwoodJS application with default settings:
import { Redwood } from "alchemy/cloudflare";
const redwoodApp = await Redwood("my-redwood-app");
With Database Binding
Section titled “With Database Binding”Add a D1 database binding to your RedwoodJS application:
import { Redwood, D1Database } from "alchemy/cloudflare";
const database = await D1Database("redwood-db");
const redwoodApp = await Redwood("redwood-with-db", { bindings: { DB: database, },});
Custom Build Configuration
Section titled “Custom Build Configuration”Deploy with custom build command and environment variables:
import { Redwood } from "alchemy/cloudflare";
const redwoodApp = await Redwood("custom-redwood", { command: "bun run test && RWSDK_DEPLOY=1 bun run build:production", bindings: { API_KEY: alchemy.secret("api-key-secret"), }, vars: { NODE_ENV: "production", APP_ENV: "staging", },});
Bind to a Worker
Section titled “Bind to a Worker”Bind a RedwoodJS application to a Worker:
import { Worker, Redwood } from "alchemy/cloudflare";
const redwoodApp = await Redwood("my-redwood-app", { name: "redwood-worker", command: "bun run build",});
await Worker("my-worker", { name: "my-worker", script: "console.log('Hello from worker')", bindings: { REDWOOD: redwoodApp, },});