Laravel Cloud doesn’t officially support monorepos yet, but it is possible to work around this limitation wtih a custom build script.

Monorepo support is not officially available yet, but we’re actively working on support for this feature. In the meantime, some users have had success using the workaround below. Use at your own risk — Laravel Cloud Support may be unable to assist with debugging custom monorepo configurations.

How It Works

You’ll need a fakecomposer.lock in your repository root. You can simply copy the composer.lock file from your Laravel application subdirectory and place it in the root of your monorepo, committing it to source control. This indicates to Laravel Cloud that your monorepo contains a Laravel application. This composer.lock file does not need to be kept up to date.

Next, customize your environment’s build script in Laravel Cloud to move your Laravel application subdirectory (e.g., laravel_app) into the root directory before running composer install and the rest of your build commands:

# ---------------------------------
# Deploying the "laravel_app" directory
# ---------------------------------

# Step 1: Create a temporary directory
mkdir /tmp/monorepo_tmp

# Step 2: Create an array with all subdirectories
repos=("laravel_app" "go_app")

# Step 3: Move all subdirectories to the temporary directory
for item in "${repos[@]}"; do
  mv $item /tmp/monorepo_tmp/
done

# Step 4: Move the desired subdirectory into root
cp -Rf /tmp/monorepo_tmp/laravel_app/{.,}* .

# Step 5: Remove the temporary directory
rm -rf /tmp/monorepo_tmp

# Step 6: Proceed with build steps
composer install --no-dev
npm install
npm run build

Notes:

  • Replace laravel_app with the name of your Laravel app directory that you want to deploy.
  • If your app has dependencies on sibling directories (like shared packages or configuration), you will need to adjust paths manually or restructure accordingly.