← ClaudeAtlas

cloudflare-nextjs-setuplisted

Set up Cloudflare Workers deployment for an existing Next.js project using OpenNext. Triggers on "deploy to Cloudflare", "set up Cloudflare Workers", "Cloudflare deployment", "add Cloudflare to this project".
fysoul17/devlyn-cli · ★ 1 · Web & Frontend · score 65
Install: claude install-skill fysoul17/devlyn-cli
# Cloudflare Workers + Next.js Setup Set up Cloudflare Workers deployment for an existing Next.js project using OpenNext. ## Procedure Follow these 8 steps in order. Read existing files before modifying them. ### Step 1: Detect Environment Before making any changes, gather project context: 1. **Package manager** — Check for `pnpm-lock.yaml`, `yarn.lock`, `bun.lockb`, or `package-lock.json` (in that priority order) 2. **Next.js config format** — Check for `next.config.ts`, `next.config.mjs`, or `next.config.js` 3. **Existing Cloudflare config** — Check for `wrangler.jsonc`, `wrangler.toml`, `wrangler.json`, or `open-next.config.ts`. If found, warn the user and ask before overwriting 4. **Monorepo detection** — Check if `package.json` has `workspaces` field or if a root `pnpm-workspace.yaml` exists. If monorepo, determine which directory contains the Next.js app (look for `next.config.*`) 5. **Project name** — Use `$ARGUMENTS` if provided, otherwise extract `name` from the app's `package.json` Store results for use in subsequent steps. All config files go in the **Next.js app directory** (not the monorepo root). ### Step 2: Install Dependencies Install using the detected package manager. Both packages go in the Next.js app directory: - `@opennextjs/cloudflare` — as a **dependency** (required at runtime) - `wrangler` — as a **devDependency** (CLI tooling only) Examples: ```bash # pnpm (with workspace filter if monorepo) pnpm add @opennextjs/cloudflare pnpm add -D wran