15 KiB
Caching transition: context and first tasks (for Claude)
Temporary roadmap. Delete this file once the caching transition is done; it's only needed while the work is in progress.
Written 2026-11-02 from a planning session in boboko-research, updated the
same day with the team's decisions. Read this before working on the tasks
below. Front-end conventions are still in CLAUDE.md, and that
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)
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.
boboko-core is paused (the backend developer is on leave). Only do the tasks below that don't need core. A0 waits until core work resumes.
Where we're going
Every catalogue page becomes the same HTML for every visitor, cached (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.
- Cacheable routes (home, category, product,
/products, FAQ, legal pages) will run without a session: no cookies, no CSRF token, noauth(), no flash, noold(), 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.
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.
- 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).
- 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
<template>(Meilisearch track M1–M6, not in this list). - URLs become id + slug (
/el/products/123-blue-vase), core C7 first, then A10 here (not in this file). view:cachewas commented out by mistake (A6).
Where 3dealer is today (personal state found in catalogue pages)
| What | Where | Handled by |
|---|---|---|
auth()->check() branching (4 places) |
resources/views/components/header.blade.php |
A2 |
| Cart badge count | header, data-cart-count-target="badge"; primed from the drawer's server-rendered count |
A1 (placeholder), core C2/C3 (content) |
| Cart drawer body rendered on every page | @include('checkout::drawer') in layouts/app.blade.php (view lives in boboko-core) |
core C3, not here |
| Wishlist heart state | components/wishlist-button.blade.php calls WishlistService::has() |
A3 (target only), core C3 (state) |
Review flash, old(), $errors, mergeJustSubmittedReview |
product/show.blade.php, components/review-form.blade.php, ProductController |
A4 |
@csrf in forms + <meta name="csrf-token"> |
add-to-cart (core), wishlist, review, newsletter, layout | Later (CS1 in core, CS2 here, after Laravel 13 and core C2). Leave as is |
Stoic staff embed (@auth('staff')) |
layouts/app.blade.php |
Core C2 (via islands), not here. Stoic itself may be dropped later |
Other facts worth knowing:
- Turbo is installed, but Drive is off (
window.Turbo.session.drive = falseinresources/js/app.js). Only Frames are used. Keep it off: that's now decided. - 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. - Product reviews have no moderation: they go live immediately. The index
update is async, which is why
mergeJustSubmittedReviewexists. - URLs use numeric ids (
/products/{id}). Don't change routes in these tasks; that's A10, after core C7.
Rules for this work
- 3dealer only. Don't edit
vendor/boboko/coreor../boboko-core. If a task turns out to need a core change, stop and write down what's needed instead (core tasks are planned separately intasks.md). - The site must keep working exactly as today after each task. These tasks prepare the page; they don't switch on caching.
- Only the tasks in this file (A1–A9, W1; A0 once core resumes). The other decided work (page cache, Meilisearch in the browser, URLs) needs core first and has its own tasks and order.
- Follow the
{locale}controller rule in CLAUDE.md ($localeis the first parameter). - UI strings: reuse existing
storefront.*keys where possible. New keys are DB-backed Language Lines: use theboboko-translationsskill, neverlang/files.
Tasks to work on now
A0. Laravel 13 (S, waits for core C0: skip for now)
Only once boboko-core has a tagged release that allows laravel/framework ^13. Until then, skip it and do the others.
- Bump
laravel/frameworkto^13.0and updateboboko/coreto that release. Lunar stays on 1.5.0. - Go through the Laravel 13 upgrade guide for app code (config, middleware in
bootstrap/app.php, anything deprecated), and note what changed around CSRF (theSec-Fetch-Siteorigin check) for later tasks CS1/CS2. - Click through: home, category, product, search, cart drawer, checkout with Stripe test mode, account, login/logout, the admin panel.
- Done when:
composer.lockis on Laravel 13, the tests pass, and the click-through shows nothing broken.
A1. Cart badge as a fixed-size placeholder (S)
- The badge in
components/header.blade.php(data-cart-count-target="badge") isabsoluteinside the button, so its appearance probably doesn't shift the layout. Verify on mobile and desktop widths (CLS: no movement of the header or icons when the count appears or changes, including 1 → 2 digits). - Give it a stable
id(e.g.cart-badge) so a Turbo Stream can target it. - Keep
cart-count-controller.jsworking as today (it listens forbbk-cart:updated). - Rule to record in a comment: no island may change the size of its container.
- Done when: a stable id exists, behaviour is unchanged, and no layout shift is measurable.
A2. Header links that don't depend on login (S)
- The account icon always links to
route('account'). Theauthmiddleware already redirects guests to login (redirectGuestsToinbootstrap/app.php). - The wishlist icon always links to
route('wishlist'). MakeWishlistController::guestredirect logged-in users toaccount.wishlist. - One neutral aria-label for the account link (
storefront.nav.account) instead of switching to the login label. - Both the desktop and mobile parts of the header (≈ lines 50–62 and 175–189).
- Done when:
header.blade.phpcontains noauth()call, and guests and logged-in users still end up on the right pages.
A3. Stable island targets in the markup (S)
x-wishlist-button: adddata-wishlist-product="{{ $productId }}"on the form root. Keep the current server-sidearia-pressedstate for now (core will move it to islands later).- The account link: a stable
id(e.g.header-account-link) on both the desktop and mobile versions, or one shared attribute selector. <meta name="csrf-token">in the layout: a stableid(e.g.csrf-token).- Done when: each personal element has a stable selector, with no visible change.
A4. Review submission without a redirect (M)
Today ProductController::storeReview validates, creates a ProductReview,
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 withTurbo.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. - Remove
session('reviewSubmitted')fromproduct/show.blade.php,old()/$errorsfromreview-form.blade.php, andmergeJustSubmittedReviewand thejustSubmittedReviewflash from the controller. - Keep
searchableSync(). - No-JS fallback: a plain POST may still redirect back to the product page. That fallback may lose inline errors, which is acceptable.
- Accessibility: announce the result in a live region, and move focus to the thank-you message or the first invalid field.
- Leave the
?tab=reviewsquery parameter alone for now, but note it: it's a query-string variant of the product page, which matters once pages are cached. - Done when: a submitted review appears immediately without a page load, errors show inline, and nothing on the product page reads the session.
A5. Test for personal state on catalogue pages (S)
- A feature test (in this repo's existing
tests/setup) that renders home, a category, a product,/products, FAQ and the legal pages as a guest, and asserts the HTML has no per-visitor content. - Start with assertions that pass after A2–A4 (no
auth()-dependent markup, no review flash/old input), and mark the rest as expected failures/skipped with a reason: the drawer cart body and wishlist state (core C3), the CSRF token (CS1/CS2), and the Stoic staff embed (core C2). - It will need seeded catalogue data, or Meilisearch mocked through
ProductService. Check how the app can be booted in tests first, and say so if that's harder than an S. - Done when: the test runs in CI/locally, passes for what's done, and lists what's still missing.
A6. Turn view:cache back on in the deploy (S)
- In
Envoy.blade.php(artisan_optimizetask), uncomment theview:cacheline and give it the same< /dev/nullas its neighbours. - First run
php artisan view:cachelocally (in the app container). It compiles every view, vendor ones included, so a broken view that is never rendered would now fail the deploy. Fix or remove any that fail. - Done when:
view:cacheruns cleanly locally and is in the deploy.
A7. Cross-document View Transitions (S)
- Add
@view-transition { navigation: auto; }to the CSS, inside@media (prefers-reduced-motion: no-preference)so it's off for visitors who ask for less motion. - Check in Chrome that the header, the cart drawer and the cookie banner
don't flash or jump during a transition. If the default cross-fade looks
wrong on some element, give it a
view-transition-nameor exclude it; keep it minimal. - Browsers without support just navigate normally. Turbo Frame listing updates aren't document navigations, so they're unaffected.
- Done when: page changes cross-fade in Chrome, nothing else changes visibly, and reduced-motion turns it off.
A8. Back/forward cache eligibility (S)
- In Chrome DevTools → Application → Back/forward cache, run the test on
home, a category, a product and
/products, as a guest and logged in. - Fix every blocker it reports that lives in 3dealer:
unloadlisteners (ours or a third-party script's),Cache-Control: no-storeon catalogue pages, open connections. Usepagehideinstead ofunloadwhere something needs to run on leave. - Known gap, not here: a restored page shows the cart as it was. Core's
C2 refreshes on
pageshowwithevent.persisted. Just note it. - Write down any blocker that only core or a vendor script can fix.
- Done when: the DevTools test reports "restored from back/forward cache" on those pages, or each remaining blocker is listed with its owner.
A9. Speculation Rules (S)
- In the layout, a
<script type="speculationrules">withprerender,eagerness: "moderate"(hover or press), for same-origin links. - Exclude: cart, checkout, account, login, logout (it's a POST, but
exclude the path anyway), wishlist,
/islands(future), links withrel~=nofollow, links inside the Turbo Frame listing controls (filters, sort, pagination: those load into the frame, not as a new page), and anything markeddata-no-prerender. Usewherewithhref_matches/selector_matches. - Check that GA4 and the consent banner count a page view only when the
prerendered page is actually shown (DevTools → Application → Speculative
loads lets you inspect a prerendered page). If one doesn't, delay it on
document.prerendering/prerenderingchange. - Until pages are cached, each prerender is a full PHP render with 8 FPM workers. Mention it in the commit message so production FPM is watched after the deploy.
- Done when: hovering a product or category link in Chrome prerenders it (visible in DevTools), excluded links don't, and analytics counts are unchanged.
W1. Caddy instead of nginx (M)
- Today:
docker/nginx/default.conf(dev) andprod.conf(prod, with the FastCGI cache block),nginxservice indocker-compose.yml. - A Caddy image built with
xcaddy, including thecaddy-ratelimitmodule (needed later for the search subdomain M3 and rate limits F7). Pin the Caddy and module versions. - Caddyfile:
php_fastcgito the app container, static assets frompublic/with the same long cache headers nginx sends, compression (zstd/gzip), the same security headers, the same upload size limit, the/uphealth check. Copy each rule over deliberately; list anything you drop and why. - No page cache in Caddy and no FastCGI-style cache: the static page cache comes later (P2).
- TLS: find out first how it ends today (a host proxy, Cloudflare, or the container). Don't switch on Caddy's automatic TLS until that's clear; ask if it isn't findable in the repo or Envoy.
- Dev stays usable (
docker compose upworks, Vite still proxied as today). - Remove the nginx files and service once Caddy works. boboko-test and the starter are separate repos: note them, don't edit them.
- Done when: dev and a production-like local run serve every page,
asset, upload and the admin panel through Caddy, response headers match
today's (compare
curl -Ion a few URLs before and after), and no nginx config is left in this repo.
Suggested order
- A1 → A3 → A2 (small header/markup work, one commit each).
- A6, A7, A8, A9 (small, independent; one commit each).
- A4, then A5 (the test confirms A2–A4).
- W1.
- A0 only once core C0 is tagged.