Docs: bring CLAUDE.md, the transition roadmap and the README up to date
CLAUDE.md: localization now describes core's locale middleware, $currentLocale/$altLocales and storefront.* Language Lines (there are no lang/ files or SetLocale); the stack is Lunar 1.5, Postgres, Meilisearch, Caddy, no Turbo; the design-reference section pointed at files nobody has, and the component checklist was out of date. CACHING-TRANSITION.md: records the 2026-11-06 changes (no Turbo, JSON islands and writes, one bb_state cookie, prefetch instead of prerender), a status table per task, the A4/A9 rework, and sources that the team can actually reach. README: known issues found while writing the boboko plugin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f9b2756456
commit
81e70de70f
3 files changed
+114
-70
No files matched your search
+70
-25
@@ -9,10 +9,17 @@ # Caching transition: context and first tasks (for Claude)
|
||||
file wins on style, Greek register, localization and performance rules.
|
||||
|
||||
Source documents (outside this repo, read-only for context):
|
||||
- `/Users/farenoubi/Projects/boboko-research/caching-islands.md`: the target design
|
||||
- `/Users/farenoubi/Projects/boboko-research/tech-platform.md`: the platform plan
|
||||
- `/Users/farenoubi/Projects/boboko-research/tasks.md`: the full task list (3dealer, boboko-core, infra, parked). **The source of truth for task ids**
|
||||
- `/Users/farenoubi/Projects/boboko-research/team-discussion.md`: decisions, and the open items (D7, D10)
|
||||
- The research repo (`lexx/research` on code.radical-elements.com), `products/boboko/`:
|
||||
- `caching-islands.md`: the target design (partly superseded, see "Changed on 2026-11-06")
|
||||
- `tech-platform.md`: the platform plan
|
||||
- `manifesto.md`: the principles decisions are checked against
|
||||
- `tasks.md` (the full task list and **source of truth for task ids**) and `team-discussion.md`
|
||||
(open items D7, D10) were written in the same planning session but aren't in the research
|
||||
repo. Ask the team for them.
|
||||
|
||||
The rules that come out of this work are written up as skills in the **`boboko` Claude Code
|
||||
plugin** (re-skills marketplace): `cacheable-pages` above all, plus `storefront-frontend`,
|
||||
`storefront-performance` and `storefront-translations`.
|
||||
|
||||
Every task is also a card on the Planka board (3dealer.gr → Development,
|
||||
label **Transition**). The task id (A1, W1…) is in each card's description.
|
||||
@@ -26,23 +33,38 @@ ## Where we're going
|
||||
(probably as static files Caddy serves without PHP). Anything personal (cart,
|
||||
login state, wishlist, CSRF token) comes from **one small "islands" request**
|
||||
that runs only when the visitor has a state cookie, and is answered with
|
||||
**Turbo Streams** rendered from Blade.
|
||||
**JSON** that Stimulus applies to elements already in the page.
|
||||
|
||||
- Cacheable routes (home, category, product, `/products`, FAQ, legal pages)
|
||||
will run **without a session**: no cookies, no CSRF token, no `auth()`, no
|
||||
flash, no `old()`, no `$errors`.
|
||||
- Session routes (cart, checkout, account, login, contact, islands, writes)
|
||||
stay in `web`.
|
||||
- Writes (add to cart, wishlist toggle, review) answer with Turbo Streams that
|
||||
update every affected place at once.
|
||||
- Writes (add to cart, wishlist toggle, review) are normal forms enhanced with
|
||||
`fetch`, answered with JSON. New markup (e.g. a new review) is cloned from a
|
||||
Blade-rendered `<template>` of the same component.
|
||||
|
||||
**Changed on 2026-11-06 (these replace the matching 2026-11-02 decisions below):**
|
||||
- **No Turbo at all**: no Drive, Frames or Streams. Islands and writes answer with
|
||||
**JSON**; Stimulus applies it as text and attributes on existing targets. New
|
||||
markup comes from a Blade `<template>` of the same component, filled with
|
||||
`textContent`, the same pattern as the Meilisearch search cards. Existing Turbo
|
||||
code (listing/search Frames, the review Streams from A4) gets replaced.
|
||||
- **One hint cookie, `bb_state=1`** (has a cart, a login or a wishlist item), with
|
||||
no count in it. One `GET /{locale}/islands` when it's present, nothing otherwise.
|
||||
- **Speculation Rules: `prefetch`, not `prerender`.** Prerender runs every analytics,
|
||||
pixel and consent script on pages nobody may see. Revisit only once pages are
|
||||
cached and the pilot shows analytics stay correct.
|
||||
- **Where the standard storefront template lives** (core or starter) is decided once
|
||||
3dealer is ready.
|
||||
|
||||
**Decided (2026-11-02):**
|
||||
- Turbo Streams for islands and writes (JSON only for consumers that aren't
|
||||
HTML); the cart badge starts as a fixed-size placeholder.
|
||||
- ~~Turbo Streams for islands and writes~~ (replaced: JSON, see above); the cart
|
||||
badge starts as a fixed-size placeholder.
|
||||
- Laravel 13 (core C0, then A0 here), once core work resumes.
|
||||
- **Page cache: static files** served by Caddy (later tasks P1–P3).
|
||||
- **No Turbo Drive.** A normal multi-page site plus Speculation Rules, View
|
||||
Transitions and back/forward cache (A7–A9 here).
|
||||
- **No Turbo Drive** (now: no Turbo at all). A normal multi-page site plus
|
||||
Speculation Rules, View Transitions and back/forward cache (A7–A9 here).
|
||||
- **Caddy** replaces nginx (W1, the last task in this file).
|
||||
- **Search and filters will run in the browser against Meilisearch** through
|
||||
Caddy on a subdomain, with the card as one Blade component reused through a
|
||||
@@ -65,8 +87,9 @@ ## Where 3dealer is today (personal state found in catalogue pages)
|
||||
|
||||
Other facts worth knowing:
|
||||
- Turbo is installed, but **Drive is off** (`window.Turbo.session.drive = false`
|
||||
in `resources/js/app.js`). Only Frames are used. **Keep it off**: that's
|
||||
now decided.
|
||||
in `resources/js/app.js`). Frames drive the listing, search and sort. **The
|
||||
direction is no Turbo at all**: don't add to it; Frames go away with the
|
||||
Meilisearch track, and `@hotwired/turbo` is removed once nothing uses it.
|
||||
- Catalogue data comes from Meilisearch via boboko-core's `ProductService`.
|
||||
Listings use query-string filters. Don't change that in these tasks; the
|
||||
browser-side rewrite is the M track.
|
||||
@@ -88,8 +111,24 @@ ## Rules for this work
|
||||
- Follow the `{locale}` controller rule in CLAUDE.md (`$locale` is the first
|
||||
parameter).
|
||||
- UI strings: reuse existing `storefront.*` keys where possible. New keys are
|
||||
DB-backed Language Lines: use the `boboko-translations` skill, never `lang/`
|
||||
files.
|
||||
DB-backed Language Lines (the `storefront-translations` skill), never `lang/`
|
||||
files, and they must reach core's seeder (`boboko:translations:pull`).
|
||||
|
||||
## Status (2026-11-06)
|
||||
|
||||
| Task | Status |
|
||||
|---|---|
|
||||
| A0 Laravel 13 | Waiting for core C0 |
|
||||
| A1 Cart badge placeholder | Done (`6948c13`) |
|
||||
| A2 Header without login checks | Done (`702609d`) |
|
||||
| A3 Stable island targets | Done (`4fc7880`) |
|
||||
| A4 Reviews without a redirect | Done with Turbo Streams (`f0a1b92`). **Rework to JSON** (see A4 below) |
|
||||
| A5 Personal-state test | Not started |
|
||||
| A6 `view:cache` in deploy | Done (`1ff55ac`) |
|
||||
| A7 View Transitions | Done (`bad5a7d`) |
|
||||
| A8 Back/forward cache | No commit yet |
|
||||
| A9 Speculation Rules | Done with `prerender` (`c1acc00`). **Switch to `prefetch`** (see A9 below) |
|
||||
| W1 Caddy | Done (`6d88d53`) |
|
||||
|
||||
## Tasks to work on now
|
||||
|
||||
@@ -152,16 +191,18 @@ ### A4. Review submission without a redirect (M)
|
||||
calls `searchableSync()`, and redirects to `?tab=reviews#product-tabs` with
|
||||
`withErrors`/`withInput` or a `reviewSubmitted` + `justSubmittedReview` flash.
|
||||
|
||||
Change it to:
|
||||
- A fetch or Turbo form submit (with Drive off, check whether `data-turbo="true"`
|
||||
on the form is enough, or use a Stimulus controller with
|
||||
`Turbo.renderStreamMessage`).
|
||||
- **Success:** a Turbo Stream response that inserts the new review at the top
|
||||
of the reviews list (rendered from the same Blade partial as the existing
|
||||
reviews), updates the count and average if shown, and swaps the form for the
|
||||
thank-you message.
|
||||
- **Validation errors:** a stream (or 422 + stream) that re-renders the form
|
||||
with inline errors and the entered values. No session `old()`/`$errors`.
|
||||
Change it to (**updated 2026-11-06: JSON, no Turbo**; the first version used
|
||||
Turbo Streams and needs reworking):
|
||||
- A Stimulus controller that submits the form with `fetch` and
|
||||
`Accept: application/json`. Remove `data-turbo="true"` and the stream views
|
||||
(`product/streams/`).
|
||||
- **Success:** a JSON response (the review, display-ready, plus count and
|
||||
average). The controller clones a Blade-rendered `<template>` of the same
|
||||
review component, fills its slots with `textContent`, prepends it to the
|
||||
list, updates the count and average, and swaps the form for the thank-you.
|
||||
- **Validation errors:** 422 with `{ "errors": { … } }` (what
|
||||
`$request->validate()` already returns for a JSON request), filled into the
|
||||
form's existing error slots, with `aria-invalid`. No session `old()`/`$errors`.
|
||||
- Remove `session('reviewSubmitted')` from `product/show.blade.php`,
|
||||
`old()`/`$errors` from `review-form.blade.php`, and
|
||||
`mergeJustSubmittedReview` and the `justSubmittedReview` flash from the
|
||||
@@ -231,6 +272,10 @@ ### A8. Back/forward cache eligibility (S)
|
||||
|
||||
### A9. Speculation Rules (S)
|
||||
|
||||
> **Updated 2026-11-06:** use `prefetch`, not `prerender` (see "Changed on
|
||||
> 2026-11-06"). The rest of this task stands; once Turbo Frames are gone, the
|
||||
> Frame-link exclusions can go too.
|
||||
|
||||
- In the layout, a `<script type="speculationrules">` with `prerender`,
|
||||
`eagerness: "moderate"` (hover or press), for same-origin links.
|
||||
- **Exclude:** cart, checkout, account, login, logout (it's a POST, but
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
# Front-end Guidelines
|
||||
|
||||
This is a Laravel 12 e-commerce project using Lunar PHP (headless). These guidelines apply to all front-end work.
|
||||
This is 3dealer.gr, a boboko shop: Laravel 12 + Lunar, on top of the shared `boboko/core` package. These guidelines apply to all front-end work.
|
||||
|
||||
> **These rules are moving into the `boboko` Claude Code plugin** (re-skills marketplace), so every boboko shop shares them. Once it's enabled here, this file keeps only 3dealer's own facts (Greek register, fonts, brand). Until then, this file is the reference.
|
||||
>
|
||||
> **Direction of the work in progress:** read [CACHING-TRANSITION.md](CACHING-TRANSITION.md) before touching catalogue pages, the header, the layout or any form.
|
||||
|
||||
---
|
||||
|
||||
@@ -16,35 +20,36 @@ ## Project Language Settings
|
||||
|
||||
## Localization
|
||||
|
||||
Uses classic Laravel localization (https://laravel.com/docs/13.x/localization) — no third-party i18n routing package.
|
||||
**Locales** come from Lunar's languages table (the admin's **Languages** resource), not from config: Greek (`el`) is the default, English (`en`) is secondary. How it works: `vendor/boboko/core/docs/localization.md`.
|
||||
|
||||
**Locales:** Greek (`el`) is primary/default, English (`en`) is secondary. Set in `config('app.available_locales')` (`config/app.php`).
|
||||
**URL structure:** every storefront route is prefixed with `{locale}`, including the default: `3dealer.gr/el/...` and `3dealer.gr/en/...`. A URL without a valid locale (including bare `/`) is redirected by core's `locale` middleware to the visitor's best `Accept-Language` match, else the default language. That redirect varies per visitor, so it must never be cached. Prefixing every locale keeps hreflang symmetrical and scales cleanly to a third language.
|
||||
|
||||
**URL structure:** every route is prefixed with `{locale}`, including the default — `3dealer.gr/el/...` and `3dealer.gr/en/...`. Bare root (`/`) 301-redirects to `/el` (see `routes/web.php`). This avoids the ambiguity of an unprefixed default locale (see the reasoning in project memory / past conversation — prefixing every locale keeps hreflang symmetrical and scales cleanly to a third language later).
|
||||
|
||||
**URL slugs are the same across both locales, permanently** — e.g. `/el/products/{x}` and `/en/products/{x}`, not `/el/proionta/{x}` vs `/en/products/{x}`. This is a deliberate, standing decision for this project, not a placeholder to revisit later. Only the visible content is translated, not the slug. Do not introduce per-locale translated slugs (e.g. a `lang/{locale}/routes.php` segment map) unless the user explicitly asks for that to change.
|
||||
**URL slugs are the same across both locales, permanently**: `/el/products/{x}` and `/en/products/{x}`, not `/el/proionta/{x}` vs `/en/products/{x}`. This is a deliberate, standing decision, not a placeholder to revisit later. Only the visible content is translated, not the slug. Do not introduce per-locale translated slugs unless the user explicitly asks for that to change. (Catalogue URLs are moving to id + ASCII slug, `/el/products/123-blue-vase`, once core supports it; until then they use bare ids.)
|
||||
|
||||
**How it's wired:**
|
||||
- All routes live inside `Route::prefix('{locale}')->where('locale', ...)->middleware('setlocale')` in `routes/web.php`.
|
||||
- `App\Http\Middleware\SetLocale` validates the `{locale}` segment (404s if not in `available_locales`), calls `App::setLocale()`, and shares `$currentLocale`, `$altLocale`, and `$altLocaleUrl` (the same page in the other locale) to every view — this is what powers both the header's language switcher and the `<head>` hreflang tags in `resources/views/layouts/app.blade.php`. Don't recompute this logic elsewhere; read those shared variables instead.
|
||||
- When adding a new route, put it inside that `{locale}` group and give it a route `name()` — the alt-locale URL generation in the middleware depends on the current route being named (falls back to the locale root if unnamed).
|
||||
- When linking to a page in Blade, prefer `route('name', [...])` (locale is a normal route param, defaults to `app()->getLocale()` implicitly via the shared route group) over hand-built path strings, except for pages that don't have a controller/route yet (e.g. `/products`, `/contact`, `/cart` placeholders in the header currently use `url('/'.app()->getLocale().'/products')` — replace with `route()` once those pages exist).
|
||||
- **Every controller action for a route inside the `{locale}` group must declare `$locale` as its first parameter, even if unused** — e.g. `show(string $locale, Product $product)`. Laravel's `ControllerDispatcher` ultimately calls the controller with `...array_values($parameters)`, i.e. **positionally**. If a route-bound model parameter (like `$product`) isn't preceded by a matching `$locale` parameter in the method signature, the resolved values shift out of position and the wrong value (the locale string) gets passed where the model was expected — a `TypeError` that's easy to misread as a binding failure. Closures with zero declared parameters are unaffected (PHP just ignores the extra positional arg), so this only bites real controller methods.
|
||||
- Storefront routes live inside `Route::prefix('{locale}')->middleware('locale')` in `routes/web.php`. `locale` is core's `Modules\Core\Localization\Middleware\LocaleMiddleware`.
|
||||
- The middleware sets the app locale and shares `$currentLocale` (e.g. `el`) and `$altLocales` (a collection of every *other* language: `code`, `name`, `url` of the same page) with every view. That's what powers the header's language switcher and the `<head>` hreflang tags in `resources/views/layouts/app.blade.php`. Don't recompute this; read those shared variables.
|
||||
- When adding a new route, put it inside that `{locale}` group and give it a `name()`: the alternate-language URLs are generated from the current route's name (an unnamed route falls back to the other language's home page).
|
||||
- When linking in Blade, use `route('name', [...])`, never hand-built paths. Inside the group the locale is filled in automatically.
|
||||
- **Every controller action for a route inside the `{locale}` group must declare `$locale` as its first parameter, even if unused**, e.g. `show(string $locale, Product $product)`. Laravel's `ControllerDispatcher` calls the controller with `...array_values($parameters)`, i.e. **positionally**. If a route-bound model parameter (like `$product`) isn't preceded by a matching `$locale` parameter, the values shift and the locale string lands where the model was expected: a `TypeError` that's easy to misread as a binding failure. Closures with zero declared parameters are unaffected, so this only bites real controller methods.
|
||||
|
||||
**Where translatable strings go:**
|
||||
- Most UI copy is editable by the client/marketing team via **Stoic** (the headless CMS) — don't hardcode it here.
|
||||
- Small strings that don't need client editing (nav labels, aria-labels, tab labels, pluralized counts) go in Laravel's own lang files at **`lang/{locale}/*.php`** (project root, per Laravel 12+ convention — not `resources/lang`). Current file: `lang/el/general.php` / `lang/en/general.php`. Use `__('general.key')` or `trans_choice('general.key', $count, [...])` for pluralized strings.
|
||||
- Page copy the client edits (home sections, FAQ, legal pages) comes from **Stoic** (the headless CMS). Don't hardcode it.
|
||||
- UI labels (nav, buttons, aria-labels, tab labels, pluralized counts) are **`__('storefront.key')`** keys stored in the database as **Language Lines** (`spatie/laravel-translation-loader` through boboko/core), editable in the admin (Settings → Language Lines). Use `trans_choice('storefront.key', $count, [...])` for plurals. **Never add `lang/` files** for storefront strings.
|
||||
- The defaults ship with core (`StorefrontTranslationsSeeder`). A key you add in the admin must also get into core's seeder (`php artisan boboko:translations:pull` in local mode; `bin/deploy` checks this), or other environments show the raw key.
|
||||
|
||||
---
|
||||
|
||||
## Tech Stack
|
||||
|
||||
- **Laravel 12** + **Lunar PHP 1.3** (headless e-commerce)
|
||||
- **Laravel 12** (moving to 13) + **Lunar 1.5** through `boboko/core` (exact versions: core's `composer.json`)
|
||||
- **Postgres**, **Meilisearch** (catalogue and search), **Docker**, **Caddy** in front of PHP-FPM
|
||||
- **Blade** for templating (`@extends`, `@section`, `@yield`, components)
|
||||
- **Tailwind CSS v4** via `@tailwindcss/vite` — zero config, `@import 'tailwindcss'` only
|
||||
- **Stimulus JS** for interactivity — controllers registered in `resources/js/stimulus/index.js`
|
||||
- **Stimulus JS** for interactivity — controllers registered in `resources/js/stimulus/index.js`; core's controllers come from `@boboko/core` (`registerCheckout`, `registerWishlist` in `app.js`), never copied
|
||||
- **No Turbo.** Normal page navigation, plus Speculation Rules and View Transitions. Turbo is still installed and used in places (listing/search Frames, review Streams); don't add to it, and replace it when you rework that code (see CACHING-TRANSITION.md)
|
||||
- **Popover API** (native browser) for overlays — no JS overlay libraries
|
||||
- SQLite database, `npm run dev` for local asset compilation
|
||||
- Local dev runs in Docker (`bin/dc`, or `bin/dc-core.sh` with a local boboko-core checkout: see `bin/core-mode`)
|
||||
|
||||
---
|
||||
|
||||
@@ -65,14 +70,6 @@ ## Key File Locations
|
||||
|
||||
---
|
||||
|
||||
## Design Reference
|
||||
|
||||
The Bluebeard template (`resources/css/bluebeard.css`) is used as a **reference only** for colors, spacing, typography, and effects. It is never imported or used directly. Everything is translated to Tailwind utilities or custom CSS where unavoidable.
|
||||
|
||||
The boboko project at `/Users/farenoubi/Projects/boboko-test` can be referenced for CSS architecture patterns.
|
||||
|
||||
---
|
||||
|
||||
## Tailwind vs. Custom CSS
|
||||
|
||||
**Prefer Tailwind utilities by default.** Write custom CSS only when something genuinely cannot be expressed as a utility:
|
||||
@@ -103,31 +100,15 @@ ## Design Tokens
|
||||
|
||||
## Component Structure
|
||||
|
||||
### `resources/views/components/ui/` — atomic, reusable UI elements
|
||||
### `resources/views/components/ui/`: atomic, reusable UI elements
|
||||
|
||||
Single-purpose, stateless or minimally stateful elements used across many contexts:
|
||||
Single-purpose, stateless or minimally stateful elements used across many contexts: button, input, field, icon, badge, tabs, dropdown, pagination…
|
||||
|
||||
- `button.blade.php` ✓
|
||||
- `input.blade.php`
|
||||
- `input-group.blade.php`
|
||||
- `icon.blade.php`
|
||||
- `image.blade.php`
|
||||
- `tabs.blade.php` / `tab.blade.php`
|
||||
- `accordion.blade.php`
|
||||
- `tooltip.blade.php`
|
||||
- `badge.blade.php`
|
||||
- etc.
|
||||
### `resources/views/components/`: section-level or composite components
|
||||
|
||||
### `resources/views/components/` — section-level or composite components
|
||||
Larger reusable blocks made of several elements, often with real content: header, footer, product card, review form…
|
||||
|
||||
Larger reusable blocks made of several elements, often with real content:
|
||||
|
||||
- `header.blade.php` ✓
|
||||
- `footer.blade.php`
|
||||
- `cta.blade.php`
|
||||
- `product-card.blade.php`
|
||||
- `contact-section.blade.php`
|
||||
- etc.
|
||||
**Check before you create.** Look in `components/ui/` and in core's views (`vendor/boboko/core/resources/views`) first, and extend an existing component with a prop rather than duplicating it.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -27,3 +27,21 @@ ## Product custom fields
|
||||
- **Photos are cleaned up automatically.** Photos never added to a cart are deleted by `custom-fields:prune-uploads` (see above). A photo on a cart line is kept as long as that cart line exists, and a photo on an order is kept indefinitely.
|
||||
- **Products with custom fields can't be quick-added.** On product cards, the "add to cart" button becomes a link to the product page.
|
||||
- Field labels are entered once in the admin and aren't translated, so they appear as entered in both `/el` and `/en`.
|
||||
|
||||
## Known issues
|
||||
|
||||
Found 2026-11-06 while setting up the `boboko` Claude Code plugin. Remove an entry once it's fixed.
|
||||
|
||||
- **Storefront labels aren't seeded on boot.** `docker/entrypoint.sh` runs the `checkout` and
|
||||
`validation` translation seeders, but not `StorefrontTranslationsSeeder`, so new
|
||||
`storefront.*` keys released in core never reach an environment by themselves. Fix: add it
|
||||
next to the other two.
|
||||
- **About 20 `storefront.*` keys exist only in this shop's database**, not in core's seeder:
|
||||
all `footer.*` and `errors.*`, `nav.faq`, `nav.menu`, `search.no_results`,
|
||||
`search.results_count`, `shop.filters`, `contact.privacy_notice`. A fresh environment shows
|
||||
them as raw keys. Fix: `bin/core-mode local`, then
|
||||
`bin/dc-core.sh exec app php artisan boboko:translations:pull`, then commit and release core.
|
||||
- **Home hero carousel images (LCP).** In `resources/views/home.blade.php`, every slide gets
|
||||
`loading="eager"` and `fetchpriority="high"` (only the first visible one should), the
|
||||
`preload="…"` attribute on `<img>` does nothing (preloading is a `<link>` in `<head>`), and
|
||||
there's no `srcset`/`sizes` or `<head>` image preload.
|
||||
Reference in new issue
Block a user