Implement inertia - #1
Open
proudhAteR wants to merge 11 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds Inertia.js protocol support (POC) to Zephyrus, allowing controllers to return modern frontend views directly from the backend:
How does it work
The first request renders an HTML shell, and subsequent Inertia requests receive the JSON page object used by the frontend adapter to render the right component with the right
props.
Why this is pertinent
Zephyrus already owns routing, controllers, middleware, validation, sessions, and rendering. Inertia fits that model well because it lets applications keep server-side routing and
data loading while using React, Vue, or Svelte for the view layer.
This avoids forcing users to build and maintain a separate API just to power client-rendered screens. It keeps Zephyrus applications closer to a server-driven monolith while still
enabling rich frontend interactivity.
What changed
$this->inertia(...).ApplicationBuilder::withInertia()andwithInertiaRenderer().Why Vite is needed
Inertia still needs a frontend entrypoint to boot the client adapter and resolve components. Vite gives Zephyrus applications a standard way to serve those frontend assets:
Inertia protocol coverage
Implemented in this PR:
Not included in this first pass / possible follow-ups:
Test coverage
Added focused unit coverage for the Inertia and Vite layers, including renderer behavior, middleware behavior, facade behavior, root view helpers, partial reloads, version
conflicts, redirects, Vite development tags, Vite production manifest loading, and Vite error cases.
Current coverage after this PR:
Verification
composer test
XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text --colors=never
Result:
Demo app
Created a demo Vue component to showcase what can be done using this integration (The whole component has been vibe coded)
https://github.com/proudhAteR/Zephyrus_Inertia_demo