Prerequisites
First, follow the regular steps in our quick start guide to begin.Automatic integration (recommended)
Laravel Forge offers built-in support for Nightwatch. Get setup in minutes:- Navigate to the Overview tab for a site that has
laravel/nightwatchinstalled. - Click Connect Nightwatch.
- Add your environment token.
- Click Monitor with Nightwatch.
- Optionally configure logging.

Add your Nightwatch environment token and click 'Monitor with Nightwatch'
Manual integration
To ensure the agent runs as a continual process on your Forge server, we strongly recommend running the Nightwatch agent as a background process.Steps
- Navigate to the Environment section of the Settings tab for a site that has
laravel/nightwatchinstalled. - Add your environment’s
NIGHTWATCH_TOKENand press Save. - Navigate to the Processes tab for the site.
- Click Add background process and select the Custom tab.
- Add the
nightwatch:agentartisan command (see below example). - Optionally configure logging.
Example daemon configuration
| Setting | Value |
|---|---|
| Name | Nightwatch |
| Command | php artisan nightwatch:agent |
| Working directory | /home/forge/example.com (your site path) |
| Processes | 1 |
| Graceful shutdown | 15 |

Configure the Nightwatch background process