@cimplify/sdk 0.42.0 → 0.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/package.json +1 -1
  2. package/templates/storefront-bakery/.claude/skills/cimplify-storefront/SKILL.md +145 -0
  3. package/templates/storefront-bakery/.cursor/rules/cimplify-storefront.mdc +25 -0
  4. package/templates/storefront-bakery/AGENTS.md +61 -10
  5. package/templates/storefront-bakery/CLAUDE.md +22 -0
  6. package/templates/storefront-fashion/.claude/skills/cimplify-storefront/SKILL.md +145 -0
  7. package/templates/storefront-fashion/.cursor/rules/cimplify-storefront.mdc +25 -0
  8. package/templates/storefront-fashion/AGENTS.md +80 -26
  9. package/templates/storefront-fashion/CLAUDE.md +22 -0
  10. package/templates/storefront-grocery/.claude/skills/cimplify-storefront/SKILL.md +145 -0
  11. package/templates/storefront-grocery/.cursor/rules/cimplify-storefront.mdc +25 -0
  12. package/templates/storefront-grocery/AGENTS.md +56 -11
  13. package/templates/storefront-grocery/CLAUDE.md +22 -0
  14. package/templates/storefront-restaurant/.claude/skills/cimplify-storefront/SKILL.md +145 -0
  15. package/templates/storefront-restaurant/.cursor/rules/cimplify-storefront.mdc +25 -0
  16. package/templates/storefront-restaurant/AGENTS.md +64 -13
  17. package/templates/storefront-restaurant/CLAUDE.md +22 -0
  18. package/templates/storefront-retail/.claude/skills/cimplify-storefront/SKILL.md +145 -0
  19. package/templates/storefront-retail/.cursor/rules/cimplify-storefront.mdc +25 -0
  20. package/templates/storefront-retail/AGENTS.md +65 -24
  21. package/templates/storefront-retail/CLAUDE.md +22 -0
  22. package/templates/storefront-services/.claude/skills/cimplify-storefront/SKILL.md +145 -0
  23. package/templates/storefront-services/.cursor/rules/cimplify-storefront.mdc +25 -0
  24. package/templates/storefront-services/AGENTS.md +64 -16
  25. package/templates/storefront-services/CLAUDE.md +22 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cimplify/sdk",
3
- "version": "0.42.0",
3
+ "version": "0.43.0",
4
4
  "description": "Cimplify Commerce SDK for storefronts",
