# RecordGod — public storefront + component page editor

Port WowPlatter's **customer-facing** storefront to RecordGod as a **component-based page system** with a
**page editor** (arrange the blocks). Studied: `wowplatter/public/{templates,partials,handlers}` +
`shortcodes/{entities,components,navigation,templates}`. Legend: 🟢 build · 🟡 confirm · 🔵 new (no RecordGod equiv yet).

---

## 1. The key insight — it's already component-based

WowPlatter renders public pages by composing **shortcode "blocks"**, not monolithic templates:

**Entity blocks** (`shortcodes/entities/`): `release · artist · label · genre · style · format · identifier ·
inventory · price · market · wantlist`. **Component blocks** (`shortcodes/components/`): `items (grid) · filter
(facets) · media (audio/video) · credits`. **Navigation** (`shortcodes/navigation/`): `breadcrumb · pagination ·
search`. Pages (`public/templates/*.php`) assemble these.

→ **So the page editor is natural:** a page = an ordered list of component blocks (each with config), stored as
JSON, editable by dragging/reordering. This is exactly "page edit style so I can arrange the components."

---

## 2. The public pages (mapped)

| Page | WowPlatter file | Components / sections | Data | Verdict |
|---|---|---|---|---|
| **Browse / Records** (the shop) | `records.php` (1378), `browse.php` | **faceted filter** (genre/style/format/year/price) + sort + **items grid** + pagination | `disc_release` mirror + `inventory` (in-stock, price) | 🟢 the core catalog page |
| **Release detail** | `release.php` (1701), `mobile-release.php` | cover, detail panels, **tracklist**, **credits**, price/inventory (buy), AI blurb, Apple/YT links, related | `disc_release` + `disc_release_track/artist/label/format/image` + `inventory` | 🟢 the hero page |
| **Artist** | `artist.php` (270) | artist header (name/bio/image) + their **releases grid** | `disc_artist` + `disc_release_artist` → releases | 🟢 |
| **Label** | `label.php` | label header + releases grid | `disc_label` + `disc_release_label` | 🟢 |
| **Genre / Style** | `genre.php` (278), style template | genre/style header + filtered releases grid | `disc_genre/style` + `disc_release_genre/style` | 🟢 |
| **Search** | `search-shortcode`, public-search | search box → results grid (reuse items grid) | inventory + `disc_release` | 🟢 (extends the admin search infra) |
| **Wantlist** | `wantlist` entity + public-wantlist partial | customer's wants + match-to-stock | `customer` + a `wantlist` table (intake-match — see audit) | 🟡 ties to the Wantlist cream item |
| **Login / Signup** | `login.php` (334), `signup.php`, forgot/reset | username/password forms, redirect, remember | **customer accounts** | 🔵 NEW — RecordGod has admin-token auth only, no customer accounts yet |
| **Profile / Loyalty** | `profile.php`, `loyalty-dashboard.php` | account info, order history, loyalty (inactive) | `customer` + `sales` | 🟡 (Loyalty inactive per audit) |
| **Listen** | `listen.php` | audio-preview player + crate map | audio previews (Audio cream) | 🟡 (ties to Audio previews) |
| Header / Footer / FAQ | `header/footer/faq.php` | chrome blocks | store_config | 🟢 fold into the builder |

---

## 3. RecordGod build — component library + page editor

**a) Component library** (RecordGod renders these; reusable across pages):
`release-card · release-detail · tracklist · credits · price-buy · items-grid · facet-filter · artist-header ·
label-header · genre-header · search-box · breadcrumb · pagination · hero/banner · text/markdown · audio-preview`.
Each is a small template + a data contract, themed by the builder tokens.

**b) Page-type layouts** (the editor's output): a page-type (`browse / release / artist / label / genre / style /
search / account`) has a **layout = ordered `[{component, config}]`** in `store_config` jsonb (already exists).
The public renderer reads the layout for the page-type + the entity data → composes the blocks.

**c) The page editor** (the ask): in `/builder`, a **per-page-type canvas**: pick a page type → see its block list →
**drag to reorder, add/remove blocks, edit each block's config** (e.g. items-grid: columns, sort default; facet-
filter: which facets; release-detail: which panels). Live preview using a sample entity. Saves the layout JSON.
(Builds on the existing `/builder` theme/brand-import + element editor — this adds the *structural* layer.)

**d) Data layer** — already mostly there:
- `disc_release` mirror (+ genre/style/label/format/artist/track/image) = all entity data, local. ✓
- `inventory` = what's in stock + price (the buyable layer). ✓
- Images = `/img/r/<release_id>` (self-hosted WebP). ✓
- Public read endpoints: extend `/shop/catalog` + add `/shop/release/<id>`, `/shop/artist/<id>`, `/shop/browse?facets…`.

**e) Routing** — pretty public URLs: `/records` (browse), `/release/<id>-<slug>`, `/artist/<id>`, `/label/<id>`,
`/genre/<g>`, `/style/<s>`, `/search`, `/account`. (WowPlatter uses rewrite rules; RecordGod adds FastAPI routes.)

**f) Customer auth** 🔵 — the one genuinely NEW piece: customer accounts (signup/login/forgot/profile) — a
`customer_auth` (email + password hash + session) layer separate from the admin token. WooCommerce currently owns
customer accounts; decide: RecordGod own accounts, or SSO/keep Woo for checkout (see §5).

---

## 4. How it connects to what exists
- **`/builder`** (theme + brand-import + element editor) → gains the **page-structure editor** (this plan's core).
- **`/shop`** (themed storefront reading `/shop/config` + `/shop/catalog`) → becomes the rendered output of the layouts.
- **disc_release mirror + inventory + /img/r** → the data + images, already built.
- **Customers + Wantlist** → power the account + wantlist pages.

---

## 5. Open questions (confirm before building)
1. **Customer accounts + checkout**: does RecordGod own customer auth + cart/checkout, or does **WooCommerce** stay
   the commerce/account backend (RecordGod renders, Woo transacts)? Big architecture fork.
2. **Editor depth**: full drag-drop block canvas, or a simpler ordered list with show/hide + config per block (faster
   to ship, 90% of the value)?
3. **Which pages first**: Browse + Release (the 80% — catalog + detail) before Artist/Label/Genre/Style + account?
4. **Listen/audio previews** on the storefront — in this phase or with the Audio internalization work?

## 6. Phases
- **P0 — read API + Release/Browse render** (no editor yet): `/shop/release/<id>` + `/shop/browse` rendering the
  component blocks with a default layout. The 80% value, proves the data + components.
- **P1 — the page editor**: per-page-type layout editor in `/builder` (reorder/add/remove/config blocks) + live preview.
- **P2 — Artist/Label/Genre/Style** entity pages (reuse items-grid + header blocks).
- **P3 — customer accounts** (signup/login/profile) — pending the §5.1 decision.
- **P4 — Wantlist + Search + Listen** storefront pages.
