How to set up a Laravel for Go application
Herd serves Laravel for Go applications just like your PHP sites. Every Laravel for Go application in a parked path is available via its.test domain, and Herd builds and starts it on demand when you open it in the browser. There are no commands to learn and no servers to keep running in a terminal.
Requirements
Herd builds Laravel for Go applications with your Go installation. Open the settings, go to “Runtimes” → “Go” and click “Install”. You can find all details on the Go page.Creating an application
Herd ships with the Laravel installer, which creates Laravel for Go applications with the--go flag:

Cloning an existing application
Click “Clone Repository” in the new application window to clone an existing Laravel for Go application. Herd recognizes the application by thego.laravel.com module in its go.mod and prepares a checklist for it. Herd installs Go if it’s missing, generates the application key, runs the migrations and connects the services that the .env file asks for. If the application can’t use the database that you pick yet, because its bootstrap/app.go doesn’t list the driver, Herd tells you what to add.
If you clone the repository in your terminal instead, the application works as soon as it’s in a parked path. Herd builds it on the first visit.
How Herd serves Laravel for Go applications
Herd serves a site as a Laravel for Go application when itsgo.mod requires the go.laravel.com module. Other Go modules, like libraries or command line tools, aren’t served. A site with a PHP front controller, like artisan or public/index.php, stays a PHP site even if it contains a go.mod.
When you open the site in your browser, Herd starts the application on a port of its own and nginx passes all requests for the .test domain to it:
- If the application has a
devscript in itspackage.jsonand itsnode_modulesare installed, Herd runslaravel dev. This starts the server, a queue worker and Vite. The server and the queue worker rebuild and restart when you change a.gofile,go.mod,go.sumor.env, and Vite hot-reloads your frontend. - Otherwise, Herd runs
go run ..
If Herd runs your application with
go run ., it doesn’t pick up code changes on its own. Stop the application with herd processes:stop app or the stop button in the Applications window, and the next request builds and starts it again.Managing the application
The Applications window lists Laravel for Go applications with all your other sites. Instead of the PHP version, the inspector shows a “Dev server” row with the command that Herd runs and its current state. You can start, stop and restart the application there and look at its output. You can do the same in your terminal. Run these commands in the application’s directory:Running commands
Laravel for Go applications don’t usephp artisan or Composer. Run your console commands with the laravel CLI from the application’s directory, which compiles the application first, or through Go:
Services
Herd Pro users can connect their Laravel for Go applications to Herd’s services. Select the application in the Applications window and pick a service in the “Services” section of the inspector, or use theherd site:services command. Herd writes the keys that Laravel for Go reads, like DATABASE_URL and REDIS_URL, to your .env file. Learn more in Per-Site Services.
Laravel for Go only connects to the databases whose driver the application lists in the Drivers of its bootstrap/app.go. Herd doesn’t change your code, so make sure that the driver of your database is there:
After you add a driver, run
go mod tidy to download its dependencies. Herd’s other services, like Redis, Laravel Reverb, Meilisearch or MinIO, don’t need any code changes. Laravel for Go has no driver for MongoDB.
When you copy the .env values of a service in the settings, a dropdown lets you choose between PHP, Rust and Go, and Herd shows the matching keys and the driver that a database needs.
Using SQLite
The starter application uses PostgreSQL. To switch an application that you created in your terminal to SQLite, replace the PostgreSQL driver with the SQLite driver inbootstrap/app.go:
bootstrap/app.go
DATABASE_URL in your .env file at a SQLite database, download the driver’s dependencies and run the migrations:
Testing emails
Laravel for Go sends emails with its SES mailer instead of SMTP. Herd’s mail server accepts these emails as well, so you can inspect them like the emails of your PHP applications. Add these values to your.env file:
.env
SES_CONFIGURATION_SET as the name of the inbox, like MAIL_USERNAME for PHP applications. The mailer needs the AWS credentials to sign its requests, but they don’t have to be real ones. The port of AWS_ENDPOINT_URL_SESV2 is the port of Herd’s internal API server, which is 2304 by default. To copy the values for your machine, click the copy button in the toolbar of the Mails window and select “Copy for Go”.
HTTPS
You can secure a Laravel for Go application like any other site. When you do, Herd also updates thevite.config of the application, so Vite uses Herd’s certificate and serves your assets via the site’s domain instead of http://localhost:5173. When you unsecure the site, Herd restores the previous values. A running Vite restarts on its own.
Herd Studio
Herd Studio works with Laravel for Go applications. Herd tells the coding agent that the site is a Laravel for Go application, which commands it runs with and which database drivers it needs, so the agent doesn’t try to usephp artisan or Composer. The Studio badge shows the application as the site’s dev stack, where you can follow its output and start or stop it.
Customizing how Herd starts the application
If your application lives in a subdirectory of your repository, or needs a different command, add anapp_server section to the site’s herd.yml file. See Configuring app servers for all options.