shabeer-dev / filament-headless
Headless CMS and Inertia React architecture toolkit and CLI generator for Laravel and Filament v5
Requires
- php: ^8.4
- filament/filament: ^4.0|^5.0
- happenv-com/filament-translatable: ^4.0
- illuminate/console: ^11.0|^12.0|^13.0
- illuminate/filesystem: ^11.0|^12.0|^13.0
- illuminate/support: ^11.0|^12.0|^13.0
- laravel/prompts: ^0.1|^0.2|^0.3
- spatie/laravel-medialibrary: ^11.0
- spatie/laravel-translatable: ^6.0
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
A modular, turnkey toolkit and CLI generator for building high-performance, multilingual websites using Filament v5 as a Headless CMS and Inertia.js v3 + React 19 as the decoupled frontend, fully aligned with Laravel Boost MCP & Guidelines.
ποΈ Architecture Overview
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Filament v5 Admin Panel β
β β’ Singleton Resources (No Table Views; direct-to-edit for ID 1) β
β β’ Pure Modular Block Builder (Drag, drop, and reorder sections) β
β β’ Spatie Translatable + Happenv (In-place Tabbed Locale Switcher) β
β β’ Real-Time Google SERP & OpenGraph Social Card Live Previews β
βββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
β Saves JSON & Media
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Laravel 13 Content Engine & Caching β
β β’ SerializesLocalizedStrings Trait (Flattens JSON into active locale)β
β β’ ContentObserver: Automatically purges cache across all locales β
β β’ ContentPageController: Cache::rememberForever with locale keys β
βββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
β Hydrates Inertia Payload
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Inertia.js v3 + React 19 Frontend β
β β’ AppLayout: RTL / LTR dynamic direction based on active locale β
β β’ BlockRenderer: Dynamic section dispatcher (<BlockRenderer />) β
β β’ Laravel Wayfinder: Type-safe route functions (@/routes, @/actions) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β‘ Key Highlights
- Singleton Page Pattern: Eliminates confusing data tables for website pages (Home, About, Services, etc.). Clicking a page navigates directly to its singular edit form.
- Pure Modular Block Builder: Construct dynamic pages where admins can add, reorder, and remove blocks freely using Filament's
Buildercomponent. Rendered on the frontend via a dynamic React<BlockRenderer />. - Laravel Boost MCP & Skill Integration:
- Automatically synchronizes with
boost.json(filament/filament,spatie/laravel-medialibrary,spatie/laravel-translatable). - Registers the
headless-architectureskill inboost.jsonand.agents/skills/. - Harmonizes guidelines in
GEMINI.mdandAGENTS.mdso Boost-aware LLMs respect the architecture.
- Automatically synchronizes with
- Pest 4 Feature Test Generation:
php artisan headless:make-pageautomatically scaffolds feature tests (tests/Feature/Pages/{Name}PageTest.php) asserting localized 200 HTTP responses, Inertia component rendering, and cache invalidation in accordance with Boost testing rules. - Interactive Prompts Installer: Powered by
Laravel\Promptsfor an interactive CLI setup wizard (language multi-selection, default locale, starter pages). - System Diagnostics Doctor:
php artisan headless:doctorvalidates PHP extensions, public storage symlinks, Spatie media tables, Wayfinder routes, Boost sync, and Pest configuration. - Configurable Multi-Language Engine: Centralized in
config/headless-kit.php. Add or remove languages without touching PHP or React code. - Dynamic RTL / LTR Support: Automatically detects right-to-left languages (Arabic, Hebrew, Farsi, Urdu) and adjusts layout direction.
- Real-Time SERP & Social Previews: Live Google search snippet and Twitter/Facebook OpenGraph card simulation directly inside the Filament admin form with live character count analysis.
- Architecture Linter:
php artisan headless:lintaudits content models, Filament resources, and React pages to enforce architectural purity and catch drift. - AI Agent Context Generator:
php artisan headless:agent-contextcompiles a real-time Markdown ground-truth digest (.agents/headless-context.md) for LLM agents. - One-Command Scaffolding:
php artisan headless:make-page {Name}scaffolds all 7 layers of a page in seconds.
π Requirements
| Requirement | Supported Versions |
|---|---|
| PHP | ^8.4 |
| Laravel Framework | ^11.0 | ^12.0 | ^13.0 |
| Filament | ^5.0 |
| Inertia Laravel / React | ^2.0 | ^3.0 with React 19 |
| Tailwind CSS | ^4.0 |
π¦ Installation in Any Laravel Project
Install the package via Composer:
composer require shabeer-dev/filament-headless
Then run the interactive installer:
php artisan headless:install
The installer will prompt you to:
- Select supported languages (English, Arabic, Spanish, French, German, Chinese, etc.).
- Pick your default application language.
- Select starter pages to scaffold immediately (
Home,About,Services,Contact). - Automatically synchronize with
boost.jsonand inject guidelines intoGEMINI.md/AGENTS.md.
π οΈ CLI Commands & Generators
| Command | Purpose |
|---|---|
php artisan headless:install |
Run interactive wizard to publish config, base classes, layouts, rules, and sync Boost |
php artisan headless:doctor |
Run diagnostics (PHP, symlinks, media table, Wayfinder, Boost sync, Pest, Pint) |
php artisan headless:make-page {Name} |
Scaffold a complete 7-layer singleton page with section presets & Pest test |
php artisan headless:make-section {Page} {Name} |
Scaffold a modular section partial component and Filament schema snippet |
php artisan headless:make-block {Name} |
Scaffold a new Filament Builder block and matching React block component |
php artisan headless:lint |
Audit codebase to detect and prevent architectural drift |
php artisan headless:agent-context |
Generate real-time Markdown schema map for AI coding agents |
π§± Pure Modular Block Builder
Backend (Filament)
Allow editors to freely compose and re-order content using BlockCatalog::all():
use App\Filament\Blocks\BlockCatalog; use Filament\Forms\Components\Builder; Builder::make('blocks') ->label('Page Sections') ->blocks(BlockCatalog::all()) ->collapsible() ->cloneable()
Built-in blocks include:
hero: Title, highlighted text, badge, dual CTAs, background media.stats: Counter metrics band with target numbers and suffixes.bento_grid: Responsive multi-span feature cards with icons and badges.overview: Split 2-column text and media layout.faq: Collapsible questions and answers.cta: Full-width banner with target action.
Frontend (React)
Render any list of dynamic blocks with one line:
import BlockRenderer from '@/components/blocks/BlockRenderer'; export default function ServicesPage({ content }) { return <BlockRenderer blocks={content.blocks} />; }
π Multi-Language Configuration (config/headless-kit.php)
All supported languages, their native names, flags, and text directions are configured in a single place:
// config/headless-kit.php return [ 'locales' => [ 'en' => [ 'name' => 'English', 'native' => 'English', 'dir' => 'ltr', 'flag' => 'US', ], 'ar' => [ 'name' => 'Arabic', 'native' => 'Ψ§ΩΨΉΨ±Ψ¨ΩΨ©', 'dir' => 'rtl', 'flag' => 'AE', ], 'es' => [ 'name' => 'Spanish', 'native' => 'EspaΓ±ol', 'dir' => 'ltr', 'flag' => 'ES', ], ], 'default_locale' => env('APP_LOCALE', 'en'), 'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'), ];
π§ͺ Pest Feature Testing (Boost Standard)
Every page generated with php artisan headless:make-page comes with a ready-to-run Pest 4 feature test:
// tests/Feature/Pages/ServicesPageTest.php use Inertia\Testing\AssertableInertia as Assert; it('renders the services page successfully for default locale', function () { $response = $this->get('/en/services'); $response->assertStatus(200); $response->assertInertia(fn (Assert $page) => $page ->component('Services') ->has('content') ); });
Run tests with:
php artisan test --compact
π€ Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Format with Pint (
vendor/bin/pint) - Commit your Changes (
git commit -m 'feat: Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
π License
The MIT License (MIT). Please see License File for more information.