Skip to content

Frontend

Capell Frontend resolves public requests and renders published pages. It owns site/page loading, layout/theme context, frontend settings, cache-aware rendering, public HTML safety, and package-facing frontend hooks.

Status: Available · Package: capell-app/frontend

  1. Resolve the current site from the request host and configured fallback rules.
  2. Resolve the language and page URL for that site.
  3. Load the page, layout, theme, page type, translations, and render variables before Blade receives the view.
  4. Render the public page through frontend components, render hooks, media helpers, and registered assets.
  5. Apply cache headers, ETags, static cache integration, and minification when configured.

Public Blade views should receive hydrated render data. Do not query models, lazy-load relationships, or fetch package state from public views.

Anonymous users, signed-in non-admin users, crawlers, cached HTML, and static exports must never receive authoring markers, model IDs, field paths, permissions, package names, selectors, signed editor URLs, or editor scripts.

In-page editing belongs to capell-app/frontend-authoring. It decorates the page only after an authenticated admin beacon response.

Use the public HTML safety contract when changing rendering, themes, cache output, render hooks, or frontend package views.

NeedUse
Inject public HTMLRenderHookRegistry::register(RenderHookLocation::..., ...).
Register frontend widgetsWidgetRegistry::register($name, WidgetTarget::FrontendBlade, $component).
Register Livewire frontend widgetsWidgetRegistry::register($name, WidgetTarget::FrontendLivewire, $component).
Add CSS/JS source pathsTailwindAssetsRegistry::registerSource(...) and registerImport(...).
Invalidate pages for model changesCacheInvalidationRegistry::registerDependency(...).
Render media safelyUse the Capell media helpers/components and pass localized alt text from prepared data.

Render hooks are for small, safe additions. If a package needs a major page region, add an explicit frontend component or package view instead of hiding large behavior in a hook.

Capell works through Laravel routes without web-server rewrites. For static HTML cache performance, configure Nginx or Apache to check generated cache files before PHP and to fall back to Laravel when no cache file exists.

Keep these rules in deploy docs, not inside themes:

  • static cache directory is served as ordinary public HTML
  • PHP fallback still works when cache files are missing or stale
  • lockdown/maintenance responses must bypass stale static pages
  • cache files must stay safe for anonymous visitors

Packages should register Tailwind sources and imports in PHP registration code. Do not ask app developers to manually copy package paths into every project unless the package genuinely cannot register itself.

For local package development, unresolved vendor CSS imports usually mean Vite cannot resolve a symlinked dependency. Run the package-owned asset report command when available, then install missing npm dependencies or add a narrow Vite alias.

Use focused tests around frontend behavior:

  • route resolves the expected site/page/language
  • public responses contain expected content
  • anonymous/non-admin HTML does not contain authoring controls or internal identifiers
  • cache headers and ETags match the configured behavior
  • render hooks add only the intended HTML
  • public Blade does not rely on lazy-loaded relationships

For public-output safety, assert absence as well as presence.

Use sinnbeck/laravel-dom-assertions when the element, region, attribute, or repeated component count matters. App/theme tests can request seeded public pages directly; package tests can use factories when they need to own the fixture. The frontend package guide has copy-pasteable examples.

NeedRead
Understand the render pipelineFrontend guide
Resolve site/page/language loadingPage and site loading
Configure server fallback and static cache rulesServer config
Register render hooksRender hooks
Register package Tailwind assetsTailwind assets
Render media safelyMedia rendering
Add frontend widgetsWidgets
Build interactive widget and fragment targetsCapell Interactions
Support Blaze templatesBlaze support
Test public outputFrontend testing
Debug public output or cache bypassesDebugging public output
FeaturePackage
Default frontend themecapell-app/foundation-theme
In-page authoringcapell-app/frontend-authoring
XML sitemaps and discovery pagescapell-app/site-discovery
SEO metadata and auditscapell-app/seo-suite
Static HTML cachecapell-app/html-cache
Site searchcapell-app/search

Use Operations for production cache and stale-output troubleshooting.