diff --git a/CLAUDE.md b/CLAUDE.md index d54bfe5..6f91151 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -6,7 +6,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with th ## Project Overview -**cloudflare-shopify-starter** — Shopify embedded app starter on Cloudflare Workers + Hono + D1 + KV + R2 + React + Polaris. Built on production-tested patterns; ships with session-token auth, KV-backed Shopify session storage, Drizzle ORM, and a minimal one-page React + Polaris frontend. +**shopify-on-cloudflare** — Shopify embedded app starter on Cloudflare Workers + Hono + D1 + KV + R2 + React + Polaris. Built on production-tested patterns; ships with session-token auth, KV-backed Shopify session storage, Drizzle ORM, and a minimal one-page React + Polaris frontend. See `README.md` for setup. See `wrangler.jsonc` for which Cloudflare bindings are wired in (D1, KV, R2) and which are commented out as opt-in examples (Queues, Durable Objects, Cron). diff --git a/README.md b/README.md index 5c04d4f..32be1a7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# cloudflare-shopify-starter +# Shopify on Cloudflare [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) [![Cloudflare Workers](https://img.shields.io/badge/Cloudflare-Workers-F38020?logo=cloudflare&logoColor=white)](https://workers.cloudflare.com) @@ -71,7 +71,7 @@ npm install ```bash # Database -wrangler d1 create cloudflare-shopify-starter-db +wrangler d1 create shopify-on-cloudflare-db # → copy the returned database_id into wrangler.jsonc # KV namespace for Shopify sessions @@ -79,7 +79,7 @@ wrangler kv:namespace create SESSION_KV # → copy the returned id into wrangler.jsonc # R2 bucket for file storage -wrangler r2 bucket create cloudflare-shopify-starter-files +wrangler r2 bucket create shopify-on-cloudflare-files ``` Open `wrangler.jsonc` and replace the `YOUR_*` placeholders (`database_id`, KV `id`) with the values above. (No `account_id` needed — Wrangler uses your logged-in account.) @@ -91,7 +91,7 @@ In the Shopify Partner dashboard, create an app and copy its client ID and secre ```bash npx wrangler secret put SHOPIFY_CLIENT_ID npx wrangler secret put SHOPIFY_API_SECRET -npx wrangler secret put HOST # bare hostname, no protocol, e.g. cloudflare-shopify-starter..workers.dev +npx wrangler secret put HOST # bare hostname, no protocol, e.g. shopify-on-cloudflare..workers.dev ``` Copy `.env.example` to `.env` and fill in `VITE_SHOPIFY_CLIENT_ID` (the public client ID). @@ -150,7 +150,7 @@ Everything is served at http://localhost:5173, with the Worker running in the re Seed a test shop and hit the example endpoint: ```bash -wrangler d1 execute cloudflare-shopify-starter-db --local --command " +wrangler d1 execute shopify-on-cloudflare-db --local --command " INSERT OR IGNORE INTO shopify_shop (id, myshopify_domain, domain, name, status, install_date) VALUES ('test-shop-id', 'mystore.myshopify.com', 'mystore.myshopify.com', 'Test Store', 'installed', datetime('now')); " @@ -219,6 +219,14 @@ For significant changes, open an issue first to discuss the approach. --- +## Learn more + +Need a custom Shopify app or storefront built on Cloudflare? See [Devkind's Shopify development services](https://devkind.com.au/services/shopify). + +Built by [Devkind](https://devkind.com.au). Maintained by the Devkind Engineering team (hello@devkind.com.au). + +--- + ## License MIT — see [LICENSE](LICENSE). diff --git a/package-lock.json b/package-lock.json index 7ffe806..715154c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "cloudflare-shopify-starter-template", + "name": "shopify-on-cloudflare", "version": "0.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "cloudflare-shopify-starter-template", + "name": "shopify-on-cloudflare", "version": "0.1.0", "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 559ad7e..afaa9f6 100755 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "cloudflare-shopify-starter-template", + "name": "shopify-on-cloudflare", "version": "0.1.0", "private": true, "description": "Shopify embedded app starter on Cloudflare Workers — Hono, D1, KV, R2, React, Polaris, Drizzle ORM, session-token auth", @@ -44,13 +44,13 @@ ], "bindings": { "DB": { - "description": "D1 database — run `wrangler d1 create cloudflare-shopify-starter-db` and paste the returned `database_id` into `wrangler.jsonc`." + "description": "D1 database — run `wrangler d1 create shopify-on-cloudflare-db` and paste the returned `database_id` into `wrangler.jsonc`." }, "SESSION_KV": { "description": "KV namespace for Shopify session storage — run `wrangler kv:namespace create SESSION_KV` and paste the returned `id` into `wrangler.jsonc`." }, "R2": { - "description": "R2 bucket for file storage — run `wrangler r2 bucket create cloudflare-shopify-starter-files`." + "description": "R2 bucket for file storage — run `wrangler r2 bucket create shopify-on-cloudflare-files`." } } }, @@ -60,8 +60,8 @@ "build": "vite build", "preview": "npm run build && vite preview", "deploy": "npm run build && wrangler d1 migrations apply DB --remote && wrangler deploy", - "d1:migrate": "wrangler d1 migrations apply cloudflare-shopify-starter-db --remote", - "d1:migrate:local": "wrangler d1 migrations apply cloudflare-shopify-starter-db --local", + "d1:migrate": "wrangler d1 migrations apply shopify-on-cloudflare-db --remote", + "d1:migrate:local": "wrangler d1 migrations apply shopify-on-cloudflare-db --local", "d1:generate": "drizzle-kit generate", "lint": "eslint web --ext .ts,.tsx --fix", "lint:ci": "eslint web --ext .ts,.tsx", @@ -71,7 +71,7 @@ "test:e2e": "playwright test", "cf-typegen": "wrangler types", "check": "tsc --noEmit && vite build && wrangler deploy --dry-run", - "setup": "wrangler d1 migrations apply cloudflare-shopify-starter-db --local" + "setup": "wrangler d1 migrations apply shopify-on-cloudflare-db --local" }, "dependencies": { "@bugsnag/js": "^8.9.0", diff --git a/src/CLAUDE.md b/src/CLAUDE.md index 86f01d6..bbe43c9 100644 --- a/src/CLAUDE.md +++ b/src/CLAUDE.md @@ -52,10 +52,10 @@ To make a route public, add it to `PUBLIC_API_PATHS` in `requireShop.ts` with a ```bash # Apply migrations -wrangler d1 migrations apply cloudflare-shopify-starter-db --local +wrangler d1 migrations apply shopify-on-cloudflare-db --local # Insert a test shop -wrangler d1 execute cloudflare-shopify-starter-db --local --command " +wrangler d1 execute shopify-on-cloudflare-db --local --command " INSERT OR IGNORE INTO shopify_shop (id, myshopify_domain, domain, name, status, install_date) VALUES ('test-shop-id', 'mystore.myshopify.com', 'mystore.myshopify.com', 'Test Store', 'installed', datetime('now')); " diff --git a/src/index.ts b/src/index.ts index 8d8ef47..38d19ac 100644 --- a/src/index.ts +++ b/src/index.ts @@ -27,7 +27,7 @@ app.route('/', exampleRoutes); app.route('/', previewRoutes); // Health check -app.get('/health', (c) => c.json({ status: 'ok', app: 'cloudflare-shopify-starter' })); +app.get('/health', (c) => c.json({ status: 'ok', app: 'shopify-on-cloudflare' })); // Catch-all: serve SPA and static assets via Cloudflare Assets binding. // Must be last so all Worker routes (auth, API, webhooks) take priority. diff --git a/wrangler.jsonc b/wrangler.jsonc index 6378629..7fae780 100644 --- a/wrangler.jsonc +++ b/wrangler.jsonc @@ -1,6 +1,6 @@ { "$schema": "node_modules/wrangler/config-schema.json", - "name": "cloudflare-shopify-starter-template", + "name": "shopify-on-cloudflare", "main": "src/index.ts", "compatibility_date": "2026-01-01", "compatibility_flags": ["nodejs_compat"], @@ -21,12 +21,12 @@ "run_worker_first": true }, - // D1 — create with: wrangler d1 create cloudflare-shopify-starter-db + // D1 — create with: wrangler d1 create shopify-on-cloudflare-db // then paste the returned database_id below. "d1_databases": [ { "binding": "DB", - "database_name": "cloudflare-shopify-starter-db", + "database_name": "shopify-on-cloudflare-db", "database_id": "YOUR_DATABASE_ID", "migrations_dir": "drizzle/migrations" } @@ -40,11 +40,11 @@ } ], - // R2 (file storage) — create with: wrangler r2 bucket create cloudflare-shopify-starter-files + // R2 (file storage) — create with: wrangler r2 bucket create shopify-on-cloudflare-files "r2_buckets": [ { "binding": "R2", - "bucket_name": "cloudflare-shopify-starter-files" + "bucket_name": "shopify-on-cloudflare-files" } ],