@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.
- package/package.json +1 -1
- package/templates/storefront-bakery/.claude/skills/cimplify-storefront/SKILL.md +145 -0
- package/templates/storefront-bakery/.cursor/rules/cimplify-storefront.mdc +25 -0
- package/templates/storefront-bakery/AGENTS.md +61 -10
- package/templates/storefront-bakery/CLAUDE.md +22 -0
- package/templates/storefront-fashion/.claude/skills/cimplify-storefront/SKILL.md +145 -0
- package/templates/storefront-fashion/.cursor/rules/cimplify-storefront.mdc +25 -0
- package/templates/storefront-fashion/AGENTS.md +80 -26
- package/templates/storefront-fashion/CLAUDE.md +22 -0
- package/templates/storefront-grocery/.claude/skills/cimplify-storefront/SKILL.md +145 -0
- package/templates/storefront-grocery/.cursor/rules/cimplify-storefront.mdc +25 -0
- package/templates/storefront-grocery/AGENTS.md +56 -11
- package/templates/storefront-grocery/CLAUDE.md +22 -0
- package/templates/storefront-restaurant/.claude/skills/cimplify-storefront/SKILL.md +145 -0
- package/templates/storefront-restaurant/.cursor/rules/cimplify-storefront.mdc +25 -0
- package/templates/storefront-restaurant/AGENTS.md +64 -13
- package/templates/storefront-restaurant/CLAUDE.md +22 -0
- package/templates/storefront-retail/.claude/skills/cimplify-storefront/SKILL.md +145 -0
- package/templates/storefront-retail/.cursor/rules/cimplify-storefront.mdc +25 -0
- package/templates/storefront-retail/AGENTS.md +65 -24
- package/templates/storefront-retail/CLAUDE.md +22 -0
- package/templates/storefront-services/.claude/skills/cimplify-storefront/SKILL.md +145 -0
- package/templates/storefront-services/.cursor/rules/cimplify-storefront.mdc +25 -0
- package/templates/storefront-services/AGENTS.md +64 -16
- package/templates/storefront-services/CLAUDE.md +22 -0
|
@@ -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`.
|
|
@@ -10,24 +10,69 @@ If you are an AI agent (Claude, Cursor, Aider, devin, …) working on this store
|
|
|
10
10
|
|
|
11
11
|
## Aesthetic
|
|
12
12
|
|
|
13
|
-
Approachable grocer — Trader Joe's / Whole Foods / abundant-feel:
|
|
14
|
-
|
|
15
13
|
- **Inter sans only** (no serif) — friendly, readable for dense product grids.
|
|
16
|
-
- **Fresh green + cream
|
|
14
|
+
- **Fresh green + cream** — vibrant green primary, warm cream background.
|
|
17
15
|
- **Generous radius**: `0.875rem` — softer than retail.
|
|
18
16
|
- **Bold, slightly heavy** headings.
|
|
17
|
+
- Schema.org `@type` is `GroceryStore`.
|
|
18
|
+
|
|
19
|
+
## Page surface
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
app/
|
|
23
|
+
page.tsx Home — hero ("Free delivery over GH₵150"),
|
|
24
|
+
collection strips, category grid, newsletter
|
|
25
|
+
shop/page.tsx Aisle (SDK <CataloguePage/>)
|
|
26
|
+
search/page.tsx Search
|
|
27
|
+
collections/[slug]/page.tsx Collection landing (e.g. weekly box, deals)
|
|
28
|
+
categories/[slug]/page.tsx Category landing
|
|
29
|
+
|
|
30
|
+
cart/page.tsx, checkout/page.tsx, orders/[id]/page.tsx
|
|
31
|
+
|
|
32
|
+
account/page.tsx <CimplifyAccount /> (iframe)
|
|
33
|
+
account/orders/page.tsx <CimplifyAccount section="orders" />
|
|
34
|
+
account/addresses/page.tsx <CimplifyAccount section="addresses" />
|
|
35
|
+
account/settings/page.tsx <CimplifyAccount section="settings" />
|
|
36
|
+
login/page.tsx, signup/page.tsx redirects → /account
|
|
37
|
+
|
|
38
|
+
contact/page.tsx, track-order/page.tsx
|
|
39
|
+
|
|
40
|
+
about/page.tsx, faq/page.tsx
|
|
41
|
+
shipping/page.tsx (delivery + slots), returns/page.tsx (quality guarantee),
|
|
42
|
+
accessibility/page.tsx, terms/page.tsx, privacy/page.tsx
|
|
43
|
+
|
|
44
|
+
sitemap-page/page.tsx, sitemap.ts, robots.ts, llms.txt/route.ts, opensearch.xml/route.ts
|
|
45
|
+
error.tsx, not-found.tsx
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## File ↔ brand-field map
|
|
49
|
+
|
|
50
|
+
| File | Reads from `brand` |
|
|
51
|
+
|---|---|
|
|
52
|
+
| `app/layout.tsx` | identity, contact, socials, GroceryStore JSON-LD |
|
|
53
|
+
| `app/page.tsx` | `brand.hero` (free-delivery badge) |
|
|
54
|
+
| `app/about/page.tsx` | `brand.about` |
|
|
55
|
+
| `app/faq/page.tsx` | `brand.faq` (delivery slots, sourcing, subscription boxes) |
|
|
56
|
+
| `app/shipping/page.tsx` | `brand.shipping` (delivery slots + free-over threshold) |
|
|
57
|
+
| `app/returns/page.tsx` | `brand.returns` (quality guarantee) |
|
|
58
|
+
| `app/accessibility/page.tsx` | `brand.accessibility` |
|
|
59
|
+
| `app/terms/page.tsx`, `app/privacy/page.tsx` | `brand.terms`, `brand.privacy` |
|
|
60
|
+
| `app/contact/page.tsx` | `brand.contactPage`, `brand.contact` |
|
|
61
|
+
| `app/track-order/page.tsx` | `brand.trackOrder` |
|
|
62
|
+
| `app/account/*/page.tsx` | `brand.account` (iframe owns UI) |
|
|
63
|
+
| `app/llms.txt/route.ts` | `brand.llms`, contact, currency |
|
|
64
|
+
| `components/header.tsx`, `footer.tsx` | `brand.header`, `brand.footer`, `brand.contact`, `brand.socials` |
|
|
19
65
|
|
|
20
|
-
##
|
|
66
|
+
## Grocery-specific notes
|
|
21
67
|
|
|
22
|
-
- `
|
|
23
|
-
- `
|
|
24
|
-
- `
|
|
25
|
-
- `brand.faq` covers delivery slots, sourcing/quality, subscription boxes.
|
|
26
|
-
- Schema.org type is `GroceryStore`.
|
|
68
|
+
- **Subscription boxes** are modelled as products with `billing_plans` (renders the SubscriptionCard variant). The basket-box landing lives at `/categories/baskets`.
|
|
69
|
+
- **Weight-based pricing**: SDK supports `quantity_pricing` tiers per product, but most grocery products are sold by unit/kg. Real weight-at-pack pricing happens on the backend pricing rule.
|
|
70
|
+
- Mock seed: `--seed grocery` (FreshMart).
|
|
27
71
|
|
|
28
|
-
##
|
|
72
|
+
## Known TODOs
|
|
29
73
|
|
|
30
|
-
|
|
74
|
+
- Contact + newsletter fake submits.
|
|
75
|
+
- Hero / category / product imagery is Unsplash placeholder — replace with merchant photography.
|
|
31
76
|
|
|
32
77
|
## Quick start
|
|
33
78
|
|
|
@@ -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`.
|
|
@@ -10,24 +10,75 @@ If you are an AI agent (Claude, Cursor, Aider, devin, …) working on this store
|
|
|
10
10
|
|
|
11
11
|
## Aesthetic
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
- **Lora serif + Inter** — warm, food-friendly headings + clean body.
|
|
14
|
+
- **Forest green + cream** — deep sage primary, warm cream background.
|
|
15
|
+
- **Mid radius**: `0.625rem`.
|
|
16
|
+
- Schema.org `@type` is `Restaurant`.
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
- **Inter** for body and UI.
|
|
17
|
-
- **Forest green + cream**: deep sage primary, warm cream background, subtle warm accents.
|
|
18
|
-
- **Mid-radius**: `0.625rem` — softer than retail, tighter than spa.
|
|
18
|
+
## Page surface
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
```
|
|
21
|
+
app/
|
|
22
|
+
page.tsx Home — hero with daily-special badge,
|
|
23
|
+
collection strips, category grid
|
|
24
|
+
shop/page.tsx Full menu (SDK <CataloguePage/>)
|
|
25
|
+
search/page.tsx Search
|
|
26
|
+
collections/[slug]/page.tsx Collection landing (e.g. brunch, mains)
|
|
27
|
+
categories/[slug]/page.tsx Category landing
|
|
28
|
+
|
|
29
|
+
reservations/page.tsx ⭐ Restaurant-specific: reservation widget
|
|
30
|
+
(date + lunch/dinner slot + party size)
|
|
31
|
+
backed by service-type "seating" products
|
|
32
|
+
|
|
33
|
+
cart/page.tsx, checkout/page.tsx, orders/[id]/page.tsx
|
|
34
|
+
|
|
35
|
+
account/page.tsx <CimplifyAccount /> (iframe)
|
|
36
|
+
account/orders/page.tsx <CimplifyAccount section="orders" />
|
|
37
|
+
account/addresses/page.tsx <CimplifyAccount section="addresses" />
|
|
38
|
+
account/settings/page.tsx <CimplifyAccount section="settings" />
|
|
39
|
+
login/page.tsx, signup/page.tsx redirects → /account
|
|
40
|
+
|
|
41
|
+
contact/page.tsx, track-order/page.tsx
|
|
42
|
+
|
|
43
|
+
about/page.tsx, faq/page.tsx
|
|
44
|
+
shipping/page.tsx (delivery), returns/page.tsx (refunds), accessibility/page.tsx
|
|
45
|
+
terms/page.tsx, privacy/page.tsx
|
|
46
|
+
|
|
47
|
+
sitemap-page/page.tsx, sitemap.ts, robots.ts, llms.txt/route.ts, opensearch.xml/route.ts
|
|
48
|
+
error.tsx, not-found.tsx
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## File ↔ brand-field map
|
|
52
|
+
|
|
53
|
+
| File | Reads from `brand` |
|
|
54
|
+
|---|---|
|
|
55
|
+
| `app/layout.tsx` | identity, contact, socials, Restaurant JSON-LD |
|
|
56
|
+
| `app/page.tsx` | `brand.hero` (daily-special badge) |
|
|
57
|
+
| `app/about/page.tsx` | `brand.about` |
|
|
58
|
+
| `app/faq/page.tsx` | `brand.faq` (reservations, dietary, delivery) |
|
|
59
|
+
| `app/shipping/page.tsx` | `brand.shipping` (delivery + pickup) |
|
|
60
|
+
| `app/returns/page.tsx` | `brand.returns` (refund + cancellation) |
|
|
61
|
+
| `app/accessibility/page.tsx` | `brand.accessibility` |
|
|
62
|
+
| `app/terms/page.tsx`, `app/privacy/page.tsx` | `brand.terms`, `brand.privacy` |
|
|
63
|
+
| `app/contact/page.tsx` | `brand.contactPage`, `brand.contact` |
|
|
64
|
+
| `app/track-order/page.tsx` | `brand.trackOrder` |
|
|
65
|
+
| `app/account/*/page.tsx` | `brand.account` (iframe owns the UI) |
|
|
66
|
+
| `app/reservations/*` | derives seating from service-type products in the catalogue |
|
|
67
|
+
| `app/llms.txt/route.ts` | `brand.llms`, contact, currency |
|
|
68
|
+
| `components/header.tsx`, `footer.tsx` | `brand.header`, `brand.footer`, `brand.contact`, `brand.socials` |
|
|
69
|
+
|
|
70
|
+
## Restaurant-specific notes
|
|
21
71
|
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
- Schema.org type is `Restaurant`.
|
|
72
|
+
- **Reservations are service-type products.** Add seating options like "Two-top", "Four-top", "Long table for 12" to the catalogue with `type: "service"`. The `/reservations` page filters them in.
|
|
73
|
+
- The reservation widget adds the chosen seating to cart with the date, time, party size, and notes as cart-item notes; checkout finalises the booking via Cimplify's order pipeline.
|
|
74
|
+
- Schema.org `@type` is `Restaurant`. `servesCuisine` etc. can be added to the JSON-LD object in `app/layout.tsx` if needed.
|
|
75
|
+
- Mock seed: `--seed restaurant` (Mama's Kitchen).
|
|
27
76
|
|
|
28
|
-
##
|
|
77
|
+
## Known TODOs
|
|
29
78
|
|
|
30
|
-
|
|
79
|
+
- `/reservations` widget assumes every slot is bookable. For production, wire `useAvailableSlots({ serviceId, date })` from `@cimplify/sdk/react` to filter to actually-free windows.
|
|
80
|
+
- Contact form + newsletter fake their submits.
|
|
81
|
+
- Hero / dish photography is Unsplash — replace with merchant photos.
|
|
31
82
|
|
|
32
83
|
## Quick start
|
|
33
84
|
|
|
@@ -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`.
|