Bootstrap a cloud-native Laravel application with Jetstream support
Using laraboot
Preface
Laravel Jetstream is a starter kit for Laravel and provides a starting point for a Laravel application. Jetstream provides the implementation for the application's login, registration, email verification, two-factor authentication, session management, API via Laravel Sanctum, and optional team management features.
Although Laravel Jetstream requires NodeJS and PHP >= 8.0. On this occasion, we will bootstrap a Laravel application with Jetstream support using only laraboot CLI.
Install
We're going to need laraboot . Being an NPM CLI tool we're going to have to install it globally by running the npm
install command.
npm i -g @laraboot-io/cli
Create a project
laraboot new app --php-version=8.0.* && cd app
Include required build tasks
Jetstream support is provided by the task @core/laravel-starterkit-buildpack
. Let's add it to the mix and also add Paketo's NodeJs buildpack which take care of running all the npm
command for us during the buildtime.
laraboot task add @core/laravel-starterkit-buildpack \
--format=file -vvv
laraboot task add nodejs \
--imageUri=gcr.io/paketo-buildpacks/nodejs \
--format=external \
--prepend \
-vvv
Configure
Buildtask configurations occur through the buildpack.yml file, should be already there in your project's root if the project was bootstrapped by laraboot. In case the file is not there we have to create it manually.
The following is the configuration we will use. We had disabled Breeze and enabled Jetstream.
# buildpack.yml
# Enable Jetstream teams with livewire
laravel-starterkit:
# Jetstream configuration
jetstream:
enabled: true
teams: true
stack: livewire
# Breeze configuration
breeze:
enabled: false
stack: inertia
More information about the configuration of this task can be found here
Build
Build our custom Laravel application couldn't be easier than run the following command.
laraboot build -vvv
Run
After the build process is complete we end up with an OCI image called app
which you can either run locally or deploy to the cloud using your favorite cloud provider.
laraboot run --port=9000
Source code
Absolutely, check it out.