How jorgenortes/laravel-splade works
Overall Project Scope and Purpose
• That this is not a full-blown full-stack separate frontend and backend system, but rather a Laravel package (Laravel Splade) that “magically” turns Blade views into an SPA-like experience.
• The README emphasizes features such as seamless server-side routing paired with interactive Vue components, built-in support for modals, form components, lazy loading, event handling (like redirects, toast notifications via Laravel Echo), SSR support, and more.
Main Components
a. Laravel Backend (Server-side):
• Controllers: In the “app/app/Http/Controllers” directory are various controllers handling different parts (forms, files, navigation, etc.).
• Models & Eloquent: The “app/app/Models” directory shows core domain models.
• Routing & Middleware: With “app/routes” and middleware configurations in “app/app/Http/Middleware” showing the flow of HTTP requests.
• Service Providers & Configuration: “app/app/Providers”, “config/”, and “app/bootstrap” indicate Laravel’s dependency injection and configuration bootstrapping.
• Artisan Commands: Both under “src/Commands” and the “artisan” file, which handle installation, testing, and maintenance tasks.
• Database Layer: Migrations, seeders, and factories (within “app/database”) reflect how data is structured and stored.
b. Frontend Presentation Layer:
• Blade Templates: The “resources/views” (and corresponding “app/resources/views”) directories present the Blade views that this package leverages.
• Vue 3 Components: The “lib/Components” directory (as well as “app/resources/js”) shows a large set of Vue components (like Modal, Toast, Table, etc.) that are integrated within Blade templates.
• Asset Pipeline: The “package.json”, “vite.config.js”, and “tailwind.config.js” files manage the front-end build tools and CSS frameworks (Tailwind CSS).
• SSR (Server-Side Rendering) Support: Files like “app/resources/js/ssr.js” and “lib/server.js” indicate that there is an SSR mechanism to render Vue components on the server.
c. Integration and Communication:
• Blade Vue Bridge: The design should highlight how the backend-rendered Blade views are enriched with Vue components dynamically. This is accomplished via special Blade components (found both in “app/resources/views/components” and “lib/Components”) that manage state and interactivity.
• Event Handling & Notifications: Representation of events (Redirect, Toast, etc.) flowing from backend processes (possibly triggered by controllers or middleware) to the client, aided by components and Laravel Echo integration.
• Table Rendering & Datagrid: Notice the “app/app/Tables” and “src/Components/Table.php” directories. Include a segment showing how table data flows from Eloquent models via controllers to interactive Tables on the frontend.
Relationships & Interactions
• Request → HTTP Kernel (middleware chain)
• Routes → Controllers → Models (data access) → Views (rendered as Blade template)
• How controllers or service providers inject functionality like lazy loading, modals, and file uploads into views.
• Interplay between the server-rendered HTML and the dynamic Vue components that receive updates (with SSR or client-side activation after initial load).
• Integrations with external systems (e.g., broadcasting via Laravel Echo for real-time notifications).
Architectural Patterns and Design Principles
• MVC Pattern: Clearly separate the responsibilities of Models, Views, and Controllers.
• Event-Driven Architecture: Represent the event flow (e.g., RedirectEvent, ToastEvent) within the system that allows backend processes to influence frontend behavior.
• Plugin/Component-Based UI: Emphasize the integration of reusable Vue components within the Blade environment.
• Modularization: The separation between the “app” (Laravel application), “src” (core package code), and “lib” (Vue and JS components) should be clearly distinguished.
Relevant Technologies, Frameworks, and Libraries
• Laravel (PHP framework) – the backbone of the server-side application.
• Blade Templating Engine – used for server-side view rendering.
• Vue 3 – powering the interactivity on the client side.
• Tailwind CSS – for frontend styling (with default styling available in some components).
• Vite – for the asset bundling and development server.
• Laravel Breeze (if used) – as mentioned in the README for starter kit integration.
• Laravel Echo – for processing real-time events from the backend.