Posts Learn Components Snippets Categories Tags Tools About

How to Run Ziggy Generate On Laravel Forge Deployment

Get to know how to run Ziggy Generate on Laravel Forge Deployment for your Inertia JS or any Vue and React front-end templating

Created on Jul 14, 2022


In this snippet you will learn how to run Ziggy Generate command on Laravel Forge. It's pretty simple and all you have to do is to have the command in the "Deployment Script".
php artisan ziggy:generate --url="${APP_URL}"
npm run build

Full code example is as follows.
cd /home/forge/
git pull origin $FORGE_SITE_BRANCH

$FORGE_COMPOSER install --no-interaction --prefer-dist --optimize-autoloader

( flock -w 10 9 || exit 1
    echo 'Restarting FPM...'; sudo -S service $FORGE_PHP_FPM reload ) 9>/tmp/fpmlock

if [ -f artisan ]; then
    $FORGE_PHP artisan migrate --force

php artisan ziggy:generate --url="${APP_URL}"
npm run build

One thing to note, don't forget to check the Make .env variables available to deploy script.
Laravel Forge Deployment Script

If you like our tutorial, do make sure to support us by being our Patreon or buy us some coffee ☕️


PostSrc Code Components

Collection of Tailwind CSS components for everyone to use. Browse all of the components that are right for your project.

View Components

Sponsors 👑

+ Add Yours