5
5
  "keywords": [
6
6
  "cimplify",
@@ -0,0 +1,145 @@
1
+ ---
2
+ name: cimplify-storefront
3
+ description: Build, customize, rebrand, or deploy a Cimplify-scaffolded storefront. Triggers when the user asks to create a storefront, rebrand a Cimplify template, change the palette, add a page, deploy to Cimplify, or works in a project containing `lib/brand.ts` and `next.config.ts` with `cacheComponents`.
4
+ ---
5
+
6
+ # Cimplify Storefront skill
7
+
8
+ You're working on a project scaffolded from `bunx @cimplify/sdk init`. The architecture is opinionated and the rebrand surface is intentionally small. Read `AGENTS.md` at the project root for the file ↔ brand-field map for *this template's* industry; this skill gives you the playbook that's the same across all six.
9
+
10
+ ## The contract — never break
11
+
12
+ 1. **`lib/brand.ts` is the only place for content edits.** Every visible string reads from this file. If a string isn't in `brand`, *add a field* to the `Brand` interface — don't hardcode it in a page or component.
13
+ 2. **`app/globals.css` `@theme { … }`** holds palette + radius + font references. To re-skin the entire site, edit only this block.
14
+ 3. **Server Components are cached** via `'use cache'` + `cacheTag(tags.X())` + `cacheLife("hours")`. Don't downgrade them to `"use client"` to avoid an issue — fix the issue.
15
+ 4. **Client islands** (anything reading `useSearchParams`, `usePathname`, `useRouter`, `useState`) live behind `<Suspense>`.
16
+ 5. **`cacheComponents: true`** in `next.config.ts` is non-negotiable. Don't turn it off.
17
+ 6. **`bun run test:run` (vitest)** is the canonical test runner. `bun test` will show false failures because Bun's `vi` shim is incomplete.
18
+ 7. **Cart, checkout, orders stay client.** They're session-bound. Don't try to SSR them.
19
+
20
+ ## The brand-field schema (in `lib/brand.ts`)
21
+
22
+ ```
23
+ identity: name, shortName, microTag, description, schemaType, currency, locale
24
+ contact: address, streetAddress, city, countryCode, phone, phoneTel, email, privacyEmail, hours
25
+ socials: [{ label, href, icon }] // icon ∈ instagram|x|tiktok|facebook|youtube|linkedin|whatsapp
26
+ header: { nav: [{ label, href }] }
27
+ hero: { badge, title, subtitle, primaryCtaLabel, secondaryCtaLabel?, secondaryCtaHref? }
28
+ optional: trustItems[]?, brandStrip?, promo?, tradeIn? // render conditionally
29
+ newsletter: { eyebrow, title, body, placeholder, submitLabel, successLabel }
30
+ about: { eyebrow, title, paragraphs[], sections[{ heading, body }] }
31
+ faq: { eyebrow, title, sections[{ title, items[{ q, a }] }], contactPrompt, contactEmail }
32
+ terms,
33
+ privacy,
34
+ shipping,
35
+ returns,
36
+ accessibility: { eyebrow, title, lastUpdated, sections[{ heading, body | { intro, bullets[] } }] }
37
+ account: eyebrows + titles for /account, /login, /signup
38
+ contactPage: { eyebrow, title, body, reasons[], directLines[{ label, value, href }] }
39
+ trackOrder: { eyebrow, title, body }
40
+ footer: { blurb, sitemap[{ title, links[] }], poweredBy? }
41
+ llms: { summary } // opens /llms.txt
42
+ mock: { seed, businessId }
43
+ ```
44
+
45
+ ## Playbook — common tasks
46
+
47
+ ### Rebrand a storefront for a new merchant
48
+
49
+ 1. Edit `lib/brand.ts`. Replace every field with the merchant's content. Use the brief / context the user gave you.
50
+ 2. Edit `app/globals.css` `@theme { … }`. Change `--color-primary`, `--color-background`, `--color-foreground`, optionally `--radius`. Use OKLCH; if the brand only gave hex, convert.
51
+ 3. (Optional) Swap fonts in `app/layout.tsx` — `next/font/google` import + the variable wired into the `<html>` className.
52
+ 4. Set `.env.local`: `NEXT_PUBLIC_CIMPLIFY_API_URL`, `NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY`, `NEXT_PUBLIC_CIMPLIFY_BUSINESS_ID`, `NEXT_PUBLIC_SITE_URL`.
53
+
54
+ Don't touch any other file. If the rebrand needs content not in the schema, add the field to `Brand` first, populate it, then read it from the page.
55
+
56
+ ### Add a new section / component
57
+
58
+ 1. Build it as a Server Component in `components/` (or a client island in `*-client.tsx` if interactive).
59
+ 2. Read merchant copy from `brand`. Add new fields to the `Brand` interface if needed.
60
+ 3. Wrap interactive bits in `<Suspense fallback={…}>` so the cached chrome streams.
61
+ 4. Compose into the page.
62
+
63
+ ### Wire a Server Action that mutates data
64
+
65
+ ```ts
66
+ "use server";
67
+ import { getServerClient, revalidateProducts } from "@cimplify/sdk/server";
68
+
69
+ export async function createProduct(input: ProductInput) {
70
+ await getServerClient().catalogue.createProduct(input);
71
+ revalidateProducts();
72
+ }
73
+ ```
74
+
75
+ After every mutation, call the matching `revalidate*` helper from `@cimplify/sdk/server`: `revalidateProducts`, `revalidateProduct(id)`, `revalidateCategories`, `revalidateCategory(id)`, `revalidateCollections`, `revalidateCollection(id)`, `revalidateBusiness`.
76
+
77
+ ### Add a Server Component data fetch
78
+
79
+ ```ts
80
+ import { cacheTag, cacheLife } from "next/cache";
81
+ import { getServerClient, tags } from "@cimplify/sdk/server";
82
+
83
+ async function getX() {
84
+ "use cache";
85
+ cacheTag(tags.products());
86
+ cacheLife("hours");
87
+ const r = await getServerClient().catalogue.getProducts({ limit: 24 });
88
+ if (!r.ok) throw new Error(r.error.message);
89
+ return r.value.items;
90
+ }
91
+ ```
92
+
93
+ ### Eject an SDK component for deeper customization
94
+
95
+ Try `classNames`, `renderImage`, `renderLink`, slot props first. If those run out:
96
+
97
+ ```bash
98
+ bunx @cimplify/sdk eject --list
99
+ bunx @cimplify/sdk eject product-card --dir src/components/cimplify
100
+ ```
101
+
102
+ Once ejected, the file is yours. Hooks/types still come from `@cimplify/sdk`.
103
+
104
+ ### Deploy
105
+
106
+ ```bash
107
+ bunx @cimplify/sdk login
108
+ bunx @cimplify/sdk projects create my-store
109
+ bunx @cimplify/sdk link <project-id>
110
+ bunx @cimplify/sdk env push
111
+ bunx @cimplify/sdk deploy --prod
112
+ bunx @cimplify/sdk logs --follow
113
+ bunx @cimplify/sdk domains add my-store.com
114
+ ```
115
+
116
+ ## Pitfalls — explicit ❌ list
117
+
118
+ - ❌ Hardcoding any visible string in a page or component. Always `brand.X`.
119
+ - ❌ Disabling `cacheComponents: true` to silence a warning. Fix the warning by wrapping the dynamic call in `<Suspense>`.
120
+ - ❌ Using `unstable_cache` — Next 16's canonical primitive is `'use cache'` + `cacheTag` + `cacheLife`.
121
+ - ❌ Bypassing `getServerClient()` and calling `createCimplifyClient` directly in a Server Component — loses per-request memoization.
122
+ - ❌ Mutating data without calling the matching `revalidate*` helper.
123
+ - ❌ Adding an `app/error.tsx` handler that calls `reset()` without logging — silently swallowed errors hide bugs.
124
+ - ❌ Running `bun test` and reporting failures. Use `bun run test:run` (vitest).
125
+ - ❌ Editing the per-template `AGENTS.md` to remove notes about TODOs (contact form, newsletter fake submits) — they're real.
126
+
127
+ ## Where things live
128
+
129
+ | Need | Look here |
130
+ |---|---|
131
+ | Which page reads which `brand.X` field | `AGENTS.md` at project root |
132
+ | Architectural rules | `AGENTS.md` at project root + this skill |
133
+ | Running locally | `bun dev` (boots mock + Next together) |
134
+ | Switching mock seed | edit `dev:mock` in `package.json` and `NEXT_PUBLIC_CIMPLIFY_BUSINESS_ID` in `.env.local` |
135
+ | Full SDK reference | `docs/sdk/storefronts.md` in the Cimplify repo |
136
+
137
+ ## What to do when the user asks something out-of-scope
138
+
139
+ If the user asks for something the template doesn't support out of the box:
140
+
141
+ 1. **Check first** — is there an SDK component or hook that does it? `@cimplify/sdk/react` has 50+ components, 30+ hooks. Search `node_modules/@cimplify/sdk/dist/react.d.mts` if needed.
142
+ 2. **Compose from existing parts** before authoring new ones.
143
+ 3. **If genuinely missing** — build the new component, hoist its strings into `brand.ts`, document in `AGENTS.md`.
144
+
145
+ Don't introduce competing patterns (a new caching strategy, a new auth flow, a new theming system). The template's opinions are intentional.
@@ -0,0 +1,25 @@
1
+ ---
2
+ description: Cimplify storefront — architectural rules and rebrand contract for a project scaffolded from `bunx @cimplify/sdk init`. Triggers when files like lib/brand.ts, app/globals.css, components/header.tsx, or .cimplify/project.json are in the workspace.
3
+ globs: ["lib/brand.ts", "app/**", "components/**", ".env.local", "next.config.ts"]
4
+ alwaysApply: true
5
+ ---
6
+
7
+ # Cimplify storefront
8
+
9
+ This project was scaffolded from a Cimplify template. Read `AGENTS.md` at the project root for the file ↔ `brand.X` field map and `.claude/skills/cimplify-storefront/SKILL.md` for the full playbook.
10
+
11
+ ## The contract
12
+
13
+ 1. **`lib/brand.ts`** — every visible string. If something isn't there, add a field to the `Brand` interface; don't hardcode.
14
+ 2. **`app/globals.css` `@theme` block** — palette, radius, font references.
15
+ 3. **Server Components are cached** via `'use cache'` + `cacheTag(tags.X())` + `cacheLife("hours")`. Don't downgrade to client to silence a warning.
16
+ 4. **Client islands** behind `<Suspense>`.
17
+ 5. **`cacheComponents: true`** in `next.config.ts` is non-negotiable.
18
+ 6. Use **`bun run test:run`** (vitest), not `bun test`.
19
+
20
+ ## Don't
21
+
22
+ - Hardcode visible strings in pages/components.
23
+ - Use `unstable_cache` (Next 16 uses `'use cache'`).
24
+ - Bypass `getServerClient()` (loses per-request memoization).
25
+ - Mutate without calling the matching `revalidate*` helper from `@cimplify/sdk/server`.
@@ -6,8 +6,8 @@ If you are an AI agent (Claude, Cursor, Aider, devin, …) working on this store
6
6
 
7
7
  To rebrand this storefront end-to-end as a different merchant:
8
8
 
9
- 1. **Edit `lib/brand.ts`.** Every visible string reads from this file. Replace each field with the merchant's actual content.
10
- 2. **Edit `app/globals.css`** — the `@theme { … }` block holds the design tokens (palette, radius, font references). Tweak to match the merchant's brand.
9
+ 1. **Edit `lib/brand.ts`.** Every visible string reads from this file.
10
+ 2. **Edit `app/globals.css`** — the `@theme { … }` block holds the design tokens (palette, radius, font references).
11
11
  3. **Edit `.env.local`** — set `NEXT_PUBLIC_CIMPLIFY_API_URL`, `NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY`, `NEXT_PUBLIC_CIMPLIFY_BUSINESS_ID`, `NEXT_PUBLIC_SITE_URL`.
12
12
 
13
13
  That is the entire rebrand. Do not modify any `.tsx` file in `app/` or `components/` for content changes — they are design-only and read from `brand`.
@@ -22,30 +22,81 @@ That is the entire rebrand. Do not modify any `.tsx` file in `app/` or `componen
22
22
  - ❌ Don't disable `cacheComponents: true` in `next.config.ts`.
23
23
  - ❌ Don't use `unstable_cache` — Next 16 uses the `'use cache'` directive.
24
24
 
25
- ## File map (what reads from where)
25
+ ## Page surface
26
+
27
+ ```
28
+ app/
29
+ page.tsx Home — hero, collection strips, category grid
30
+ shop/page.tsx Full catalogue (SDK <CataloguePage/>)
31
+ search/page.tsx Search (SDK <SearchPage/>)
32
+ collections/[slug]/page.tsx Collection landing
33
+ categories/[slug]/page.tsx Category landing
34
+
35
+ cart/page.tsx SDK <CartPage/>
36
+ checkout/page.tsx SDK <CheckoutPage/>
37
+ orders/[id]/page.tsx Post-checkout confirmation (also target of /track-order)
38
+
39
+ account/page.tsx <CimplifyAccount /> (iframe — handles sign-in, dashboard)
40
+ account/orders/page.tsx <CimplifyAccount section="orders" />
41
+ account/addresses/page.tsx <CimplifyAccount section="addresses" />
42
+ account/settings/page.tsx <CimplifyAccount section="settings" />
43
+ login/page.tsx redirect → /account (iframe owns sign-in UI)
44
+ signup/page.tsx redirect → /account (iframe owns sign-up UI)
45
+
46
+ contact/page.tsx Contact form (Server Action wiring TODO; currently fakes submit)
47
+ track-order/page.tsx Guest order lookup → /orders/[id]
48
+
49
+ about/page.tsx Brand story
50
+ faq/page.tsx FAQ
51
+ shipping/page.tsx Standalone shipping policy
52
+ returns/page.tsx Standalone returns policy
53
+ accessibility/page.tsx Accessibility statement (WCAG 2.1 AA)
54
+ terms/page.tsx Terms of Service
55
+ privacy/page.tsx Privacy Policy
56
+
57
+ sitemap-page/page.tsx Human-readable HTML sitemap
58
+ sitemap.ts XML sitemap (search engines)
59
+ robots.ts robots.txt
60
+ llms.txt/route.ts LLM-friendly Markdown index
61
+ opensearch.xml/route.ts Browser address-bar search description
62
+ error.tsx, not-found.tsx Global boundaries
63
+ ```
64
+
65
+ ## File ↔ brand-field map
26
66
 
27
67
  | File | Reads from `brand` |
28
68
  |---|---|
29
- | `app/layout.tsx` | metadata, OpenGraph, Organization JSON-LD |
69
+ | `app/layout.tsx` | identity, contact, socials, schemaType (Organization JSON-LD), `metadataBase` |
30
70
  | `app/page.tsx` | `brand.hero` (Hero badge / title / subtitle) |
31
71
  | `app/about/page.tsx` | `brand.about` |
32
72
  | `app/faq/page.tsx` | `brand.faq` |
33
73
  | `app/terms/page.tsx` | `brand.terms` |
34
74
  | `app/privacy/page.tsx` | `brand.privacy` |
75
+ | `app/shipping/page.tsx` | `brand.shipping` |
76
+ | `app/returns/page.tsx` | `brand.returns` |
77
+ | `app/accessibility/page.tsx` | `brand.accessibility` |
78
+ | `app/contact/page.tsx` | `brand.contactPage`, `brand.contact` |
79
+ | `app/track-order/page.tsx` | `brand.trackOrder` |
80
+ | `app/account/*/page.tsx` | `brand.account` (eyebrows + titles only — Cimplify Link iframe owns the UI) |
81
+ | `app/login/page.tsx`, `app/signup/page.tsx` | `brand.account` (metadata only — both redirect to `/account`) |
35
82
  | `app/llms.txt/route.ts` | `brand.llms`, contact, currency |
36
- | `app/sitemap.ts`, `robots.ts` | (no brand strings — derives from product data) |
83
+ | `app/opensearch.xml/route.ts` | `brand.shortName`, `brand.name` |
84
+ | `app/sitemap.ts`, `robots.ts` | derives URLs from product/category data |
37
85
  | `app/not-found.tsx` | `brand.name` (page title) |
38
86
  | `components/header.tsx` | `brand.shortName`, `brand.microTag`, `brand.header.nav` |
39
- | `components/footer.tsx` | `brand.footer`, contact, socials |
87
+ | `components/footer.tsx` | `brand.footer`, `brand.contact`, `brand.socials` |
40
88
 
41
89
  ## Bakery-specific notes
42
90
 
43
- - Product detail uses a **URL-driven modal** (`?product=<slug>`), not a static `/products/[slug]` route. This fits impulse-purchase food UX. Don't refactor without a reason.
44
- - Schema.org type is `Bakery`. `lib/brand.ts` sets this in `schemaType` — change if rebranding to a different industry.
91
+ - Product detail uses a **URL-driven modal** (`?product=<slug>`), not a static `/products/[slug]` route. Fits impulse-purchase food UX.
92
+ - Schema.org `@type` is `Bakery` — set in `brand.schemaType`.
93
+ - Mock seed: `--seed default` (Akua's Bakery). To preview a different industry, edit `dev:mock` in `package.json` and update `NEXT_PUBLIC_CIMPLIFY_BUSINESS_ID`.
45
94
 
46
- ## Mock seed
95
+ ## Known TODOs (not blocking, but worth knowing)
47
96
 
48
- Wired to `--seed default` (Akua's Bakery) via `package.json` `dev:mock`. To preview another seed, change the flag or run `bunx @cimplify/sdk --seed restaurant` directly and update `NEXT_PUBLIC_CIMPLIFY_BUSINESS_ID` in `.env.local`.
97
+ - `app/contact/contact-form.tsx` fakes a successful submit. In production, wire a Server Action that calls `client.support.sendMessage(...)` from `@cimplify/sdk/server`.
98
+ - `components/newsletter.tsx` (homepage strip) similarly fakes submit. Wire to a real list provider.
99
+ - Hero / lookbook imagery is Unsplash placeholder — replace with merchant assets.
49
100
 
50
101
  ## Quick start
51
102
 
@@ -0,0 +1,22 @@
1
+ # CLAUDE.md
2
+
3
+ This project was scaffolded from a Cimplify storefront template (`bunx @cimplify/sdk init`).
4
+
5
+ ## Read these first
6
+
7
+ - **`AGENTS.md`** at the project root — the file ↔ `brand.X` field map for *this template's* industry, plus the architectural rules.
8
+ - **`.claude/skills/cimplify-storefront/SKILL.md`** — the playbook for common tasks (rebrand, add a section, wire a Server Action, deploy, eject a component). Invoke it whenever you're asked to change content, palette, copy, or routing.
9
+
10
+ ## The two-line summary
11
+
12
+ 1. **Edit `lib/brand.ts`** for any visible string.
13
+ 2. **Edit `app/globals.css` `@theme` block** for any palette / radius / font change.
14
+
15
+ That covers ~95% of what merchants ask for. For anything else, follow the `cimplify-storefront` skill.
16
+
17
+ ## Don't do
18
+
19
+ - Hardcode strings in pages or components.
20
+ - Disable `cacheComponents: true` in `next.config.ts`.
21
+ - Use `unstable_cache` — Next 16's canonical primitive is `'use cache'`.
22
+ - Run `bun test` (Bun's `vi` shim is incomplete) — use `bun run test:run`.
@@ -0,0 +1,145 @@
1
+ ---
2
+ name: cimplify-storefront
3
+ description: Build, customize, rebrand, or deploy a Cimplify-scaffolded storefront. Triggers when the user asks to create a storefront, rebrand a Cimplify template, change the palette, add a page, deploy to Cimplify, or works in a project containing `lib/brand.ts` and `next.config.ts` with `cacheComponents`.
4
+ ---
5
+
6
+ # Cimplify Storefront skill
7
+
8
+ You're working on a project scaffolded from `bunx @cimplify/sdk init`. The architecture is opinionated and the rebrand surface is intentionally small. Read `AGENTS.md` at the project root for the file ↔ brand-field map for *this template's* industry; this skill gives you the playbook that's the same across all six.
9
+
10
+ ## The contract — never break
11
+
12
+ 1. **`lib/brand.ts` is the only place for content edits.** Every visible string reads from this file. If a string isn't in `brand`, *add a field* to the `Brand` interface — don't hardcode it in a page or component.
13
+ 2. **`app/globals.css` `@theme { … }`** holds palette + radius + font references. To re-skin the entire site, edit only this block.
14
+ 3. **Server Components are cached** via `'use cache'` + `cacheTag(tags.X())` + `cacheLife("hours")`. Don't downgrade them to `"use client"` to avoid an issue — fix the issue.
15
+ 4. **Client islands** (anything reading `useSearchParams`, `usePathname`, `useRouter`, `useState`) live behind `<Suspense>`.
16
+ 5. **`cacheComponents: true`** in `next.config.ts` is non-negotiable. Don't turn it off.
17
+ 6. **`bun run test:run` (vitest)** is the canonical test runner. `bun test` will show false failures because Bun's `vi` shim is incomplete.
18
+ 7. **Cart, checkout, orders stay client.** They're session-bound. Don't try to SSR them.
19
+
20
+ ## The brand-field schema (in `lib/brand.ts`)
21
+
22
+ ```
23
+ identity: name, shortName, microTag, description, schemaType, currency, locale
24
+ contact: address, streetAddress, city, countryCode, phone, phoneTel, email, privacyEmail, hours
25
+ socials: [{ label, href, icon }] // icon ∈ instagram|x|tiktok|facebook|youtube|linkedin|whatsapp
26
+ header: { nav: [{ label, href }] }
27
+ hero: { badge, title, subtitle, primaryCtaLabel, secondaryCtaLabel?, secondaryCtaHref? }
28
+ optional: trustItems[]?, brandStrip?, promo?, tradeIn? // render conditionally
29
+ newsletter: { eyebrow, title, body, placeholder, submitLabel, successLabel }
30
+ about: { eyebrow, title, paragraphs[], sections[{ heading, body }] }
31
+ faq: { eyebrow, title, sections[{ title, items[{ q, a }] }], contactPrompt, contactEmail }
32
+ terms,
33
+ privacy,
34
+ shipping,
35
+ returns,
36
+ accessibility: { eyebrow, title, lastUpdated, sections[{ heading, body | { intro, bullets[] } }] }
37
+ account: eyebrows + titles for /account, /login, /signup
38
+ contactPage: { eyebrow, title, body, reasons[], directLines[{ label, value, href }] }
39
+ trackOrder: { eyebrow, title, body }
40
+ footer: { blurb, sitemap[{ title, links[] }], poweredBy? }
41
+ llms: { summary } // opens /llms.txt
42
+ mock: { seed, businessId }
43
+ ```
44
+
45
+ ## Playbook — common tasks
46
+
47
+ ### Rebrand a storefront for a new merchant
48
+
49
+ 1. Edit `lib/brand.ts`. Replace every field with the merchant's content. Use the brief / context the user gave you.
50
+ 2. Edit `app/globals.css` `@theme { … }`. Change `--color-primary`, `--color-background`, `--color-foreground`, optionally `--radius`. Use OKLCH; if the brand only gave hex, convert.
51
+ 3. (Optional) Swap fonts in `app/layout.tsx` — `next/font/google` import + the variable wired into the `<html>` className.
52
+ 4. Set `.env.local`: `NEXT_PUBLIC_CIMPLIFY_API_URL`, `NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY`, `NEXT_PUBLIC_CIMPLIFY_BUSINESS_ID`, `NEXT_PUBLIC_SITE_URL`.
53
+
54
+ Don't touch any other file. If the rebrand needs content not in the schema, add the field to `Brand` first, populate it, then read it from the page.
55
+
56
+ ### Add a new section / component
57
+
58
+ 1. Build it as a Server Component in `components/` (or a client island in `*-client.tsx` if interactive).
59
+ 2. Read merchant copy from `brand`. Add new fields to the `Brand` interface if needed.
60
+ 3. Wrap interactive bits in `<Suspense fallback={…}>` so the cached chrome streams.
61
+ 4. Compose into the page.
62
+
63
+ ### Wire a Server Action that mutates data
64
+
65
+ ```ts
66
+ "use server";
67
+ import { getServerClient, revalidateProducts } from "@cimplify/sdk/server";
68
+
69
+ export async function createProduct(input: ProductInput) {
70
+ await getServerClient().catalogue.createProduct(input);
71
+ revalidateProducts();
72
+ }
73
+ ```
74
+
75
+ After every mutation, call the matching `revalidate*` helper from `@cimplify/sdk/server`: `revalidateProducts`, `revalidateProduct(id)`, `revalidateCategories`, `revalidateCategory(id)`, `revalidateCollections`, `revalidateCollection(id)`, `revalidateBusiness`.
76
+
77
+ ### Add a Server Component data fetch
78
+
79
+ ```ts
80
+ import { cacheTag, cacheLife } from "next/cache";
81
+ import { getServerClient, tags } from "@cimplify/sdk/server";
82
+
83
+ async function getX() {
84
+ "use cache";
85
+ cacheTag(tags.products());
86
+ cacheLife("hours");
87
+ const r = await getServerClient().catalogue.getProducts({ limit: 24 });
88
+ if (!r.ok) throw new Error(r.error.message);
89
+ return r.value.items;
90
+ }
91
+ ```
92
+
93
+ ### Eject an SDK component for deeper customization
94
+
95
+ Try `classNames`, `renderImage`, `renderLink`, slot props first. If those run out:
96
+
97
+ ```bash
98
+ bunx @cimplify/sdk eject --list
99
+ bunx @cimplify/sdk eject product-card --dir src/components/cimplify
100
+ ```
101
+
102
+ Once ejected, the file is yours. Hooks/types still come from `@cimplify/sdk`.
103
+
104
+ ### Deploy
105
+
106
+ ```bash
107
+ bunx @cimplify/sdk login
108
+ bunx @cimplify/sdk projects create my-store
109
+ bunx @cimplify/sdk link <project-id>
110
+ bunx @cimplify/sdk env push
111
+ bunx @cimplify/sdk deploy --prod
112
+ bunx @cimplify/sdk logs --follow
113
+ bunx @cimplify/sdk domains add my-store.com
114
+ ```
115
+
116
+ ## Pitfalls — explicit ❌ list
117
+
118
+ - ❌ Hardcoding any visible string in a page or component. Always `brand.X`.
119
+ - ❌ Disabling `cacheComponents: true` to silence a warning. Fix the warning by wrapping the dynamic call in `<Suspense>`.
120
+ - ❌ Using `unstable_cache` — Next 16's canonical primitive is `'use cache'` + `cacheTag` + `cacheLife`.
121
+ - ❌ Bypassing `getServerClient()` and calling `createCimplifyClient` directly in a Server Component — loses per-request memoization.
122
+ - ❌ Mutating data without calling the matching `revalidate*` helper.
123
+ - ❌ Adding an `app/error.tsx` handler that calls `reset()` without logging — silently swallowed errors hide bugs.
124
+ - ❌ Running `bun test` and reporting failures. Use `bun run test:run` (vitest).
125
+ - ❌ Editing the per-template `AGENTS.md` to remove notes about TODOs (contact form, newsletter fake submits) — they're real.
126
+
127
+ ## Where things live
128
+
129
+ | Need | Look here |
130
+ |---|---|
131
+ | Which page reads which `brand.X` field | `AGENTS.md` at project root |
132
+ | Architectural rules | `AGENTS.md` at project root + this skill |
133
+ | Running locally | `bun dev` (boots mock + Next together) |
134
+ | Switching mock seed | edit `dev:mock` in `package.json` and `NEXT_PUBLIC_CIMPLIFY_BUSINESS_ID` in `.env.local` |
135
+ | Full SDK reference | `docs/sdk/storefronts.md` in the Cimplify repo |
136
+
137
+ ## What to do when the user asks something out-of-scope
138
+
139
+ If the user asks for something the template doesn't support out of the box:
140
+
141
+ 1. **Check first** — is there an SDK component or hook that does it? `@cimplify/sdk/react` has 50+ components, 30+ hooks. Search `node_modules/@cimplify/sdk/dist/react.d.mts` if needed.
142
+ 2. **Compose from existing parts** before authoring new ones.
143
+ 3. **If genuinely missing** — build the new component, hoist its strings into `brand.ts`, document in `AGENTS.md`.
144
+
145
+ Don't introduce competing patterns (a new caching strategy, a new auth flow, a new theming system). The template's opinions are intentional.
@@ -0,0 +1,25 @@
1
+ ---
2
+ description: Cimplify storefront — architectural rules and rebrand contract for a project scaffolded from `bunx @cimplify/sdk init`. Triggers when files like lib/brand.ts, app/globals.css, components/header.tsx, or .cimplify/project.json are in the workspace.
3
+ globs: ["lib/brand.ts", "app/**", "components/**", ".env.local", "next.config.ts"]
4
+ alwaysApply: true
5
+ ---
6
+
7
+ # Cimplify storefront
8
+
9
+ This project was scaffolded from a Cimplify template. Read `AGENTS.md` at the project root for the file ↔ `brand.X` field map and `.claude/skills/cimplify-storefront/SKILL.md` for the full playbook.
10
+
11
+ ## The contract
12
+
13
+ 1. **`lib/brand.ts`** — every visible string. If something isn't there, add a field to the `Brand` interface; don't hardcode.
14
+ 2. **`app/globals.css` `@theme` block** — palette, radius, font references.
15
+ 3. **Server Components are cached** via `'use cache'` + `cacheTag(tags.X())` + `cacheLife("hours")`. Don't downgrade to client to silence a warning.
16
+ 4. **Client islands** behind `<Suspense>`.
17
+ 5. **`cacheComponents: true`** in `next.config.ts` is non-negotiable.
18
+ 6. Use **`bun run test:run`** (vitest), not `bun test`.
19
+
20
+ ## Don't
21
+
22
+ - Hardcode visible strings in pages/components.
23
+ - Use `unstable_cache` (Next 16 uses `'use cache'`).
24
+ - Bypass `getServerClient()` (loses per-request memoization).
25
+ - Mutate without calling the matching `revalidate*` helper from `@cimplify/sdk/server`.
@@ -4,43 +4,97 @@ If you are an AI agent (Claude, Cursor, Aider, devin, …) working on this store
4
4
 
5
5
  ## TL;DR for rebranding
6
6
 
7
- 1. **Edit `lib/brand.ts`.** Every visible string reads from this file.
8
- 2. **Edit `app/globals.css`** — the `@theme { … }` block holds the design tokens (palette, radius, font references). High-contrast neutrals + electric primary by default.
7
+ 1. **Edit `lib/brand.ts`** — every visible string lives here.
8
+ 2. **Edit `app/globals.css`** — `@theme { … }` for palette + radius + font references.
9
9
  3. **Edit `.env.local`** — `NEXT_PUBLIC_CIMPLIFY_API_URL`, `NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY`, `NEXT_PUBLIC_CIMPLIFY_BUSINESS_ID`, `NEXT_PUBLIC_SITE_URL`.
10
10
 
11
11
  ## Aesthetic
12
12
 
13
- This template is built for streetwear / capsule fashion / lookbook-led brands (Nike, Aritzia, Highsnobiety, drop culture). Key design moves:
13
+ Streetwear / lookbook-led brands (Nike, Aritzia, Highsnobiety, drop culture):
14
14
 
15
- - **Anton display typography** for hero + section titles (uppercase, condensed, heavy).
16
- - **Inter** for body and UI.
17
- - **High-contrast palette**: near-black foreground on near-white background, with one electric primary (default: `oklch(0.7 0.24 30)` — coral-orange).
18
- - **Sharp corners**: `--radius: 0.125rem` — minimal rounding, near-square inputs and buttons.
19
- - **Editorial full-bleed hero** with image gradient overlay (see `components/feature-hero.tsx`).
20
- - **Block-letter header** — no logo mark, just the shortName in display type with a microTag.
15
+ - **Anton display + Inter** — uppercase condensed display, clean body sans.
16
+ - **High-contrast palette** — near-black foreground on near-white background, electric primary (default coral, `oklch(0.7 0.24 30)`).
17
+ - **Sharp corners**: `0.125rem` — minimal rounding.
18
+ - **Editorial full-bleed hero** with image gradient overlay.
19
+ - **Block-letter header** — no logo mark, just the shortName in display type.
20
+ - Schema.org `@type` is `Store`.
21
21
 
22
- ## Industry-specific copy patterns
22
+ ## Page surface
23
23
 
24
- The bundled brand presets:
25
- - `brand.hero.badge` is a "drop counter" (e.g. `"Drop 04 · Live now"`).
26
- - `brand.tradeIn` is repurposed as a "Studio collective" / membership programme.
27
- - `brand.brandStrip.headline` is `"Stocked at"` with editorial publication wordmarks (Vogue, Highsnobiety, etc.).
28
- - `brand.faq` covers sizing, drops/restocks, returns, customs.
29
-
30
- Replace these freely. The components render conditionally — set any optional block to `undefined` to hide it.
31
-
32
- ## Rules
24
+ ```
25
+ app/
26
+ page.tsx Multi-section home — full-bleed editorial hero,
27
+ trust bar, category tiles, promo banner,
28
+ "Just dropped" grid, brand strip, collections,
29
+ studio-collective CTA, best sellers, newsletter
30
+ shop/page.tsx SDK <CataloguePage/> with custom hero
31
+ search/page.tsx Search
32
+ collections/[slug]/page.tsx Collection landing (drops)
33
+ categories/[slug]/page.tsx Category landing
34
+ products/[slug]/page.tsx Full product detail page (Product JSON-LD)
35
+
36
+ size-guide/page.tsx ⭐ Fashion-specific: chest/length/shoulder + waist/hip/inseam
37
+ tables, "how to measure" callout
38
+ lookbook/page.tsx ⭐ Fashion-specific: editorial multi-drop lookbook —
39
+ hero + 3-up tile galleries per drop, "Shop Drop X" CTAs
40
+
41
+ cart/page.tsx, checkout/page.tsx, orders/[id]/page.tsx
42
+
43
+ account/page.tsx <CimplifyAccount /> (iframe)
44
+ account/orders/page.tsx <CimplifyAccount section="orders" />
45
+ account/addresses/page.tsx <CimplifyAccount section="addresses" />
46
+ account/settings/page.tsx <CimplifyAccount section="settings" />
47
+ login/page.tsx, signup/page.tsx redirects → /account
48
+
49
+ contact/page.tsx, track-order/page.tsx
50
+
51
+ about/page.tsx, faq/page.tsx
52
+ shipping/page.tsx (DHL Express worldwide), returns/page.tsx (30 days),
53
+ accessibility/page.tsx, terms/page.tsx, privacy/page.tsx
54
+
55
+ sitemap-page/page.tsx, sitemap.ts, robots.ts, llms.txt/route.ts, opensearch.xml/route.ts
56
+ error.tsx, not-found.tsx
57
+ ```
33
58
 
34
- - ✅ All content edits → `lib/brand.ts`
35
- - ✅ All design-token edits → `app/globals.css` `@theme` block
36
- - ✅ Server Components stay cached via `'use cache'` + `cacheTag(tags.X())` + `cacheLife("hours")`
37
- - ✅ Client islands behind `<Suspense>`
38
- - ❌ Don't hardcode strings.
39
- - ❌ Don't disable `cacheComponents: true`.
59
+ ## File ↔ brand-field map
60
+
61
+ | File | Reads from `brand` |
62
+ |---|---|
63
+ | `app/layout.tsx` | identity, contact, socials, Store JSON-LD |
64
+ | `app/page.tsx` | `brand.hero`, `brand.trustItems`, `brand.brandStrip`, `brand.promo`, `brand.tradeIn` (= studio-collective copy), `brand.newsletter` |
65
+ | `app/about/page.tsx` | `brand.about` |
66
+ | `app/faq/page.tsx` | `brand.faq` (sizing, drops, returns, customs) |
67
+ | `app/shipping/page.tsx` | `brand.shipping` (worldwide DHL, customs) |
68
+ | `app/returns/page.tsx` | `brand.returns` (30 days, free US/UK/EU) |
69
+ | `app/accessibility/page.tsx` | `brand.accessibility` |
70
+ | `app/terms/page.tsx`, `app/privacy/page.tsx` | `brand.terms`, `brand.privacy` |
71
+ | `app/contact/page.tsx` | `brand.contactPage`, `brand.contact` |
72
+ | `app/track-order/page.tsx` | `brand.trackOrder` |
73
+ | `app/account/*/page.tsx` | `brand.account` (iframe owns UI) |
74
+ | `app/products/[slug]/page.tsx` | `brand.name`, `brand.currency` (Product JSON-LD) |
75
+ | `app/size-guide/page.tsx` | currently has its size charts inlined — hoist to `brand.sizeGuide` if you want agents to edit them |
76
+ | `app/lookbook/page.tsx` | currently has the lookbook entries inlined (image URLs + drop names) — hoist to `brand.lookbook` for agent editing |
77
+ | `app/llms.txt/route.ts` | `brand.llms`, contact, currency |
78
+ | `components/header.tsx`, `footer.tsx` | `brand.header`, `brand.footer`, `brand.contact`, `brand.socials` |
79
+ | `components/promo-banner.tsx`, `trade-in-cta.tsx`, `brand-marquee.tsx`, `trust-bar.tsx`, `newsletter.tsx` | corresponding optional sections in `brand` |
80
+
81
+ ## Fashion-specific notes
82
+
83
+ - **Hero is full-bleed editorial.** Replace `HERO_FALLBACK_IMAGE` in `app/page.tsx` with the merchant's drop campaign shot for maximum impact.
84
+ - **Drop badges and "limited run" copy** drive urgency. Keep `brand.hero.badge` and `brand.promo.badge` short and time-bounded.
85
+ - **`brand.tradeIn`** is repurposed as the "Studio collective" / membership programme — three-step access flow.
86
+ - **Product detail uses the page-driven model** (`/products/[slug]`) — fashion is a consideration purchase (sizing, fit, fabric details), not impulse.
87
+ - **`brandStrip.headline` is `"Stocked at"`** with editorial publication wordmarks (Vogue, Highsnobiety, etc.) — typography-led, no logo licensing required.
88
+
89
+ ## Known TODOs
90
+
91
+ - `app/size-guide/page.tsx` has its size charts inlined as constants. Move them to `brand.sizeGuide` (typed) so agents can edit per-merchant size charts in one file.
92
+ - `app/lookbook/page.tsx` has its drop entries inlined. Move to `brand.lookbook` for agent editing — each drop becomes `{ drop, title, date, byline, hero, tiles[] }`.
93
+ - Contact form + newsletter fake submits.
40
94
 
41
95
  ## Mock seed
42
96
 
43
- Wired to `--seed retail` (Currents Electronics catalogue). Replace with apparel data in production. To preview a different seed, edit `dev:mock` in `package.json`.
97
+ Wired to `--seed retail` (Currents Electronics catalogue — the closest stand-in until an apparel seed ships). Replace with apparel data in production.
44
98
 
45
99
  ## Quick start
46
100
 
@@ -0,0 +1,22 @@
1
+ # CLAUDE.md
2
+
3
+ This project was scaffolded from a Cimplify storefront template (`bunx @cimplify/sdk init`).
4
+
5
+ ## Read these first
6
+
7
+ - **`AGENTS.md`** at the project root — the file ↔ `brand.X` field map for *this template's* industry, plus the architectural rules.
8
+ - **`.claude/skills/cimplify-storefront/SKILL.md`** — the playbook for common tasks (rebrand, add a section, wire a Server Action, deploy, eject a component). Invoke it whenever you're asked to change content, palette, copy, or routing.
9
+
10
+ ## The two-line summary
11
+
12
+ 1. **Edit `lib/brand.ts`** for any visible string.
13
+ 2. **Edit `app/globals.css` `@theme` block** for any palette / radius / font change.
14
+
15
+ That covers ~95% of what merchants ask for. For anything else, follow the `cimplify-storefront` skill.
16
+
17
+ ## Don't do
18
+
19
+ - Hardcode strings in pages or components.
20
+ - Disable `cacheComponents: true` in `next.config.ts`.
21
+ - Use `unstable_cache` — Next 16's canonical primitive is `'use cache'`.
22
+ - Run `bun test` (Bun's `vi` shim is incomplete) — use `bun run test:run`.