Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand Down
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -71,15 +71,15 @@ 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
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.)
Expand All @@ -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.<you>.workers.dev
npx wrangler secret put HOST # bare hostname, no protocol, e.g. shopify-on-cloudflare.<you>.workers.dev
```

Copy `.env.example` to `.env` and fill in `VITE_SHOPIFY_CLIENT_ID` (the public client ID).
Expand Down Expand Up @@ -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'));
"
Expand Down Expand Up @@ -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).
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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`."
}
}
},
Expand All @@ -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",
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
"
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 5 additions & 5 deletions wrangler.jsonc
Original file line number Diff line number Diff line change
@@ -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"],
Expand All @@ -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"
}
Expand All @@ -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"
}
],

Expand Down
Loading