Laravel Cloud
Get started with Nightwatch on Laravel Cloud.
Prerequisites
First, follow the regular steps in our quick start guide to begin.
Automatic Integration (Recommended)
Laravel Cloud offers built-in support for Nightwatch. Get setup in minutes:
Install Nightwatch package
Install the Laravel Nightwatch package in your application locally using Composer:
Run composer require laravel/nightwatch
on your local machine to update your composer.json
and composer.lock
files before deploying.
Connect Nightwatch
Click the Connect Nightwatch button in your environment dashboard.
Enable monitoring
Toggle Enable monitoring to activate Nightwatch for your environment.

Enter your Nightwatch token
Enter your Nightwatch token, which you can find in your Nightwatch application settings.
Once complete, Laravel Cloud will automatically inject the following environment variables into your environment:
You can override these variables in your environment variable settings if needed.
Enabling Nightwatch will automatically run the agent across all the App compute and Worker clusters in the environment. You can setup Nightwatch manually if you want the agent to run on specific instances.
If you have previously configured Nightwatch manually using background processes, you must remove theses processes from every cluster before enabling the built-in integration to avoid issues with your environment.
Manual Integration
You can also manually integrate Nightwatch with Laravel Cloud by adding a background process to each App compute and Worker cluster.
Add Your Environment Variables
Before running the agent, you’ll need to add environment variables to your Cloud environment. Follow Laravel Cloud’s guide on managing environment variables to get started.
Running the Agent
To run the agent in your Cloud application cluster, follow these simple steps:
Steps
- Select your application cluster
- Click New background process
- Choose Custom worker
- Enter
php artisan nightwatch:agent
as the command - Save your changes and redeploy
Note: If you’re using a dedicated worker cluster, please repeat the same steps for the worker cluster so that it also runs the agent.
Visual Guide

Select the App cluster

Select “New Background Process”

Add a custom worker that runs the `nightwatch:agent` command