Download the PHP package hammerstone/sidecar-inertia without Composer
On this page you can find all versions of the php package hammerstone/sidecar-inertia. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hammerstone/sidecar-inertia
More information about hammerstone/sidecar-inertia
Files in hammerstone/sidecar-inertia
Package sidecar-inertia
Short Description A Laravel package to render Inertia apps on AWS Lambda.
License MIT
Informations about the package sidecar-inertia
Sidecar SSR for InertiaJS
🚨 This is currently very much in beta!
You can see a fully working Jetstream + Inertia + Sidecar demo repo at hammerstonedev/sidecar-inertia-demo.
Overview
This package provides a Sidecar function to run Inertia server-side rendering on AWS Lambda.
Sidecar packages, deploys, and executes AWS Lambda functions from your Laravel application.
It works with any Laravel 7 or 8 application, hosted anywhere including your local machine, Vapor, Heroku, a shared virtual server, or any other kind of hosting environment.
Enabling SSR
Following the official Inertia docs on enabling SSR is a good place to start, but there are a few things you can skip:
- You do not need to
npm install @inertiajs/server
- You do not need to
npm install webpack-node-externals
- Come back here when you get to the "Building your application" section
Make sure that inertia/laravel-inertia
is at least version 0.5.1
.
Installation
To require this package, run the following:
This will install Sidecar as well.
Using the Sidecar Gateway
Update your AppServiceProvider
to use the SidecarGateway
as the default Inertia SSR Gateway
Updating Configuration
Update your config/inertia.php
to include the Sidecar settings
Configuring Sidecar
If you haven't already, you'll need to configure Sidecar.
Publish the sidecar.php
configuration file by running
To configure your Sidecar AWS credentials interactively, you can run
The official Sidecar docs go into much further detail.
Now update your config/sidecar.php
to include the function shipped with this package.
Updating Your JavaScript
This only covers Vue3, please follow the Inertia docs for Vue2 or React, and please open any issues.
You'll need to update your webpack.ssr.mix.js
file. This should work for most cases, but please open any issues for errors you run into. (This is based on the Inertia docs, with slight modifications.)
And update your resources/js/ssr.js
to look something like this. The specifics may vary based on your application. If you're using Ziggy, you'll want to uncomment the Ziggy stuff. (This is based on the Inertia docs, with slight modifications.)
Deploying Your SSR Function
After you have added the SSR function to your sidecar.php
, you should run php artisan sidecar:deploy --activate
to
deploy your function.
This will compile your JavaScript for you as a beforeDeployment
hook, so you don't have to worry about remembering to do that first.
Debugging SSR
It's recommended that you deploy your Sidecar function locally so that you can test SSR more quickly. You can run php artisan sidecar:deploy --activate
from your local machine and your SSR function will be deployed to Lambda.
You can also set ssr.sidecar.debug
to true
in your config/inertia.php
file, so that Sidecar will throw exceptions when SSR fails instead of falling back to client-side rendering. This will help you diagnose issues quickly.
Ziggy (Optional)
If you are using Ziggy, you'll need to pass some Ziggy information along to your Lambda. You can do that by adding the following to your
HandleInertiaRequests
middleware.
All versions of sidecar-inertia with dependencies
hammerstone/sidecar Version ^0.3.9
inertiajs/inertia-laravel Version ^0.5.1|^0.6.0
illuminate/support Version ^8.0|^9.0