create-brainerce-store 1.66.0 → 1.68.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/dist/index.js +1 -1
- package/package.json +1 -1
- package/templates/nextjs/base/.env.local.ejs +52 -24
- package/templates/nextjs/base/.eslintrc.json +51 -57
- package/templates/nextjs/base/AGENTS.md.ejs +114 -81
- package/templates/nextjs/base/CLAUDE.md.ejs +125 -92
- package/templates/nextjs/base/next.config.ts +103 -86
- package/templates/nextjs/base/scripts/fetch-store-info.mjs +104 -97
- package/templates/nextjs/base/src/app/agents.md/route.ts +4 -3
- package/templates/nextjs/base/src/app/api/auth/me/route.ts +65 -59
- package/templates/nextjs/base/src/app/api/store/[...path]/route.ts +255 -242
- package/templates/nextjs/base/src/app/blog/[slug]/page.tsx.ejs +317 -308
- package/templates/nextjs/base/src/app/blog/page.tsx.ejs +277 -276
- package/templates/nextjs/base/src/app/blog/rss.xml/route.ts +4 -3
- package/templates/nextjs/base/src/app/category/[slug]/page.tsx +22 -12
- package/templates/nextjs/base/src/app/error.tsx.ejs +53 -0
- package/templates/nextjs/base/src/app/faq/page.tsx.ejs +46 -46
- package/templates/nextjs/base/src/app/indexnow-key.txt/route.ts +25 -26
- package/templates/nextjs/base/src/app/layout.tsx.ejs +273 -257
- package/templates/nextjs/base/src/app/llms.txt/route.ts +4 -3
- package/templates/nextjs/base/src/app/opengraph-image.tsx +1 -1
- package/templates/nextjs/base/src/app/page.tsx +65 -64
- package/templates/nextjs/base/src/app/pages/[slug]/page.tsx.ejs +98 -92
- package/templates/nextjs/base/src/app/products/[slug]/page.tsx +22 -11
- package/templates/nextjs/base/src/app/robots.ts +3 -2
- package/templates/nextjs/base/src/app/sitemap.ts +4 -3
- package/templates/nextjs/base/src/components/checkout/custom-fields-step.tsx +294 -292
- package/templates/nextjs/base/src/components/seo/article-json-ld.tsx +60 -59
- package/templates/nextjs/base/src/components/seo/category-json-ld.tsx +60 -61
- package/templates/nextjs/base/src/components/seo/product-json-ld.tsx +2 -1
- package/templates/nextjs/base/src/core/lib/brainerce.server.ts +81 -0
- package/templates/nextjs/base/src/core/lib/brainerce.ts.ejs +60 -110
- package/templates/nextjs/base/src/core/lib/site-url.ts +230 -0
- package/templates/nextjs/base/src/ui/product/review-form.tsx +294 -294
- package/templates/nextjs/base/src/ui/product/reviews-section.tsx.ejs +108 -108
- package/templates/nextjs/designs/atelier/app-overlay/layout.tsx.ejs +301 -285
- package/templates/nextjs/designs/atelier/ui/layout/faq-section.tsx +97 -96
- package/templates/nextjs/designs/atelier/ui/layout/site-footer.tsx.ejs +142 -141
- package/templates/nextjs/designs/atelier/ui/layout/site-header.tsx.ejs +139 -138
- package/templates/nextjs/designs/atelier/ui/product/review-form.tsx +295 -267
- package/templates/nextjs/designs/atelier/ui/product/reviews-section.tsx.ejs +148 -148
- package/templates/nextjs/ui-canvas/layout/faq-section.tsx.ejs +72 -71
- package/templates/nextjs/ui-canvas/layout/site-footer.tsx.ejs +83 -82
- package/templates/nextjs/ui-canvas/layout/site-header.tsx.ejs +120 -119
- package/templates/nextjs/ui-canvas/product/faq-section.tsx.ejs +54 -0
- package/templates/nextjs/ui-canvas/product/review-form.tsx +267 -266
- package/templates/nextjs/ui-canvas/product/reviews-section.tsx.ejs +96 -96
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ var require_package = __commonJS({
|
|
|
31
31
|
"package.json"(exports2, module2) {
|
|
32
32
|
module2.exports = {
|
|
33
33
|
name: "create-brainerce-store",
|
|
34
|
-
version: "1.
|
|
34
|
+
version: "1.68.0",
|
|
35
35
|
description: "Scaffold a production-ready e-commerce storefront connected to Brainerce",
|
|
36
36
|
bin: {
|
|
37
37
|
"create-brainerce-store": "dist/index.js"
|
package/package.json
CHANGED
|
@@ -1,24 +1,52 @@
|
|
|
1
|
-
# Brainerce Sales Channel — preferred env var name.
|
|
2
|
-
NEXT_PUBLIC_BRAINERCE_SALES_CHANNEL_ID=<%= connectionId %>
|
|
3
|
-
# Legacy alias kept for backwards compatibility — both are accepted by the SDK.
|
|
4
|
-
# @deprecated will be removed when SDK 2.0 ships.
|
|
5
|
-
NEXT_PUBLIC_BRAINERCE_CONNECTION_ID=<%= connectionId %>
|
|
6
|
-
|
|
7
|
-
# Store info (pre-fetched during setup to avoid flash on first load)
|
|
8
|
-
NEXT_PUBLIC_STORE_NAME=<%- storeNameEnv %>
|
|
9
|
-
NEXT_PUBLIC_STORE_CURRENCY=<%- currencyEnv %>
|
|
10
|
-
|
|
11
|
-
# Backend API URL (server-side only — used by BFF proxy and SSR, never exposed to browser)
|
|
12
|
-
BRAINERCE_API_URL=<%- apiBaseUrlEnv %>
|
|
13
|
-
|
|
14
|
-
# Public API origin for the AI chat widget (public, unauthenticated endpoints only).
|
|
15
|
-
# The widget streams chat directly from the browser, so this one IS public.
|
|
16
|
-
NEXT_PUBLIC_BRAINERCE_API_URL=<%- apiBaseUrlEnv %>
|
|
17
|
-
|
|
18
|
-
# Public site URL —
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
#
|
|
22
|
-
#
|
|
23
|
-
#
|
|
24
|
-
#
|
|
1
|
+
# Brainerce Sales Channel — preferred env var name.
|
|
2
|
+
NEXT_PUBLIC_BRAINERCE_SALES_CHANNEL_ID=<%= connectionId %>
|
|
3
|
+
# Legacy alias kept for backwards compatibility — both are accepted by the SDK.
|
|
4
|
+
# @deprecated will be removed when SDK 2.0 ships.
|
|
5
|
+
NEXT_PUBLIC_BRAINERCE_CONNECTION_ID=<%= connectionId %>
|
|
6
|
+
|
|
7
|
+
# Store info (pre-fetched during setup to avoid flash on first load)
|
|
8
|
+
NEXT_PUBLIC_STORE_NAME=<%- storeNameEnv %>
|
|
9
|
+
NEXT_PUBLIC_STORE_CURRENCY=<%- currencyEnv %>
|
|
10
|
+
|
|
11
|
+
# Backend API URL (server-side only — used by BFF proxy and SSR, never exposed to browser)
|
|
12
|
+
BRAINERCE_API_URL=<%- apiBaseUrlEnv %>
|
|
13
|
+
|
|
14
|
+
# Public API origin for the AI chat widget (public, unauthenticated endpoints only).
|
|
15
|
+
# The widget streams chat directly from the browser, so this one IS public.
|
|
16
|
+
NEXT_PUBLIC_BRAINERCE_API_URL=<%- apiBaseUrlEnv %>
|
|
17
|
+
|
|
18
|
+
# Public site URL — canonical tags, sitemap.xml, robots.txt, JSON-LD, and the
|
|
19
|
+
# Origin header the Brainerce backend checks against your sales channel's
|
|
20
|
+
# configured domain.
|
|
21
|
+
#
|
|
22
|
+
# Intentionally unset. Nothing at setup time knows where this store will be
|
|
23
|
+
# served from, so the storefront resolves its own origin at runtime: hosting
|
|
24
|
+
# platform variables first (Vercel / Netlify / Render / Railway / Cloudflare
|
|
25
|
+
# Pages), then the incoming request's forwarded host. It is correct in local
|
|
26
|
+
# development and on any host, with nothing set here.
|
|
27
|
+
#
|
|
28
|
+
# ⛔ Do not write a placeholder address into this variable. A wrong absolute
|
|
29
|
+
# URL is indistinguishable from a right one to a search crawler, so a guess
|
|
30
|
+
# here is worse than leaving it empty. Either set your real domain or nothing.
|
|
31
|
+
#
|
|
32
|
+
# Once you have that domain, set it — an explicit value is the only source a
|
|
33
|
+
# request header cannot forge, and it keeps canonical URLs stable across
|
|
34
|
+
# preview deployments:
|
|
35
|
+
#
|
|
36
|
+
# SITE_URL=https://shop.example.com
|
|
37
|
+
#
|
|
38
|
+
# Set it in your hosting provider's environment variables, not in this file:
|
|
39
|
+
# .env.local is gitignored and never travels with a deploy.
|
|
40
|
+
# `NEXT_PUBLIC_SITE_URL` is still read as a backwards-compatible alias.
|
|
41
|
+
#
|
|
42
|
+
# On some hosts SITE_URL is NOT optional. Platforms whose proxy forwards
|
|
43
|
+
# requests to the app as `Host: localhost:<port>` (OpenAI Sites /
|
|
44
|
+
# *.chatgpt.site, among others) hide the real hostname from the server, so
|
|
45
|
+
# nothing can be resolved from the request. Set SITE_URL there, or server-side
|
|
46
|
+
# API calls send `Origin: http://localhost:3000` and a sales channel with a
|
|
47
|
+
# configured Domain rejects them with 403.
|
|
48
|
+
|
|
49
|
+
# Optional: floating WhatsApp contact button (used by some designs, e.g.
|
|
50
|
+
# passepartout). Digits only, international format without "+"
|
|
51
|
+
# (e.g. 14155550123). Leave unset to hide the button.
|
|
52
|
+
# NEXT_PUBLIC_WHATSAPP_PHONE=
|
|
@@ -1,57 +1,51 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": [
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
"!@/core/lib/
|
|
19
|
-
"!@/core/lib/
|
|
20
|
-
"!@/core/lib/
|
|
21
|
-
"!@/core/lib/
|
|
22
|
-
"!@/core/lib/
|
|
23
|
-
"!@/core/lib/
|
|
24
|
-
"!@/core/lib/
|
|
25
|
-
"!@/core/lib/
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
]
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
]
|
|
57
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"extends": ["next/core-web-vitals"],
|
|
3
|
+
"overrides": [
|
|
4
|
+
{
|
|
5
|
+
"files": ["src/ui/**/*.{ts,tsx}"],
|
|
6
|
+
"rules": {
|
|
7
|
+
"no-restricted-imports": [
|
|
8
|
+
"error",
|
|
9
|
+
{
|
|
10
|
+
"patterns": [
|
|
11
|
+
{
|
|
12
|
+
"group": [
|
|
13
|
+
"@/core/lib/*",
|
|
14
|
+
"!@/core/lib/auth",
|
|
15
|
+
"!@/core/lib/brainerce",
|
|
16
|
+
"!@/core/lib/brainerce.server",
|
|
17
|
+
"!@/core/lib/image-hosts",
|
|
18
|
+
"!@/core/lib/navigation",
|
|
19
|
+
"!@/core/lib/product-options",
|
|
20
|
+
"!@/core/lib/sanitize",
|
|
21
|
+
"!@/core/lib/tracking",
|
|
22
|
+
"!@/core/lib/sanitize-html",
|
|
23
|
+
"!@/core/lib/translations",
|
|
24
|
+
"!@/core/lib/use-currency",
|
|
25
|
+
"!@/core/lib/utils"
|
|
26
|
+
],
|
|
27
|
+
"message": "UI consumes data via @/core/hooks/* and @/core/providers/* — not core internals. (Approved presentation helpers are exempt.)"
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"files": ["src/core/**/*.{ts,tsx}"],
|
|
36
|
+
"rules": {
|
|
37
|
+
"no-restricted-imports": [
|
|
38
|
+
"error",
|
|
39
|
+
{
|
|
40
|
+
"patterns": [
|
|
41
|
+
{
|
|
42
|
+
"group": ["@/ui/*"],
|
|
43
|
+
"message": "core/ must never depend on presentation (ui/)."
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}
|
|
@@ -1,81 +1,114 @@
|
|
|
1
|
-
# AGENTS.md — this is a LIVE Brainerce storefront
|
|
2
|
-
|
|
3
|
-
**Store: "<%- storeName %>" · sales channel `<%- connectionId %>` — already
|
|
4
|
-
connected.** Products, cart, checkout, coupons, discounts, orders and content
|
|
5
|
-
flow in real time from the Brainerce dashboard. There is nothing to hook up.
|
|
6
|
-
|
|
7
|
-
- **NEVER suggest connecting this store to Shopify, WooCommerce, or "a real
|
|
8
|
-
system"** — Brainerce IS the commerce backend, and this store is wired to
|
|
9
|
-
it end-to-end.
|
|
10
|
-
- **NEVER build standalone HTML mockups or demo pages** — design THIS Next.js
|
|
11
|
-
app. Run `pnpm dev` and you are working against live data.
|
|
12
|
-
- **NEVER hardcode products, prices, or currency** — the catalog is live.
|
|
13
|
-
- **No server side is needed** — the backend is Brainerce's cloud. This repo
|
|
14
|
-
is a frontend (plus thin, already-included API proxy routes under
|
|
15
|
-
`src/app/api/`). Do not scaffold databases, auth servers, or admin panels —
|
|
16
|
-
the merchant manages everything in the Brainerce dashboard.
|
|
17
|
-
|
|
18
|
-
Platform docs (endpoints, SDK, integration recipes): https://brainerce.com/docs
|
|
19
|
-
— AI-readable index: https://brainerce.com/llms.txt
|
|
20
|
-
|
|
21
|
-
## MCP servers
|
|
22
|
-
|
|
23
|
-
- **`brainerce-docs`** — already connected via `.mcp.json`, no auth needed.
|
|
24
|
-
A live SDK/docs oracle: current SDK method shapes, type definitions, code
|
|
25
|
-
examples, and this store's actual capabilities/config. Prefer it over
|
|
26
|
-
guessing or relying on training data — it reflects what's actually toggled
|
|
27
|
-
on for `<%- connectionId %>` right now.
|
|
28
|
-
- **Brainerce Admin MCP** — opt-in, not wired up by default. Lets an agent
|
|
29
|
-
directly manage this store's *live* data (products, orders, discounts,
|
|
30
|
-
shipping, …) instead of just reading docs. Only add it if the merchant
|
|
31
|
-
wants that: connect `https://api.brainerce.com/api/mcp` as a remote HTTP
|
|
32
|
-
MCP server (e.g. `claude mcp add --transport http brainerce-admin
|
|
33
|
-
https://api.brainerce.com/api/mcp`) — it opens a browser to log into the
|
|
34
|
-
Brainerce dashboard, pick this store, and grant scoped OAuth permissions.
|
|
35
|
-
Treat it like handing the agent write access to production commerce data.
|
|
36
|
-
|
|
37
|
-
**Before building any feature the merchant asks for** (loyalty points,
|
|
38
|
-
shipping zones, subscriptions, gift cards, multi-currency, reviews,
|
|
39
|
-
abandoned-cart recovery, etc.) — check the docs first. Brainerce likely
|
|
40
|
-
already has it as a platform capability (dashboard toggle + hook/SDK
|
|
41
|
-
method) that only needs a UI in `src/ui/`, not a feature built from scratch.
|
|
42
|
-
|
|
43
|
-
Your job here is almost always **design**.
|
|
44
|
-
|
|
45
|
-
## The one rule
|
|
46
|
-
|
|
47
|
-
**`src/core/` is the platform's. `src/ui/` is yours.**
|
|
48
|
-
|
|
49
|
-
The shipped `src/ui/` is a working reference, not a design to preserve —
|
|
50
|
-
full delete-and-rebuild of ui files is encouraged and expected.
|
|
51
|
-
Rewrite anything under `src/ui/` and `src/app/globals.css` as boldly as you
|
|
52
|
-
like — the store keeps working. Never modify `src/core/`, `src/app/api/`, or
|
|
53
|
-
the checkout/auth/account components. Data and behavior come exclusively from
|
|
54
|
-
`@/core/hooks/*` and `@/core/providers/store-provider` — hooks return state
|
|
55
|
-
and handlers, never JSX. Never hardcode catalog content.
|
|
56
|
-
|
|
57
|
-
**Read `AI-GUIDE.md` before any redesign** — it has the full file map, hook
|
|
58
|
-
contracts, motion language, and hard-won RTL/i18n gotchas that will save you
|
|
59
|
-
real debugging time.
|
|
60
|
-
|
|
61
|
-
## Redesigning?
|
|
62
|
-
|
|
63
|
-
Follow the process documented in AI-GUIDE.md: commit to one art direction,
|
|
64
|
-
rewrite tokens first, then surfaces in order (header, home, card, product
|
|
65
|
-
page, cart), then verify.
|
|
66
|
-
|
|
67
|
-
##
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
1
|
+
# AGENTS.md — this is a LIVE Brainerce storefront
|
|
2
|
+
|
|
3
|
+
**Store: "<%- storeName %>" · sales channel `<%- connectionId %>` — already
|
|
4
|
+
connected.** Products, cart, checkout, coupons, discounts, orders and content
|
|
5
|
+
flow in real time from the Brainerce dashboard. There is nothing to hook up.
|
|
6
|
+
|
|
7
|
+
- **NEVER suggest connecting this store to Shopify, WooCommerce, or "a real
|
|
8
|
+
system"** — Brainerce IS the commerce backend, and this store is wired to
|
|
9
|
+
it end-to-end.
|
|
10
|
+
- **NEVER build standalone HTML mockups or demo pages** — design THIS Next.js
|
|
11
|
+
app. Run `pnpm dev` and you are working against live data.
|
|
12
|
+
- **NEVER hardcode products, prices, or currency** — the catalog is live.
|
|
13
|
+
- **No server side is needed** — the backend is Brainerce's cloud. This repo
|
|
14
|
+
is a frontend (plus thin, already-included API proxy routes under
|
|
15
|
+
`src/app/api/`). Do not scaffold databases, auth servers, or admin panels —
|
|
16
|
+
the merchant manages everything in the Brainerce dashboard.
|
|
17
|
+
|
|
18
|
+
Platform docs (endpoints, SDK, integration recipes): https://brainerce.com/docs
|
|
19
|
+
— AI-readable index: https://brainerce.com/llms.txt
|
|
20
|
+
|
|
21
|
+
## MCP servers
|
|
22
|
+
|
|
23
|
+
- **`brainerce-docs`** — already connected via `.mcp.json`, no auth needed.
|
|
24
|
+
A live SDK/docs oracle: current SDK method shapes, type definitions, code
|
|
25
|
+
examples, and this store's actual capabilities/config. Prefer it over
|
|
26
|
+
guessing or relying on training data — it reflects what's actually toggled
|
|
27
|
+
on for `<%- connectionId %>` right now.
|
|
28
|
+
- **Brainerce Admin MCP** — opt-in, not wired up by default. Lets an agent
|
|
29
|
+
directly manage this store's *live* data (products, orders, discounts,
|
|
30
|
+
shipping, …) instead of just reading docs. Only add it if the merchant
|
|
31
|
+
wants that: connect `https://api.brainerce.com/api/mcp` as a remote HTTP
|
|
32
|
+
MCP server (e.g. `claude mcp add --transport http brainerce-admin
|
|
33
|
+
https://api.brainerce.com/api/mcp`) — it opens a browser to log into the
|
|
34
|
+
Brainerce dashboard, pick this store, and grant scoped OAuth permissions.
|
|
35
|
+
Treat it like handing the agent write access to production commerce data.
|
|
36
|
+
|
|
37
|
+
**Before building any feature the merchant asks for** (loyalty points,
|
|
38
|
+
shipping zones, subscriptions, gift cards, multi-currency, reviews,
|
|
39
|
+
abandoned-cart recovery, etc.) — check the docs first. Brainerce likely
|
|
40
|
+
already has it as a platform capability (dashboard toggle + hook/SDK
|
|
41
|
+
method) that only needs a UI in `src/ui/`, not a feature built from scratch.
|
|
42
|
+
|
|
43
|
+
Your job here is almost always **design**.
|
|
44
|
+
|
|
45
|
+
## The one rule
|
|
46
|
+
|
|
47
|
+
**`src/core/` is the platform's. `src/ui/` is yours.**
|
|
48
|
+
|
|
49
|
+
The shipped `src/ui/` is a working reference, not a design to preserve —
|
|
50
|
+
full delete-and-rebuild of ui files is encouraged and expected.
|
|
51
|
+
Rewrite anything under `src/ui/` and `src/app/globals.css` as boldly as you
|
|
52
|
+
like — the store keeps working. Never modify `src/core/`, `src/app/api/`, or
|
|
53
|
+
the checkout/auth/account components. Data and behavior come exclusively from
|
|
54
|
+
`@/core/hooks/*` and `@/core/providers/store-provider` — hooks return state
|
|
55
|
+
and handlers, never JSX. Never hardcode catalog content.
|
|
56
|
+
|
|
57
|
+
**Read `AI-GUIDE.md` before any redesign** — it has the full file map, hook
|
|
58
|
+
contracts, motion language, and hard-won RTL/i18n gotchas that will save you
|
|
59
|
+
real debugging time.
|
|
60
|
+
|
|
61
|
+
## Redesigning?
|
|
62
|
+
|
|
63
|
+
Follow the process documented in AI-GUIDE.md: commit to one art direction,
|
|
64
|
+
rewrite tokens first, then surfaces in order (header, home, card, product
|
|
65
|
+
page, cart), then verify.
|
|
66
|
+
|
|
67
|
+
## The store's web address
|
|
68
|
+
|
|
69
|
+
This project has no web address written into it, and that is deliberate — the
|
|
70
|
+
scaffolder cannot know where you will deploy. `src/core/lib/site-url.ts`
|
|
71
|
+
resolves it per request (hosting-platform variables, then the forwarded host),
|
|
72
|
+
so canonical tags, `sitemap.xml`, `robots.txt` and JSON-LD are correct in local
|
|
73
|
+
development and on any host with nothing configured.
|
|
74
|
+
|
|
75
|
+
- **Never invent an address.** Do not write `NEXT_PUBLIC_SITE_URL`,
|
|
76
|
+
`SITE_URL`, `localhost`, or a placeholder domain into `.env.local`. A wrong
|
|
77
|
+
absolute URL is indistinguishable from a right one to a search crawler, so a
|
|
78
|
+
guess is worse than an empty value.
|
|
79
|
+
- **Never hand-roll an origin** from `host` / `x-forwarded-proto` in a route
|
|
80
|
+
handler. Call `getCanonicalSiteUrl()` (for canonical/SEO URLs) or
|
|
81
|
+
`getRequestOrigin()` (for the `Origin` header sent to Brainerce). Hand-rolled
|
|
82
|
+
versions have shipped `http://` on HTTPS hosts and internal container
|
|
83
|
+
hostnames.
|
|
84
|
+
- **Some hosts hide the real hostname from the app.** Platforms whose proxy
|
|
85
|
+
forwards requests as `Host: localhost:<port>` with no `x-forwarded-host`
|
|
86
|
+
(OpenAI Sites / `*.chatgpt.site` does this) leave the resolver blind — the
|
|
87
|
+
request looks like it arrived on localhost. On such platforms `SITE_URL` is
|
|
88
|
+
not optional: set it, and the resolver prefers it over any internal host it
|
|
89
|
+
sees. Without it, server-side API calls send `Origin: http://localhost:3000`
|
|
90
|
+
and a channel with a configured Domain rejects them with 403.
|
|
91
|
+
- **When the merchant gives you a real domain**, set `SITE_URL` in the hosting
|
|
92
|
+
provider's environment variables — not in `.env.local`, which is gitignored
|
|
93
|
+
and never travels with a deploy.
|
|
94
|
+
- **Tell the merchant the other half.** A sales channel in **Live** mode only
|
|
95
|
+
accepts requests whose Origin matches the Domain configured on the channel in
|
|
96
|
+
the Brainerce dashboard. That check is server-side; nothing in this project
|
|
97
|
+
can satisfy it. If they skip it, every storefront API call returns 403 and the
|
|
98
|
+
store loads empty — no matter what `SITE_URL` says.
|
|
99
|
+
|
|
100
|
+
## Verify before declaring done
|
|
101
|
+
|
|
102
|
+
1. `pnpm exec tsc --noEmit` → 0 errors
|
|
103
|
+
2. `pnpm dev` → drive the changed flow in a real browser (home → product →
|
|
104
|
+
add to cart → cart)
|
|
105
|
+
3. Screenshot desktop (1440px) and mobile (390px)
|
|
106
|
+
4. RTL stores: check anchoring and arrow directions
|
|
107
|
+
|
|
108
|
+
## i18n
|
|
109
|
+
|
|
110
|
+
Every user-facing string goes through `useTranslations()` with keys in **all**
|
|
111
|
+
files under `messages/`. The shipped copy is example boutique content — a
|
|
112
|
+
starting point meant to be rewritten in the store's real voice. Hebrew: no
|
|
113
|
+
uppercase transforms, no wide letter-spacing on headings, logical CSS
|
|
114
|
+
properties only (`ms-/me-`, `ps-/pe-`, `start-/end-`).
|
|
@@ -1,92 +1,125 @@
|
|
|
1
|
-
# CLAUDE.md — this is a LIVE Brainerce storefront
|
|
2
|
-
|
|
3
|
-
**Store: "<%- storeName %>" · sales channel `<%- connectionId %>` — already
|
|
4
|
-
connected.** Products, cart, checkout, coupons, discounts, orders and content
|
|
5
|
-
flow in real time from the Brainerce dashboard. There is nothing to hook up.
|
|
6
|
-
|
|
7
|
-
- **NEVER suggest connecting this store to Shopify, WooCommerce, or "a real
|
|
8
|
-
system"** — Brainerce IS the commerce backend, and this store is wired to
|
|
9
|
-
it end-to-end.
|
|
10
|
-
- **NEVER build standalone HTML mockups or demo pages** — design THIS Next.js
|
|
11
|
-
app. Run `pnpm dev` and you are working against live data.
|
|
12
|
-
- **NEVER hardcode products, prices, or currency** — the catalog is live.
|
|
13
|
-
- **No server side is needed** — the backend is Brainerce's cloud. This repo
|
|
14
|
-
is a frontend (plus thin, already-included API proxy routes under
|
|
15
|
-
`src/app/api/`). Do not scaffold databases, auth servers, or admin panels —
|
|
16
|
-
the merchant manages everything in the Brainerce dashboard.
|
|
17
|
-
|
|
18
|
-
Platform docs (endpoints, SDK, integration recipes): https://brainerce.com/docs
|
|
19
|
-
— AI-readable index: https://brainerce.com/llms.txt
|
|
20
|
-
|
|
21
|
-
## MCP servers
|
|
22
|
-
|
|
23
|
-
- **`brainerce-docs`** — already connected via `.mcp.json`, no auth needed.
|
|
24
|
-
A live SDK/docs oracle: current SDK method shapes, type definitions, code
|
|
25
|
-
examples, and this store's actual capabilities/config. Prefer it over
|
|
26
|
-
guessing or relying on training data — it reflects what's actually toggled
|
|
27
|
-
on for `<%- connectionId %>` right now.
|
|
28
|
-
- **Brainerce Admin MCP** — opt-in, not wired up by default. Lets an agent
|
|
29
|
-
directly manage this store's *live* data (products, orders, discounts,
|
|
30
|
-
shipping, …) instead of just reading docs. Only add it if the merchant
|
|
31
|
-
wants that: connect `https://api.brainerce.com/api/mcp` as a remote HTTP
|
|
32
|
-
MCP server (e.g. `claude mcp add --transport http brainerce-admin
|
|
33
|
-
https://api.brainerce.com/api/mcp`) — it opens a browser to log into the
|
|
34
|
-
Brainerce dashboard, pick this store, and grant scoped OAuth permissions.
|
|
35
|
-
Treat it like handing the agent write access to production commerce data.
|
|
36
|
-
|
|
37
|
-
**Before building any feature the merchant asks for** (loyalty points,
|
|
38
|
-
shipping zones, subscriptions, gift cards, multi-currency, reviews,
|
|
39
|
-
abandoned-cart recovery, etc.) — check the docs first. Brainerce likely
|
|
40
|
-
already has it as a platform capability (dashboard toggle + hook/SDK
|
|
41
|
-
method) that only needs a UI in `src/ui/`, not a feature built from scratch.
|
|
42
|
-
|
|
43
|
-
Your job here is almost always **design**.
|
|
44
|
-
|
|
45
|
-
## The one rule
|
|
46
|
-
|
|
47
|
-
**`src/core/` is the platform's. `src/ui/` is yours.**
|
|
48
|
-
|
|
49
|
-
The shipped `src/ui/` is a working reference, not a design to preserve —
|
|
50
|
-
full delete-and-rebuild of ui files is encouraged and expected. (Stores
|
|
51
|
-
scaffolded with `--canvas` ship `src/ui/` as bare unstyled skeletons —
|
|
52
|
-
there is no reference look at all; the design is entirely yours to create.)
|
|
53
|
-
Rewrite anything under `src/ui/` and `src/app/globals.css` as boldly as you
|
|
54
|
-
like — the store keeps working. Never modify `src/core/`, `src/app/api/`, or
|
|
55
|
-
the checkout/auth/account components. Data and behavior come exclusively from
|
|
56
|
-
`@/core/hooks/*` and `@/core/providers/store-provider` — hooks return state
|
|
57
|
-
and handlers, never JSX. Never hardcode catalog content.
|
|
58
|
-
|
|
59
|
-
**Read `AI-GUIDE.md` before any redesign** — it has the full file map, hook
|
|
60
|
-
contracts, motion language, and hard-won RTL/i18n gotchas that will save you
|
|
61
|
-
real debugging time.
|
|
62
|
-
|
|
63
|
-
## The dialect
|
|
64
|
-
|
|
65
|
-
- `src/components/ui/` = official **shadcn/ui primitives** (Button, Card,
|
|
66
|
-
Badge, Input, Select, Accordion, Dialog, Sheet, Skeleton, …). Compose them;
|
|
67
|
-
extend looks via CVA **variants**, never repeated inline overrides.
|
|
68
|
-
- Icons: **lucide-react only** — no inline `<svg>`, no emoji-as-icons.
|
|
69
|
-
- Class merging: **`cn()`** from `@/core/lib/utils`.
|
|
70
|
-
- Colors/radius come from the semantic HSL tokens in `globals.css`
|
|
71
|
-
(`--primary`, `--card`, `--ring`, `--radius`, …) — restyle via tokens.
|
|
72
|
-
|
|
73
|
-
## Redesigning? Use the ready-made flow
|
|
74
|
-
|
|
75
|
-
Run `/design <your art-direction brief>` — it walks the whole process:
|
|
76
|
-
concept → implementation in `ui/` → verification.
|
|
77
|
-
|
|
78
|
-
##
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
1
|
+
# CLAUDE.md — this is a LIVE Brainerce storefront
|
|
2
|
+
|
|
3
|
+
**Store: "<%- storeName %>" · sales channel `<%- connectionId %>` — already
|
|
4
|
+
connected.** Products, cart, checkout, coupons, discounts, orders and content
|
|
5
|
+
flow in real time from the Brainerce dashboard. There is nothing to hook up.
|
|
6
|
+
|
|
7
|
+
- **NEVER suggest connecting this store to Shopify, WooCommerce, or "a real
|
|
8
|
+
system"** — Brainerce IS the commerce backend, and this store is wired to
|
|
9
|
+
it end-to-end.
|
|
10
|
+
- **NEVER build standalone HTML mockups or demo pages** — design THIS Next.js
|
|
11
|
+
app. Run `pnpm dev` and you are working against live data.
|
|
12
|
+
- **NEVER hardcode products, prices, or currency** — the catalog is live.
|
|
13
|
+
- **No server side is needed** — the backend is Brainerce's cloud. This repo
|
|
14
|
+
is a frontend (plus thin, already-included API proxy routes under
|
|
15
|
+
`src/app/api/`). Do not scaffold databases, auth servers, or admin panels —
|
|
16
|
+
the merchant manages everything in the Brainerce dashboard.
|
|
17
|
+
|
|
18
|
+
Platform docs (endpoints, SDK, integration recipes): https://brainerce.com/docs
|
|
19
|
+
— AI-readable index: https://brainerce.com/llms.txt
|
|
20
|
+
|
|
21
|
+
## MCP servers
|
|
22
|
+
|
|
23
|
+
- **`brainerce-docs`** — already connected via `.mcp.json`, no auth needed.
|
|
24
|
+
A live SDK/docs oracle: current SDK method shapes, type definitions, code
|
|
25
|
+
examples, and this store's actual capabilities/config. Prefer it over
|
|
26
|
+
guessing or relying on training data — it reflects what's actually toggled
|
|
27
|
+
on for `<%- connectionId %>` right now.
|
|
28
|
+
- **Brainerce Admin MCP** — opt-in, not wired up by default. Lets an agent
|
|
29
|
+
directly manage this store's *live* data (products, orders, discounts,
|
|
30
|
+
shipping, …) instead of just reading docs. Only add it if the merchant
|
|
31
|
+
wants that: connect `https://api.brainerce.com/api/mcp` as a remote HTTP
|
|
32
|
+
MCP server (e.g. `claude mcp add --transport http brainerce-admin
|
|
33
|
+
https://api.brainerce.com/api/mcp`) — it opens a browser to log into the
|
|
34
|
+
Brainerce dashboard, pick this store, and grant scoped OAuth permissions.
|
|
35
|
+
Treat it like handing the agent write access to production commerce data.
|
|
36
|
+
|
|
37
|
+
**Before building any feature the merchant asks for** (loyalty points,
|
|
38
|
+
shipping zones, subscriptions, gift cards, multi-currency, reviews,
|
|
39
|
+
abandoned-cart recovery, etc.) — check the docs first. Brainerce likely
|
|
40
|
+
already has it as a platform capability (dashboard toggle + hook/SDK
|
|
41
|
+
method) that only needs a UI in `src/ui/`, not a feature built from scratch.
|
|
42
|
+
|
|
43
|
+
Your job here is almost always **design**.
|
|
44
|
+
|
|
45
|
+
## The one rule
|
|
46
|
+
|
|
47
|
+
**`src/core/` is the platform's. `src/ui/` is yours.**
|
|
48
|
+
|
|
49
|
+
The shipped `src/ui/` is a working reference, not a design to preserve —
|
|
50
|
+
full delete-and-rebuild of ui files is encouraged and expected. (Stores
|
|
51
|
+
scaffolded with `--canvas` ship `src/ui/` as bare unstyled skeletons —
|
|
52
|
+
there is no reference look at all; the design is entirely yours to create.)
|
|
53
|
+
Rewrite anything under `src/ui/` and `src/app/globals.css` as boldly as you
|
|
54
|
+
like — the store keeps working. Never modify `src/core/`, `src/app/api/`, or
|
|
55
|
+
the checkout/auth/account components. Data and behavior come exclusively from
|
|
56
|
+
`@/core/hooks/*` and `@/core/providers/store-provider` — hooks return state
|
|
57
|
+
and handlers, never JSX. Never hardcode catalog content.
|
|
58
|
+
|
|
59
|
+
**Read `AI-GUIDE.md` before any redesign** — it has the full file map, hook
|
|
60
|
+
contracts, motion language, and hard-won RTL/i18n gotchas that will save you
|
|
61
|
+
real debugging time.
|
|
62
|
+
|
|
63
|
+
## The dialect
|
|
64
|
+
|
|
65
|
+
- `src/components/ui/` = official **shadcn/ui primitives** (Button, Card,
|
|
66
|
+
Badge, Input, Select, Accordion, Dialog, Sheet, Skeleton, …). Compose them;
|
|
67
|
+
extend looks via CVA **variants**, never repeated inline overrides.
|
|
68
|
+
- Icons: **lucide-react only** — no inline `<svg>`, no emoji-as-icons.
|
|
69
|
+
- Class merging: **`cn()`** from `@/core/lib/utils`.
|
|
70
|
+
- Colors/radius come from the semantic HSL tokens in `globals.css`
|
|
71
|
+
(`--primary`, `--card`, `--ring`, `--radius`, …) — restyle via tokens.
|
|
72
|
+
|
|
73
|
+
## Redesigning? Use the ready-made flow
|
|
74
|
+
|
|
75
|
+
Run `/design <your art-direction brief>` — it walks the whole process:
|
|
76
|
+
concept → implementation in `ui/` → verification.
|
|
77
|
+
|
|
78
|
+
## The store's web address
|
|
79
|
+
|
|
80
|
+
This project has no web address written into it, and that is deliberate — the
|
|
81
|
+
scaffolder cannot know where you will deploy. `src/core/lib/site-url.ts`
|
|
82
|
+
resolves it per request (hosting-platform variables, then the forwarded host),
|
|
83
|
+
so canonical tags, `sitemap.xml`, `robots.txt` and JSON-LD are correct in local
|
|
84
|
+
development and on any host with nothing configured.
|
|
85
|
+
|
|
86
|
+
- **Never invent an address.** Do not write `NEXT_PUBLIC_SITE_URL`,
|
|
87
|
+
`SITE_URL`, `localhost`, or a placeholder domain into `.env.local`. A wrong
|
|
88
|
+
absolute URL is indistinguishable from a right one to a search crawler, so a
|
|
89
|
+
guess is worse than an empty value.
|
|
90
|
+
- **Never hand-roll an origin** from `host` / `x-forwarded-proto` in a route
|
|
91
|
+
handler. Call `getCanonicalSiteUrl()` (for canonical/SEO URLs) or
|
|
92
|
+
`getRequestOrigin()` (for the `Origin` header sent to Brainerce). Hand-rolled
|
|
93
|
+
versions have shipped `http://` on HTTPS hosts and internal container
|
|
94
|
+
hostnames.
|
|
95
|
+
- **Some hosts hide the real hostname from the app.** Platforms whose proxy
|
|
96
|
+
forwards requests as `Host: localhost:<port>` with no `x-forwarded-host`
|
|
97
|
+
(OpenAI Sites / `*.chatgpt.site` does this) leave the resolver blind — the
|
|
98
|
+
request looks like it arrived on localhost. On such platforms `SITE_URL` is
|
|
99
|
+
not optional: set it, and the resolver prefers it over any internal host it
|
|
100
|
+
sees. Without it, server-side API calls send `Origin: http://localhost:3000`
|
|
101
|
+
and a channel with a configured Domain rejects them with 403.
|
|
102
|
+
- **When the merchant gives you a real domain**, set `SITE_URL` in the hosting
|
|
103
|
+
provider's environment variables — not in `.env.local`, which is gitignored
|
|
104
|
+
and never travels with a deploy.
|
|
105
|
+
- **Tell the merchant the other half.** A sales channel in **Live** mode only
|
|
106
|
+
accepts requests whose Origin matches the Domain configured on the channel in
|
|
107
|
+
the Brainerce dashboard. That check is server-side; nothing in this project
|
|
108
|
+
can satisfy it. If they skip it, every storefront API call returns 403 and the
|
|
109
|
+
store loads empty — no matter what `SITE_URL` says.
|
|
110
|
+
|
|
111
|
+
## Verify before declaring done
|
|
112
|
+
|
|
113
|
+
1. `pnpm exec tsc --noEmit` → 0 errors
|
|
114
|
+
2. `pnpm dev` → drive the changed flow in a real browser (home → product →
|
|
115
|
+
add to cart → cart)
|
|
116
|
+
3. Screenshot desktop (1440px) and mobile (390px)
|
|
117
|
+
4. RTL stores: check anchoring and arrow directions
|
|
118
|
+
|
|
119
|
+
## i18n
|
|
120
|
+
|
|
121
|
+
Every user-facing string goes through `useTranslations()` with keys in **all**
|
|
122
|
+
files under `messages/`. The shipped copy is example boutique content — a
|
|
123
|
+
starting point meant to be rewritten in the store's real voice. Hebrew: no
|
|
124
|
+
uppercase transforms, no wide letter-spacing on headings, logical CSS
|
|
125
|
+
properties only (`ms-/me-`, `ps-/pe-`, `start-/end-`).
|