2026-05-03 16:30:11 -04:00
2026-05-03 16:30:11 -04:00
2026-05-02 10:01:13 -04:00
2026-05-02 09:18:15 -04:00
2026-05-02 09:18:15 -04:00
2026-05-02 09:18:15 -04:00
2026-05-02 09:18:15 -04:00
2026-05-02 09:18:15 -04:00
2026-05-02 09:18:15 -04:00

React Editor Demo (Shopify)

Standalone Next.js 16 (app router) demo wiring up the Shopify-aware React Editor.

What's here

  • editor/ — drop-in copy of the editor scaffold from fe-shopify-client/app/editor. Components, config, theme, Shopify client/queries/hooks/contexts, plugin-ai vendor css.
  • app.schema.json — source of truth for every page in the demo. Shape: { "/": { root, content }, "/about": { ... }, ... }. The save endpoint writes back to this file.
  • app/[[...path]]/page.tsx — view route. Reads the schema and mounts <Render>.
  • app/edit/[[...path]]/page.tsx — edit route. Reads the schema and mounts <Editor>.
  • app/api/save-schema/route.ts — POST { route, data } → patches app.schema.json on disk.
  • app/api/chat/route.tsaiPlugin endpoint. Uses the Vercel AI Gateway (AI_GATEWAY_API_KEY) to talk to Claude, with the editor + Shopify tool surface (updatePage, searchProducts, etc.).

Run

cp .env.local.example .env.local   # optional — defaults to mock.shop
yarn install
yarn dev   # → http://localhost:3001
  • View any route: http://localhost:3001/, /about, /products/handle, etc.
  • Edit any route: http://localhost:3001/edit, /edit/about, etc.
  • 404 in view mode means the route isn't in app.schema.json yet — add it via the editor's New page button.

Shopify

Defaults to the public mock.shop storefront (no token needed) so commerce blocks render demo data immediately. Override via NEXT_PUBLIC_SHOPIFY_DOMAIN and NEXT_PUBLIC_SHOPIFY_STOREFRONT_ACCESS_TOKEN in .env.local.

AI

/api/chat mirrors the host app's pattern — pass a string-form model id (anthropic/claude-sonnet-4.6) and the AI SDK routes through the Vercel AI Gateway using AI_GATEWAY_API_KEY. Tools include the React Editor built-ins plus Shopify search/lookup helpers.

Description
No description provided
Readme 1.2 MiB
Languages
TypeScript 97.5%
JavaScript 1.3%
CSS 1.1%
HTML 0.1%