The complete guide to Laravel Go

By

Tagged: Laravel, Go

Build Pingwatch and ShipVote in Laravel Go on Go 1.27 and net/http, with validation, queues, workflows, Reverb, Inertia v3, tests, and Rust benchmarks.

One day after releasing Laravel Rust, Laravel released Laravel Go in public beta.

When I jokingly asked Taylor Otwell on X if this would be the last language, he replied: “It is unless a new language drops.”

He built Laravel Rust and Laravel Go in parallel out of the same mono-repo workspace, so the lineup is set: Laravel PHP, Laravel Rust, and Laravel Go.

After rebuilding the same 2 real apps in Laravel Go on the Mac I used for the Rust guide, I have a bold take.

For most solo developers and web teams, Laravel Go might actually be the better default than Laravel Rust.

That surprised me too. Yesterday I wrote that I had a hard time seeing myself starting a new Laravel project in PHP again once Laravel Rust hits 1.0.

Laravel Go keeps almost all the speed, single-binary simplicity, and tiny memory footprint of Laravel Rust, and it fixes the 2 things that still slow Rust down every day: build times and mental overhead.

On my Mac, compiling the release binary for our Pingwatch app took 54.98 seconds in Laravel Rust. In Laravel Go, building the same app took 0.97 seconds (stripped to 34 MB, smaller than the 43 MB Rust binary).

And when I ran the same local SQLite load test against both compiled binaries on the same machine, Laravel Go hit 7,631 requests per second with 24.4 MB idle RAM.

If you already know Go, you’ll feel right at home in 5 minutes. If you need a refresher on Go first, check out my Go Guide and grab the free Go Handbook that covers Go 1.27 types, generics, goroutines, context, testing and more from scratch.

If you come from PHP, my Laravel Guide and Laravel Handbook cover the PHP version.

In this guide we are doing a direct apples-to-apples comparison. We’ll build Pingwatch (the same uptime monitor we built in Laravel Rust, with SQLite migrations, models, pointer-bound validation, Sometimes[T] partial updates, concurrent task.Run queries, queued checks, Reverb broadcasts, a durable outage escalation workflow, custom CLI commands, and integration tests) and then we’ll build ShipVote (our full authenticated roadmap board) so we can compare real code and real numbers directly.

Every command, output, benchmark number and screenshot you’ll see below comes from running both apps locally on Laravel Go 0.1.0, Laravel CLI 0.4.0, and go1.27.4.

Why Laravel Go exists alongside Laravel Rust

Go is one of the most deployed backend languages on the planet. It powers Docker, Kubernetes, Caddy, and huge chunks of the cloud.

Yet in 15 years, Go has never had a definitive, batteries-included full-stack web framework.

You pick up net/http, Chi, Echo, Fiber, and by day 2 you are stitching together SQL migrations, an ORM or query builder, session cookies, CSRF protection, form validation, background queues, email templates, a React build pipeline… by hand.

Every Go codebase looks completely different.

Laravel Go fills this gap without fighting the language.

There are no proc-macros, no hidden service container, no third-party HTTP framework hiding underneath. Your app is built on Go’s standard net/http package and goroutines:

  • Your application is a standard http.Handler.
  • *web.Request embeds *http.Request and implements context.Context.
  • Existing Go net/http handlers and middleware plug straight in.
  • Shared dependencies are wired once at startup in services/services.go and read explicitly via services.From(ctx).

It also takes advantage of Go 1.27, so go.mod requires Go 1.27 or later. Go 1.27’s generic methods let Laravel expose clean APIs like r.Validate[StoreMonitor]() on *web.Request and run.Step(...) on *workflow.Run.

The skeleton also uses Go’s new(expr) syntax for pointer literals, and the ignore ./node_modules directive in go.mod.

Here is how the three Laravel runtimes handle slow I/O, like a database query or a 4-second LLM API call:

Concurrency models across Laravel PHP, Laravel Go, and Laravel RustLaravel PHP holds a worker process during I/O waits, Laravel Go parks lightweight goroutines on net/http, and Laravel Rust awaits async futures on Axum and Tokio.Laravel Rust (Axum + Tokio async)Laravel Go (net/http + goroutines)Laravel PHP (process per request)Incoming HTTPrequestPHP-FPM worker bootsBlocks on DB or APIcallIncoming HTTPrequestLightweightgoroutine startsRuntime parksgoroutine on I/OIncoming HTTPrequestAsync task on TokioAwaits non-blockingfuture

In Laravel Rust, every handler, every model call, every job is async and has .await?.

In Laravel Go, you write normal top-to-bottom synchronous Go code, and the Go runtime parks the goroutine whenever it waits on SQL, Redis, or an external HTTP call.

That single difference makes Go code much easier to read, refactor and review when a coding agent writes 1,000 lines of code for you.

Head-to-head numbers: Pingwatch in Laravel Go vs Laravel Rust

Before writing code, let’s see what happened when I built and benchmarked the same Pingwatch application in Laravel Go 0.1.0 and Laravel Rust 0.1.3 on my Mac:

Metric (Pingwatch on same Mac)Laravel Go 0.1.0Laravel Rust 0.1.3Difference
First project scaffold (laravel new pingwatch)16.97s2m 14s7.9x faster
Second warm scaffold (laravel new shipvote)6.92s29.7s4.3x faster
Incremental feature test run1.18s1.22s–1.92sFaster
Frontend npm run build (Vite Plus)267 ms293 msSame stack
Full production binary build0.97s (-ldflags="-s -w") / 1.53s default54.98s (cargo build --release)36x–56x faster
Cross-compile macOS to Linux amd64 binary7.50s (zero Docker, static ELF)Requires Docker / cross / ZigHuge win
Standalone binary size34 MB stripped (49 MB default)43 MB9 MB smaller
Project disk footprint (excl. node_modules & binary)~1.6 MBHundreds of MB (target/)Massive savings
Idle production server memory24.4 MB RSS22.3 MB RSS+2.1 MB
Local GET /api/monitors load test (2,000 reqs, 32 workers, 3 SQLite queries)7,631 RPS (p50 3.60 ms, p99 9.59 ms, 40.6 MB RSS)6,019 RPS (p50 4.74 ms, p99 11.30 ms, 37.4 MB RSS)+27% local RPS

Click through the chart below to compare the four biggest differences:

Fig 1 · 1/4Pingwatch measured head-to-head: Laravel Go vs Laravel Rust
Scaffold · 17.0s (Go) vs 2m 14s (Rust)

Here are the 2 numbers that change my day-to-day work immediately.

First, build speed: compiling a production binary takes less than 1 second in Go, compared to nearly a minute in Rust.

On cloud CI, where Laravel’s own benchmark showed ~3-minute cold builds for Rust, Go compiles in seconds.

Second, zero CGo and instant cross-compilation: Laravel Go’s SQLite driver (modernc.org/sqlite) is pure Go.

I ran GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" on my Apple Silicon Mac and got a statically linked 35 MB Linux x86-64 ELF binary in 7.50 seconds.

No Docker container, no C toolchain, nothing.

One fair caveat on the local throughput number: on a single-box SQLite benchmark with short connections, Go’s net/http accept loop and pure-Go SQLite pool actually beat our Rust build (7,631 RPS vs 6,019 RPS).

Under sustained multi-core production traffic against MySQL or PostgreSQL with heavy allocation pressure, Rust’s lack of a garbage collector still gives it a slight advantage in tail latency and memory ceiling (22.3 MB vs 24.4 MB idle).

In real-world web apps, both are an order of magnitude faster than Laravel PHP, Rails or Django.

Installing the Laravel CLI and creating your first app

Laravel Go requires Go 1.27 or later, Node.js (22.18+ or 24.11+) and Git.

Check your Go version first (on macOS brew install go or brew upgrade go installs Go 1.27.4):

go version
# go version go1.27.4 darwin/arm64

Next, install or update the unified Laravel CLI. It creates PHP, Rust, and Go projects and runs your app commands during development:

curl -fsSL https://laravel.com/install.sh | sh

On Windows, run this in PowerShell:

powershell -ExecutionPolicy Bypass -c "irm https://laravel.com/install.ps1 | iex"

Verify the version in a new terminal:

laravel --version
# Laravel CLI 0.4.0

Be careful with a PATH conflict I hit on macOS. If you already use Laravel Herd or the older Composer laravel/installer package, the installer will print a warning that laravel is shadowed by another command in your PATH. Run which -a laravel and make sure ~/.laravel/bin comes before Herd’s bin folder in ~/.zshrc.

Now create our Pingwatch app with --go:

laravel new pingwatch --go
cd pingwatch

On my Mac, the whole scaffold (downloading Go modules, running npm install, generating an APP_KEY in .env, and compiling the initial binary) finished in 16.97 seconds.

Checking Go 1.27.4, Laravel CLI 0.4.0, and scaffolding Pingwatch with laravel new pingwatch --go

Understanding the directory structure

If you have worked in Laravel PHP or Laravel Rust, you already know where everything lives.

The main difference in Go is that packages sit cleanly at the top level, instead of inside src/:

pingwatch/
├── .agents/skills/          # 7 built-in Agent Skills for coding agents
├── AGENTS.md                # Project conventions for coding agents
├── CLAUDE.md                # Imports @AGENTS.md for Claude Code
├── go.mod                   # module app, go 1.27, ignore ./node_modules
├── main.go                  # Entry point: serves web app or runs CLI command
├── bootstrap/
│   └── app.go               # Explicit wiring: routes, middleware, drivers, jobs, workflows
├── commands/                # Custom console commands and Schedule()
├── database/
│   ├── factories/           # Model factories and reusable states
│   ├── migrations/          # Forward-only Go migrations compiled into binary
│   ├── schema/              # Optional SQL schema dumps
│   └── seeders/             # Database seeders
├── events/                  # Application and broadcastable events
├── handlers/                # Resource handler packages (monitors/, welcome/, ...)
├── jobs/                    # Queued job structs
├── listeners/               # Event listeners
├── models/                  # Plain Go model structs + colocated policies
├── resources/
│   ├── css/app.css          # Tailwind CSS v4 entry point
│   ├── js/pages/            # Inertia v3 React + TypeScript pages
│   ├── views/app.html       # Root HTML document (embedded via //go:embed)
│   └── resources.go         # Embeds views right into the binary
├── routes/                  # web.go, api.go, channels.go
├── services/
│   └── services.go          # Startup dependency wiring read via services.From(ctx)
├── tests/
│   ├── tests.go             # tests.New(t) helper with RefreshDatabase
│   └── feature/             # Standard Go *_test.go integration tests
└── workflows/               # Durable multi-step workflows

Two things jump out right away if you are coming from Laravel Rust:

  1. Everything is registered explicitly in bootstrap/app.go. There are no attribute macros scanning your files at compile time. You list your database drivers, migrations, commands, jobs, listeners, and workflows as plain Go slices. When you use laravel make:migration, laravel make:job, or laravel make:command, the CLI adds the entry to the slice for you.
  2. Views compile into the binary with //go:embed. Look at resources/resources.go. Your HTML templates and Inertia root view are embedded straight into the Go executable, so you don’t even have to copy resources/views/ to your production server.

Switching to pure-Go SQLite

New Laravel Go apps default to PostgreSQL (postgres.Driver). Since every driver is its own package in Options.Drivers, your binary will only compile the drivers you list.

To keep Pingwatch zero-config locally, I swapped postgres.Driver with sqlite.Driver in bootstrap/app.go:

// bootstrap/app.go (excerpt)
import (
	"go.laravel.com/db"
	"go.laravel.com/db/sqlite"
)

// inside Options():
Drivers: []db.Driver{sqlite.Driver},

Then update APP_NAME, APP_URL, and DATABASE_URL in .env:

APP_NAME=Pingwatch
APP_URL=http://127.0.0.1:8000

DATABASE_URL=sqlite:storage/app/database.sqlite

Laravel creates the SQLite file automatically on first query and turns on foreign key constraints so SQLite behaves like PostgreSQL and MySQL.

(If you want to go deeper on SQLite pragmas or PostgreSQL indexes, grab the free SQLite Handbook or PostgreSQL Handbook.)

Run go mod tidy to pull the pure-Go SQLite driver (modernc.org/sqlite), run your initial migrations, and list every built-in command:

go mod tidy
laravel migrate
laravel list
Migrating `0001_01_01_000000_create_users_table`...
Migrating `0001_01_01_000001_create_cache_table`...
Migrating `0001_01_01_000002_create_jobs_table`...
3 migrations ran.

Start the local dev loop (auto-rebuilding Go server, queue worker, and Vite Plus hot reload in one command):

laravel dev

Open http://127.0.0.1:8000 and you get the default Laravel Go welcome page with its animated green WebGPU particle terrain:

The default Laravel Go welcome page with its green WebGPU particle terrain rendered at http://127.0.0.1:8000

Inside the request lifecycle, routing, and explicit wiring

Everything in a Laravel Go app starts in bootstrap/app.go.

Instead of looking through config files and service providers, bootstrap.Options() defines the whole app in a 60-line Go struct:

// bootstrap/app.go
package bootstrap

import (
	laravel "go.laravel.com"
	"go.laravel.com/auth"
	"go.laravel.com/config"
	"go.laravel.com/db"
	"go.laravel.com/db/sqlite"
	"go.laravel.com/inertia"
	"go.laravel.com/web"

	"app/commands"
	"app/database/migrations"
	"app/database/schema"
	"app/database/seeders"
	"app/jobs"
	"app/listeners"
	"app/models"
	"app/resources"
	"app/routes"
	"app/services"
	"app/workflows"
)

func Options() laravel.Options {
	return laravel.Options{
		Routes: laravel.Routes{
			Web:      routes.Web,
			API:      routes.API,
			Channels: routes.Channels,
			Health:   "/up",
		},
		Middleware: func(m *laravel.Middleware, cfg *config.Config) {
			m.Web.Append(auth.Session[models.User]{})

			m.Web.Append(inertia.Middleware{
				Share:     share,
				ErrorPage: "Error",
			})
		},
		Views: resources.Views,

		Drivers:    []db.Driver{sqlite.Driver},
		Migrations: migrations.All,
		Schema:     schema.Dumps,
		Seeders:    seeders.All,

		Commands:  commands.All,
		Schedule:  commands.Schedule,
		Listeners: listeners.All,
		Jobs:      jobs.All,
		Workflows: workflows.All,

		Services: laravel.BuildServices(services.New),
	}
}

When the binary boots, it loads .env, builds your services once via services.New, validates your routes and configuration, and starts serving requests on net/http.

Click through the 4 stages below to follow a POST /api/monitors request from socket to response:

Fig 2 · 1/4How a request moves through Laravel Go
Step 1 · net/http goroutine + request context

Routes live in routes/web.go and routes/api.go.

Web routes run session cookies, CSRF protection, authentication, and Inertia middleware.

API routes are stateless and automatically prefixed with /api.

Here are Pingwatch’s web routes in routes/web.go:

// routes/web.go
package routes

import (
	"net/http"

	"go.laravel.com/config"
	"go.laravel.com/routing"
	"go.laravel.com/web"

	"app/handlers/monitors"
	"app/handlers/welcome"
)

func Web(route *routing.Router, cfg *config.Config) {
	route.Get("/", welcome.Show).Name("home")
	route.Get("/monitors", monitors.Index).Name("monitors.index")
	route.Post("/monitors", monitors.StoreWeb).Name("monitors.store")

	route.Fallback(func(*web.Request) *web.Response {
		return web.Abort(http.StatusNotFound)
	})
}

And the stateless JSON API routes in routes/api.go:

// routes/api.go
package routes

import (
	laravel "go.laravel.com"
	"go.laravel.com/config"
	"go.laravel.com/routing"
	"go.laravel.com/web"

	"app/handlers/monitors"
)

func API(route *routing.Router, cfg *config.Config) {
	route.Get("/version", version)

	route.Get("/monitors", monitors.APIIndex).Name("api.monitors.index")
	route.Post("/monitors", monitors.APIStore).Name("api.monitors.store")
	route.Get("/monitors/{monitor}", monitors.APIShow).Name("api.monitors.show")
	route.Patch("/monitors/{monitor}", monitors.APIUpdate).Name("api.monitors.update")
	route.Delete("/monitors/{monitor}", monitors.APIDestroy).Name("api.monitors.destroy")
}

func version(*web.Request) *web.Response {
	return web.JSON(map[string]string{"laravel": laravel.Version})
}

Three practical details to notice here:

  1. Route model binding uses generics. Inside a handler, model.FromRoute[models.Monitor](r, "monitor") parses {monitor}, queries the row, and returns a 404 automatically if the ID is missing or invalid (like /api/monitors/hello).
  2. Named routes work like Laravel PHP. Attach .Name("monitors.index") and redirect safely with web.RedirectRoute("monitors.index"). (Unlike Laravel Rust’s route!(handler) macro, route names are strings in Go, so lean on feature tests to catch typos.)
  3. Health checks come built in. Health: "/up" answers 200 OK as soon as the app boots, ready for load balancers and Laravel Cloud.

Migrations, plain-struct models, and factories

Just like in Laravel Rust, migrations in Laravel Go are forward-only code files that are compiled in your binary.

There is no Down() method. Dropping columns on a live production database is a good way to lose customer data, so if you need to reverse a change, you write a new forward migration.

On PostgreSQL and SQLite, Laravel runs each migration inside a transaction automatically.

Let’s generate our 3 Pingwatch migrations:

laravel make:migration create_monitors_table
laravel make:migration create_checks_table
laravel make:migration create_workflow_tables

The CLI will automatically create each Go file in database/migrations/ and add it to migrations.All.

Here is the monitors table migration using the fluent schema builder:

// database/migrations/2026_12_02_205909_create_monitors_table.go
package migrations

import (
	"context"

	"go.laravel.com/schema"
)

func createMonitorsTable(ctx context.Context) error {
	return schema.Create(ctx, "monitors", func(table *schema.Blueprint) {
		table.ID()
		table.String("name").Length(120)
		table.String("url").Unique()
		table.Integer("interval_seconds").Default(60)
		table.String("status").Length(16).Default("up")
		table.Integer("last_latency_ms").Nullable()
		table.Timestamp("last_checked_at").Nullable()
		table.Timestamps()
	})
}

And the checks table with a cascading foreign key and a composite index on ("monitor_id", "created_at"):

// database/migrations/2026_12_02_205911_create_checks_table.go
package migrations

import (
	"context"

	"go.laravel.com/schema"
)

func createChecksTable(ctx context.Context) error {
	return schema.Create(ctx, "checks", func(table *schema.Blueprint) {
		table.ID()
		table.ForeignID("monitor_id").Constrained().CascadeOnDelete()
		table.Integer("status_code")
		table.Integer("latency_ms")
		table.Boolean("ok")
		table.Text("error").Nullable()
		table.Timestamps()

		table.Index("monitor_id", "created_at")
	})
}

For framework tables (sessions, cache, queues, feature flags, and workflows), one helper call creates every table and index for your database dialect:

// database/migrations/2026_12_02_205914_create_workflow_tables.go
package migrations

import (
	"context"

	"go.laravel.com/workflow"
)

func createWorkflowTables(ctx context.Context) error {
	return workflow.CreateTables(ctx)
}

Plain Go structs as models

Models in Laravel Go do not embed a base struct, and there is no code generation involved.

They are plain Go structs, with the usual json tags, pointer fields (*int64, *time.Time) for nullable columns, db:",default" for columns with a database default, and model tags for relationships.

Here is models/monitor.go:

// models/monitor.go
package models

import "time"

type MonitorStatus string

const (
	MonitorUp     MonitorStatus = "up"
	MonitorDown   MonitorStatus = "down"
	MonitorPaused MonitorStatus = "paused"
)

type Monitor struct {
	ID              int64         `json:"id"`
	Name            string        `json:"name"`
	URL             string        `json:"url"`
	IntervalSeconds int64         `json:"interval_seconds" db:",default"`
	Status          MonitorStatus `json:"status" db:",default"`
	LastLatencyMs   *int64        `json:"last_latency_ms"`
	LastCheckedAt   *time.Time    `json:"last_checked_at"`
	CreatedAt       time.Time     `json:"created_at"`
	UpdatedAt       time.Time     `json:"updated_at"`

	Checks []Check `json:"checks,omitzero" model:"has_many"`
}

type Check struct {
	ID         int64     `json:"id"`
	MonitorID  int64     `json:"monitor_id"`
	StatusCode int64     `json:"status_code"`
	LatencyMs  int64     `json:"latency_ms"`
	OK         bool      `json:"ok"`
	Error      *string   `json:"error"`
	CreatedAt  time.Time `json:"created_at"`
	UpdatedAt  time.Time `json:"updated_at"`

	Monitor *Monitor `json:"monitor,omitzero" model:"belongs_to"`
}

Look closely at what Laravel Go’s ORM gives you here, and where it differs from Rust:

  • No silent N+1 queries. Relationships never lazy-load behind your back. You eager-load what a page needs with .With("checks"), and json:"checks,omitzero" keeps unloaded slices out of your JSON output.
  • Empty slices, never null. When model.Query[models.Monitor]().Get(r) matches zero rows, it returns an empty []models.Monitor{} so JSON always encodes [] instead of null.
  • Fast feedback on bad column names. Because Go queries take column names as strings (WhereEq("status", models.MonitorDown)), Laravel checks every column and relationship name against the struct’s fields when you build the query and panics immediately during tests with the list of valid field names if you mistype one. (Rust still wins here by catching bad column names at compile time, before tests even run.)
  • Rich column types built in. Beyond primitives, models handle numeric.Decimal, uuid.UUID (v7), db:",ulid", date.Date, netip.Addr, typed db.JSON[T], db.Vector, and crypt.Encrypted[T] out of the box.

Model factories live in database/factories/monitor.go, and they are just plain Go state functions:

// database/factories/monitor.go
package factories

import (
	"fmt"

	"go.laravel.com/factory"

	"app/models"
)

var Monitor = factory.New(func(fake *factory.Faker) models.Monitor {
	slug := fake.Unique().Word()
	return models.Monitor{
		Name:            fmt.Sprintf("%s service", slug),
		URL:             fmt.Sprintf("https://%s.flaviocopes.com/health", slug),
		IntervalSeconds: 60,
		Status:          models.MonitorUp,
	}
})

func MonitorDown(_ *factory.Faker, m *models.Monitor) {
	m.Status = models.MonitorDown
}

func MonitorPaused(_ *factory.Faker, m *models.Monitor) {
	m.Status = models.MonitorPaused
}

Typed validation with struct pointers, Sometimes[T], and handlers

This is the smartest Go-specific API in the entire framework.

In most Go validation libraries, you stuff rules into fragile struct tags like validate:"required,url,max=120" that the compiler never checks.

In Laravel Go, you define an ordinary struct with json tags and write a Rules() method that points directly at each field using its Go pointer (&f.Name, &f.URL).

If you rename or mistype a field, your code fails to compile immediately:

// handlers/monitors/monitors.go (validation structs)
type StoreMonitor struct {
	Name            string                      `json:"name"`
	URL             string                      `json:"url"`
	IntervalSeconds validation.Sometimes[int64] `json:"interval_seconds"`
}

func (f *StoreMonitor) Rules() validation.Rules {
	return validation.For(f,
		rule.Field(&f.Name, rule.Required, rule.Max(120)),
		rule.Field(&f.URL, rule.Required, rule.URL, model.Unique[models.Monitor]()),
		rule.Field(&f.IntervalSeconds, rule.Min(10), rule.Max(3600)),
	)
}

type UpdateMonitor struct {
	Name            validation.Sometimes[string]               `json:"name"`
	IntervalSeconds validation.Sometimes[int64]                `json:"interval_seconds"`
	Status          validation.Sometimes[models.MonitorStatus] `json:"status"`
}

func (f *UpdateMonitor) Rules() validation.Rules {
	return validation.For(f,
		rule.Field(&f.Name, rule.Required, rule.Max(120)),
		rule.Field(&f.IntervalSeconds, rule.Min(10), rule.Max(3600)),
		rule.Field(&f.Status, rule.In(models.MonitorUp, models.MonitorDown, models.MonitorPaused)),
	)
}

validation.Sometimes[T] is a very nice addition to the validation package, as it allows us to solve a problem we had with partial PATCH updates in Go, without resorting to weird double-pointer hacks.

If a client omits name from the PATCH body, form.Name.Present will be false, and Laravel will skip the validation rules for it, and model.Update(r, &monitor, db.Values{...}) will not touch the name column in SQL.

If the client sends "name": "", Present will be true, and rule.Required will reject the request with a 422.

Five web bugs prevented by Laravel Go guardrailsLaravel Go catches misspelled validation fields at compile time, ignores mass-assignment extras through form structs, blocks N+1 queries by requiring With, panics in tests on mistyped column names, and omits secrets with json dash tags.Go compiler +Laravel GoCompile time:wrong &f.Fieldpointer in RulesCompile time:wrong type ingeneric Query orValidateDesign: formstructs preventmass-assignmentDesign: no silentN+1 lazyrelationshiploadingTest time:mistyped columnnames fail fast

Now look at the Pingwatch handlers in handlers/monitors/monitors.go.

In Index and APIIndex, task.Run fans all 3 SQLite queries out across goroutines concurrently, propagating the request context and tracing span automatically:

// handlers/monitors/monitors.go (handlers)
func Index(r *web.Request) *web.Response {
	var (
		monitors    []models.Monitor
		totalChecks int
		downCount   int
	)

	err := task.Run(r,
		func(ctx context.Context) (err error) {
			monitors, err = model.Query[models.Monitor]().OrderBy("id").Get(ctx)
			return err
		},
		func(ctx context.Context) (err error) {
			totalChecks, err = model.Query[models.Check]().Count(ctx)
			return err
		},
		func(ctx context.Context) (err error) {
			downCount, err = model.Query[models.Monitor]().
				WhereEq("status", models.MonitorDown).
				Count(ctx)
			return err
		},
	)
	if err != nil {
		return web.Fail(err)
	}

	return inertia.Render("Monitors/Index", inertia.Props{
		"monitors":     monitors,
		"total_checks": totalChecks,
		"down_count":   downCount,
	})
}

func APIStore(r *web.Request) *web.Response {
	form, err := r.Validate[StoreMonitor]()
	if err != nil {
		return web.Fail(err)
	}

	monitor := models.Monitor{
		Name: form.Name,
		URL:  form.URL,
	}
	if form.IntervalSeconds.Present {
		monitor.IntervalSeconds = form.IntervalSeconds.Value
	}

	if err := model.Create(r, &monitor); err != nil {
		return web.Fail(err)
	}

	if _, err := queue.Dispatch(r, jobs.RunCheck{Monitor: monitor}); err != nil {
		return web.Fail(err)
	}

	return web.Created(monitor)
}

func APIUpdate(r *web.Request) *web.Response {
	monitor, err := model.FromRoute[models.Monitor](r, "monitor")
	if err != nil {
		return web.Fail(err)
	}

	form, err := r.Validate[UpdateMonitor]()
	if err != nil {
		return web.Fail(err)
	}

	if err := model.Update(r, &monitor, db.Values{
		"name":             form.Name,
		"interval_seconds": form.IntervalSeconds,
		"status":           form.Status,
	}); err != nil {
		return web.Fail(err)
	}

	return web.JSON(monitor)
}

func APIDestroy(r *web.Request) *web.Response {
	monitor, err := model.FromRoute[models.Monitor](r, "monitor")
	if err != nil {
		return web.Fail(err)
	}

	if err := model.Delete(r, &monitor); err != nil {
		return web.Fail(err)
	}

	return web.NoContent()
}

If a client sends invalid JSON to POST /api/monitors, r.Validate[StoreMonitor]() stops immediately and web.Fail(err) returns a 422 Unprocessable Entity with structured field errors (and on web routes, redirects back with flashed errors and old input).

If a client sends {"status":"paused"} to PATCH /api/monitors/4, model.Update only updates status and updated_at.

Here is the real output from our compiled Pingwatch Go binary:

Live curl requests against the Pingwatch Go binary returning 422 validation errors and a partial PATCH update

Notice X-Request-Id, X-Content-Type-Options: nosniff, X-Frame-Options: SAMEORIGIN, and the exact Laravel validation error JSON structure, all wired automatically.

Structured concurrency, queued jobs, commands, and scheduling

If you have written production Go servers, you know the classic goroutine footguns: starting a bare go func() that panics and crashes the whole process, leaking goroutines when a client disconnects, forgetting to propagate request IDs and tracing spans.

Laravel Go provides you with structured concurrency primitives that replace bare go statements across the whole request lifecycle.

Click through the 4 patterns below:

Fig 3 · 1/4Structured concurrency inside a Laravel Go process
Pattern 1 · task.Run fan-out inside a handler
  • task.Run and task.Both run functions in parallel goroutines, cancel sibling contexts immediately if one fails, and recover panics into regular 500 errors instead of crashing the server.
  • task.Map(r, items, 5, fn) caps concurrency while preserving slice order, and task.First races competing upstream calls and cancels the losers.
  • r.Background(fn) runs quick post-response work after the HTTP response flushes, waits for an open db.Transaction to commit first, and drains before shutdown.
  • In-process Ticks flush buffered metrics or counters on an interval, with RunOnShutdown running one final flush when SIGTERM arrives.

For work that must survive crashes and retry on failure, we use queued jobs.

A job is a Go struct with a Handle(ctx context.Context) error method, registered in jobs/jobs.go. Tag any model field with queue:"model" and Laravel serializes only its ID onto the queue, then reloads a fresh row right before Handle runs.

Here is Pingwatch’s RunCheck job in jobs/run_check.go:

// jobs/run_check.go
package jobs

import (
	"context"
	"errors"
	"time"

	"go.laravel.com/date"
	"go.laravel.com/db"
	"go.laravel.com/event"
	"go.laravel.com/httpclient"
	"go.laravel.com/model"
	"go.laravel.com/workflow"

	"app/events"
	"app/models"
	"app/workflows"
)

type RunCheck struct {
	Monitor models.Monitor `queue:"model"`
}

func (j RunCheck) Handle(ctx context.Context) error {
	started := time.Now()
	res, err := httpclient.Timeout(5*time.Second).Get(ctx, j.Monitor.URL)
	latencyMs := time.Since(started).Milliseconds()

	var (
		statusCode int64
		ok         bool
		errText    *string
	)

	if err != nil {
		var connErr *httpclient.ConnectionError
		if errors.As(err, &connErr) && connErr.Timeout() {
			statusCode = 504
			msg := "request timed out after 5s"
			errText = &msg
		} else {
			msg := err.Error()
			errText = &msg
		}
	} else {
		statusCode = int64(res.Status)
		ok = res.Status >= 200 && res.Status < 400
	}

	check := models.Check{
		MonitorID:  j.Monitor.ID,
		StatusCode: statusCode,
		LatencyMs:  latencyMs,
		OK:         ok,
		Error:      errText,
	}
	if err := model.Create(ctx, &check); err != nil {
		return err
	}

	previous := j.Monitor.Status
	next := models.MonitorDown
	if ok {
		next = models.MonitorUp
	}

	now := date.Now(ctx)
	if err := model.Update(ctx, &j.Monitor, db.Values{
		"status":          next,
		"last_latency_ms": latencyMs,
		"last_checked_at": now,
	}); err != nil {
		return err
	}

	if next != previous {
		if err := event.Dispatch(ctx, events.MonitorStatusChanged{
			MonitorID: j.Monitor.ID,
			Name:      j.Monitor.Name,
			Status:    next,
			LatencyMs: latencyMs,
		}); err != nil {
			return err
		}

		if next == models.MonitorDown {
			if _, err := workflow.Start(ctx, workflows.EscalateOutage{
				MonitorID: j.Monitor.ID,
			}); err != nil {
				return err
			}
		}
	}

	return nil
}

Notice how I used date.Now(ctx) instead of time.Now() when stamping last_checked_at.

Using date.Now(ctx) allows tests to freeze or travel through time using client.Travel(...) without having to mock clocks by hand.

Custom commands and the task scheduler

Console commands implement Name(), Description(), and Run(ctx, c *console.Console) (plus Flags(*flag.FlagSet) if you want to use Go’s standard flag package).

Here’s the monitors:summary command of Pingwatch, in commands/monitors_summary.go:

// commands/monitors_summary.go
package commands

import (
	"context"
	"fmt"
	"strings"

	"go.laravel.com/console"
	"go.laravel.com/model"

	"app/models"
)

type MonitorsSummary struct{}

func (*MonitorsSummary) Name() string        { return "monitors:summary" }
func (*MonitorsSummary) Description() string { return "Print a summary of all registered monitors" }

func (*MonitorsSummary) Run(ctx context.Context, c *console.Console) error {
	monitors, err := model.Query[models.Monitor]().OrderBy("id").Get(ctx)
	if err != nil {
		return err
	}

	for _, m := range monitors {
		latency := "-"
		if m.LastLatencyMs != nil {
			latency = fmt.Sprintf("%dms", *m.LastLatencyMs)
		}
		c.Linef("[#%d] %-6s %6s  %s (%s)", m.ID, strings.ToUpper(string(m.Status)), latency, m.Name, m.URL)
	}

	return nil
}

Then I schedule DispatchDueChecks every minute in commands/schedule.go.

Keeping the work in a plain exported function makes it trivial to invoke directly in a unit test, and on a VPS you only need one cron line running ./pingwatch schedule:run:

// commands/schedule.go
package commands

import (
	"context"

	"go.laravel.com/model"
	"go.laravel.com/queue"
	"go.laravel.com/schedule"

	"app/jobs"
	"app/models"
)

func Schedule(ctx context.Context, s *schedule.Schedule) {
	s.Call("dispatch-due-checks", DispatchDueChecks).EveryMinute()
}

func DispatchDueChecks(ctx context.Context) error {
	monitors, err := model.Query[models.Monitor]().
		Where("status", "!=", models.MonitorPaused).
		Get(ctx)
	if err != nil {
		return err
	}

	for _, monitor := range monitors {
		if _, err := queue.Dispatch(ctx, jobs.RunCheck{Monitor: monitor}); err != nil {
			return err
		}
	}

	return nil
}

I seeded 4 real endpoints into Pingwatch and ran ./pingwatch queue:work --stop-when-empty.

Here is the real output:

Processing jobs from `database:default`. Press Ctrl+C to stop.
jobs.RunCheck  189.4ms
jobs.RunCheck  207.6ms
jobs.RunCheck  176.7ms
jobs.RunCheck  553.7ms
laravel.broadcast.deliver  0.8ms
laravel.workflow.advance  2.3ms

https://updates.flaviocopes.com/health returned a 404, so RunCheck recorded the failed check, flipped monitor #3 to down, delivered the MonitorStatusChanged broadcast in 0.8 ms, and kicked off our durable EscalateOutage workflow in 2.3 ms.

Durable, fault-tolerant workflows

Multi-day flows like outage escalations, onboarding drip emails, manager approval links, and many other use cases, usually turn into fragile chains of delayed jobs and database status columns.

Laravel Go ships the same built-in durable workflow engine that powers Laravel Rust, running on your existing queue workers, with no extra infrastructure.

Here is Pingwatch’s EscalateOutage workflow, defined in workflows/escalate_outage.go:

// workflows/escalate_outage.go
package workflows

import (
	"context"
	"log/slog"
	"time"

	"go.laravel.com/db"
	"go.laravel.com/model"
	"go.laravel.com/workflow"

	"app/models"
)

type EscalateOutage struct {
	MonitorID int64 `json:"monitor_id"`
}

func (EscalateOutage) WorkflowName() string {
	return "monitors.escalate_outage"
}

func (e EscalateOutage) Handle(run *workflow.Run) (string, error) {
	if err := run.Do("send initial alert", e.sendInitialAlert); err != nil {
		return "", err
	}

	if err := run.Sleep(5 * time.Minute); err != nil {
		return "", err
	}

	stillDown, err := run.Step("check monitor status", e.checkMonitorStatus)
	if err != nil {
		return "", err
	}

	if stillDown {
		if err := run.Do("send escalation alert", e.sendEscalationAlert); err != nil {
			return "", err
		}

		return "escalated", nil
	}

	return "recovered", nil
}

func (e EscalateOutage) sendInitialAlert(ctx context.Context) error {
	slog.WarnContext(ctx, "monitor down: initial alert sent", "monitor_id", e.MonitorID)
	return nil
}

func (e EscalateOutage) checkMonitorStatus(ctx context.Context) (bool, error) {
	monitor, err := model.Find[models.Monitor](ctx, e.MonitorID)
	if db.IsNotFound(err) {
		return false, nil
	}
	if err != nil {
		return false, err
	}

	return monitor.Status == models.MonitorDown, nil
}

func (e EscalateOutage) sendEscalationAlert(ctx context.Context) error {
	slog.ErrorContext(ctx, "monitor still down after 5 minutes", "monitor_id", e.MonitorID)
	return nil
}

Click through the 4 steps below to see how run.Sleep frees the worker immediately and survives deploys:

Fig 4 · 1/4How a Laravel Go durable workflow sleeps without holding a worker
Step 1 · Run initial alert step and persist result

Always give production workflows a WorkflowName() method, so refactoring your Go package path does not leave sleeping runs in SQL orphaned.

Just like in Rust, you also get run.WaitFor for external webhooks, signed /_workflow/resume URLs for human approval links, and CLI tools (workflow:list, workflow:show, workflow:retry, workflow:cancel).

Here is ./pingwatch route:list, ./pingwatch monitors:summary, and ./pingwatch workflow:list showing that real waiting monitors.escalate_outage run in SQLite:

Terminal output showing Pingwatch Go route:list, monitors:summary, and a waiting workflow in workflow:list

Realtime WebSockets, Inertia v3, Mail, and OpenTelemetry

Full-stack means everything from the database up to the browser, not just a JSON API.

Broadcasting and Go Reverb

Any Go event struct can be broadcasted over WebSockets by adding a BroadcastOn() method:

// events/monitor_status_changed.go
package events

import (
	"go.laravel.com/broadcast"

	"app/models"
)

type MonitorStatusChanged struct {
	MonitorID int64                `json:"monitor_id"`
	Name      string               `json:"name"`
	Status    models.MonitorStatus `json:"status"`
	LatencyMs int64                `json:"latency_ms"`
}

func (MonitorStatusChanged) BroadcastOn() []broadcast.Channel {
	return []broadcast.Channel{broadcast.Public("monitors")}
}

Laravel builds the wire payload from the struct’s JSON encoding, so unexported fields and anything tagged json:"-" will never leave the server.

Private and presence channels are authorized in routes/channels.go using the same model.FromRoute helpers you use in HTTP handlers.

Better yet, Laravel Go bundles a Reverb WebSocket server written in Go.

You can run laravel reverb:start locally along with laravel dev to test real-time updates with Laravel Echo over the Pusher protocol, and in production point your environment variables to the managed Reverb on Laravel Cloud.

Inertia v3, React 19, and Vite Plus

Every laravel new --go app comes pre-wired with Inertia v3, React 19, TypeScript, Tailwind CSS v4, and Vite Plus (vp build finished in 151–267 ms on my Mac).

Your Go handler returns inertia.Render("Monitors/Index", inertia.Props{...}) and your React component receives the props directly, with zero REST glue. Deferred props even accept a Go method value matching func(context.Context) (T, error) directly, and live props refresh a page automatically whenever a broadcast event fires.

Here is Pingwatch’s Monitors/Index.tsx dashboard served live by our 34 MB compiled Go binary:

Pingwatch Inertia v3 and React 19 dashboard served live by the compiled Laravel Go binary

And just like with Laravel Rust, Livewire is PHP-only, because it depends on Blade.

Flux for React (@fluxui-dev/react) works out of the box on top of Inertia v3 + React 19.

If you prefer server-rendered HTML without a JavaScript framework, Laravel Go embeds server-side templates from resources/views/ in the binary, and works great with htmx and Alpine.js.

Mail, OpenTelemetry, Social Login, and Feature Flags

A few more built-ins save days on real projects:

  • Typed Mailables: Build a mail.Message from a Go struct, render HTML and plain-text versions automatically, preview emails in your browser with mail.Render, and send via built-in Resend or Amazon SES transports with automatic mailer failover.
  • Zero-config OpenTelemetry + slog: Point OTEL_EXPORTER_OTLP_TRACES_ENDPOINT at Sentry, Grafana, or Jaeger and incoming requests, SQL queries, cache lookups, outgoing HTTP calls, and queue jobs emit timed spans automatically. Calling slog.InfoContext(ctx, ...) attaches the active request ID and job ID automatically.
  • Social login, feature flags, and <head> metadata: OAuth login for Google, GitHub, and Microsoft, persistent feature flags, and server-rendered SEO tags all ship in the framework.

Testing with tests.New, fakes, -race, and time travel

Testing in Laravel Go is so easy it’s almost unfair compared to writing httptest.NewRecorder() boilerplate code in plain Go.

Every test is a normal func Test...(t *testing.T) function. Calling tests.New(t) boots an isolated in-memory application with its own refreshed database, memory cache, sync queue, memory workflow store, and a clock you can control. You can run tests in parallel with t.Parallel() and pass Go’s built-in race detector (go test -race ./...) to catch shared-state concurrency bugs across handlers automatically.

Here is Pingwatch’s full integration test suite in tests/feature/monitors_test.go, which covers HTTP creation, queuetest.New fakes, 422 validation errors, partial PATCH, 404 route model binding, and time-traveling 5 minutes into the future to verify both branches of EscalateOutage:

// tests/feature/monitors_test.go
package feature_test

import (
	"fmt"
	"testing"
	"time"

	"go.laravel.com/db"
	"go.laravel.com/model"
	"go.laravel.com/queuetest"
	"go.laravel.com/workflowtest"

	"app/database/factories"
	"app/jobs"
	"app/models"
	"app/tests"
	"app/workflows"
)

func TestCreatingAMonitorPersistsAndQueuesACheck(t *testing.T) {
	client := tests.New(t)
	queues := queuetest.New(client)

	client.PostJSON("/api/monitors", map[string]any{
		"name":             "Flavio Copes Blog",
		"url":              "https://flaviocopes.com",
		"interval_seconds": 30,
	}).
		AssertCreated().
		AssertJSONPath("name", "Flavio Copes Blog").
		AssertJSONPath("status", "up")

	queues.AssertPushed[jobs.RunCheck]()
}

func TestInvalidMonitorPayloadReturns422(t *testing.T) {
	client := tests.New(t)

	client.PostJSON("/api/monitors", map[string]any{
		"name":             "",
		"url":              "not-a-url",
		"interval_seconds": 2,
	}).
		AssertUnprocessable().
		AssertInvalid("name", "url", "interval_seconds")
}

func TestPartialPatchOnlyUpdatesSentFields(t *testing.T) {
	client := tests.New(t)
	monitor := client.Create(factories.Monitor)

	client.PatchJSON(fmt.Sprintf("/api/monitors/%d", monitor.ID), map[string]any{
		"status": "paused",
	}).
		AssertOK().
		AssertJSONPath("name", monitor.Name).
		AssertJSONPath("status", "paused")
}

func TestOutageWorkflowEscalatesIfMonitorStaysDown(t *testing.T) {
	client := tests.New(t)
	monitor := client.Create(factories.Monitor.State(factories.MonitorDown))

	run := workflowtest.Start(client, workflows.EscalateOutage{MonitorID: monitor.ID})

	run.AssertStepRan("send initial alert")
	run.AssertSleeping()

	client.Travel(5 * time.Minute)
	run.Advance()

	run.AssertStepRan("send escalation alert")
	run.AssertCompletedWith("escalated")
}

All 8 feature tests ran in 0.470 seconds (and passed cleanly under go test -race ./... in 1.925 seconds):

Terminal output of go test running all Pingwatch feature and workflow tests in 0.470s

If you want to go deeper on testing patterns and CI pipelines across languages, check out my Testing, Debugging & CI/CD Handbook.

Built for coding agents: rebuilding ShipVote head-to-head

Just like Laravel Rust, every new Laravel Go app ships with AGENTS.md, CLAUDE.md and 7 built-in Agent Skills under .agents/skills/:

  • writing-laravel-go-apps
  • database-and-models
  • validation-and-input
  • auth-and-authorization
  • queues-and-workflows
  • testing-laravel-go-apps
  • inertia-frontend

Inside writing-laravel-go-apps/scripts/docs-path.sh there is one line:

go list -m -f '{{.Dir}}/docs' go.laravel.com

That prints the local directory inside your Go module cache that contains all the 68 version-matched Markdown documentation files for go.laravel.com@v0.1.0.

Your coding agent reads the exact APIs of the installed beta, instead of hallucinating PHP or Gin syntax.

To test the same real-world scenario we ran in Laravel Rust, I scaffolded ShipVote (laravel new shipvote --go, which finished in 6.92 seconds) and built the identical public roadmap voting board:

  • Session auth (register, login, logout) plus is_admin on User
  • Feature ideas with title, description, votes, and status (open, planned, in_progress, shipped)
  • Atomic upvote/remove-vote toggling inside a database transaction
  • Admin-only status changes enforced by a policy, queuing NotifyIdeaShipped when an idea ships
  • Author-or-admin deletion, Inertia v3 + React 19 UI, seeded data, and full integration tests

Reviewing the Go code compared with Rust

Start with routes/web.go. Guest-only routes sit inside auth.RedirectIfAuthenticated{}, authenticated mutations sit inside auth.Authenticate{}, and non-CRUD actions live in their own sub-resource packages (ideavotes and ideastatuses):

// routes/web.go
func Web(route *routing.Router, cfg *config.Config) {
	route.Get("/", ideas.Index).Name("home")

	route.Middleware(auth.RedirectIfAuthenticated{}).Group(func(route *routing.Router) {
		route.Get("/login", authhandlers.ShowLogin).Name("login")
		route.Post("/login", authhandlers.Login)
		route.Get("/register", authhandlers.ShowRegister).Name("register")
		route.Post("/register", authhandlers.Register)
	})

	route.Middleware(auth.Authenticate{}).Group(func(route *routing.Router) {
		route.Post("/logout", authhandlers.Logout).Name("logout")
		route.Post("/ideas", ideas.Store).Name("ideas.store")
		route.Delete("/ideas/{idea}", ideas.Destroy).Name("ideas.destroy")
		route.Post("/ideas/{idea}/votes", ideavotes.Store).Name("ideas.votes.store")
		route.Patch("/ideas/{idea}/status", ideastatuses.Update).Name("ideas.status.update")
	})
}

Policies sit right below the Idea struct in models/idea.go as plain functions returning auth.Ability[User]:

// models/idea.go (policy functions)
func UpdateIdeaStatus(idea *Idea) auth.Ability[User] {
	return func(user *User) error {
		if user.IsAdmin {
			return nil
		}
		return auth.Deny("Only administrators can change roadmap status.")
	}
}

func DeleteIdea(idea *Idea) auth.Ability[User] {
	return func(user *User) error {
		return auth.Allow(user.IsAdmin || user.ID == idea.UserID)
	}
}

Atomic voting lives in handlers/ideavotes/ideavotes.go using db.Transaction, model.Increment and model.Decrement:

// handlers/ideavotes/ideavotes.go
func Store(r *web.Request) *web.Response {
	idea, err := model.FromRoute[models.Idea](r, "idea")
	if err != nil {
		return web.Fail(err)
	}

	user := models.CurrentUser(r)

	err = db.Transaction(r, func(ctx context.Context) error {
		existing, err := model.Query[models.IdeaVote]().
			WhereEq("idea_id", idea.ID).
			WhereEq("user_id", user.ID).
			First(ctx)
		if err != nil && !db.IsNotFound(err) {
			return err
		}

		if err == nil {
			if err := model.Delete(ctx, &existing); err != nil {
				return err
			}
			return model.Decrement(ctx, &idea, "votes", 1)
		}

		vote := models.IdeaVote{IdeaID: idea.ID, UserID: user.ID}
		if err := model.Create(ctx, &vote); err != nil {
			return err
		}
		return model.Increment(ctx, &idea, "votes", 1)
	})
	if err != nil {
		return web.Fail(err)
	}

	return web.Back()
}

And admin status changes live in handlers/ideastatuses/ideastatuses.go:

// handlers/ideastatuses/ideastatuses.go
func Update(r *web.Request) *web.Response {
	idea, err := model.FromRoute[models.Idea](r, "idea")
	if err != nil {
		return web.Fail(err)
	}

	if err := auth.Authorize(r, models.UpdateIdeaStatus(&idea)); err != nil {
		return web.Fail(err)
	}

	form, err := r.Validate[UpdateIdeaStatus]()
	if err != nil {
		return web.Fail(err)
	}

	wasShipped := idea.Status == models.IdeaShipped

	if err := model.Update(r, &idea, db.Values{
		"status": form.Status,
	}); err != nil {
		return web.Fail(err)
	}

	if form.Status == models.IdeaShipped && !wasShipped {
		if _, err := queue.Dispatch(r, jobs.NotifyIdeaShipped{Idea: idea}); err != nil {
			return web.Fail(err)
		}
	}

	return web.Back()
}

The real compiler errors caught on the first build

Just like in the Rust build, the Go compiler caught 2 real API slips in less than a second:

# app/handlers/auth
handlers/auth/auth.go:53:30: undefined: validation.Error

# app/tests/feature_test
tests/feature/ideas_test.go:30:18: in call to client.ActingAs,
  type models.User of user does not match *U (cannot infer U)

Both took seconds to check in the bundled docs:

  • auth.Attempt already returns a structured validation error on the email field when credentials don’t match, so you pass err straight to web.Fail(err) instead of constructing a manual validation error.
  • client.ActingAs(&user) takes a pointer *models.User, not a value. (Notice one nice ergonomic detail: unlike Laravel Rust where .acting_as(&user) goes after .post(...), Laravel Go keeps the classic client.ActingAs(&user).Post(...) order.)

After those 2 fixes, go test -race ./..., go vet ./..., npm run types:check and npm run build all passed.

Here is the live ShipVote board, served by the compiled 33 MB Go binary, logged in as admin:

ShipVote Inertia v3 and React 19 roadmap voting board served live by the compiled Laravel Go binary

And here is ./shipvote route:list alongside all 10 integration tests passing in 0.614 seconds:

Terminal output showing ShipVote Go routes and all 10 integration tests passing in 0.614s

ShipVote head-to-head: Laravel Go vs Laravel Rust

Metric (ShipVote on same Mac)Laravel Go 0.1.0Laravel Rust 0.1.4
Warm project scaffold (laravel new shipvote)6.92s29.7s
Application code written21 files, 1,193 lines (846 Go + 347 React/TS)18 files, 1,209 lines (780 Rust + 429 React/TS)
First-compile mismatches caught2 (fixed via bundled docs)3 (fixed via bundled docs)
Full integration test run0.37s–0.61s (2.06s with -race)0.04s (after 0.88s incremental compile)
Static checks0 go vet warnings, 0 -race warnings, 0 TS errors0 Clippy warnings, 0 TS errors
Frontend bundle (vp build)151 ms454 ms
Release binary build0.96s, 33 MB single binary33.56s, 41 MB single binary
Live binary RSS after serving requests31.3 MB29.8 MB
Live GET / Inertia response (SQLite + auth)0.85 ms warm (19.5 ms first lazy open)1.2 ms warm (5.9 ms first)

Those numbers tell a clear story.

Code length is almost identical (1,193 vs 1,209 lines), and live memory plus warm response latency are a virtual tie (0.85 ms vs 1.2 ms, 31.3 MB vs 29.8 MB).

Where Go pulls away is the build: our release binary is 8 MB smaller, and compiles 35 times faster.

Building for production, cross-compiling, and Laravel Cloud

Deploying a Laravel Go app is as simple as deploying gets.

Build your Vite frontend bundle and compile your Go binary:

npm run build
go build -ldflags="-s -w" -o pingwatch .

Need a Linux x86-64 binary from an Apple Silicon Mac to run on a cheap VPS?

One command, no Docker involved:

GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o pingwatch .

Copy the single binary alongside public/ and storage/ (remember resources/views/ is already compiled inside the binary!)

Set APP_ENV=production, APP_DEBUG=false, APP_KEY, SERVER_HOST=0.0.0.0, and run:

./pingwatch migrate --force
./pingwatch

Laravel Go drains in-flight requests cleanly on SIGTERM (20 seconds by default, configurable via SERVER_SHUTDOWN_TIMEOUT), closes SSE streams, runs final RunOnShutdown ticks, and caps concurrent TCP connections at 8,192 (SERVER_MAX_CONNECTIONS) so a traffic spike cannot run a small server out of memory.

If you self-host on a VPS, my Linux Server Handbook covers systemd services, reverse proxies, TLS, and more.

Deploying on Laravel Cloud

Just like Laravel Rust, Laravel Go runs on Laravel Cloud out of the box with zero Dockerfile.

Cloud detects your go.mod, provisions managed PostgreSQL or MySQL, Valkey caches, scale-to-zero Flex compute, managed SQS-backed queues (QUEUE_CONNECTION=cloud), managed Reverb WebSockets, and a built-in scheduler.

Set your build and deploy commands to:

# Build commands
npm ci && npm run build
go build -o app .

# Deploy commands
./app migrate --force

And because Laravel Cloud runs PHP, Rust, and Go inside the same organization and lets them share a managed database, you can run a Laravel Go service right next to an existing Laravel PHP monolith and move hot endpoints over gradually.

How I would choose between Laravel Go, Laravel Rust, and Laravel PHP

Now that Laravel ships official PHP, Rust and Go frameworks, the real question is no longer “compiled vs interpreted”.

The real question is Laravel Go vs Laravel Rust (and when to stay on Laravel PHP).

Choosing between Laravel Go, Laravel Rust, and Laravel PHPDecision guide for choosing Laravel PHP for existing apps or PHP packages, Laravel Go as the fast-building compiled default, or Laravel Rust when strict compile-time SQL and zero-GC guarantees matter most.YesNoYesNoStarting or evolvinga Laravel app?Need PHP ecosystempackages, Filament,Livewire, or AgentKit today?Use Laravel PHP 13Do you want strictcompile-timeSQL/route checks andzero GC pauses?Use Laravel RustDefault to LaravelGo

Why I would default to Laravel Go for most new apps

Here’s my honest take after building Pingwatch and ShipVote in both:

  • Default for new SaaS apps, internal tools, and APIs: Once both hit 1.0, I would reach for Laravel Go first on most new full-stack projects. You get compiled single-binary speed (7,600+ local RPS, ~25–30 MB RAM), 1-second production builds, tiny disk usage, one-command Linux cross-compilation from macOS, built-in -race testing, and plain Go code that I can read from top to bottom without decoding proc-macros or fighting async lifetimes.
  • High-concurrency backends and webhooks: Go was literally designed for juggling thousands of concurrent network connections, background jobs, and long-lived WebSocket connections. Pairing Go’s runtime with Laravel’s validation, migrations, durable workflows, and Reverb gives you a stack that used to take weeks to assemble.
  • Working with coding agents: Both frameworks ship version-matched docs in .agents/skills/, so agents write solid code in either one. The difference is loop speed: a 1-second compile-and-test cycle lets an agent iterate five times in the time a cold Rust build finishes once, and reviewing the Go diff takes me half the mental effort.

Where Laravel Rust still wins

Do not skip Laravel Rust if these matter to your team:

  • Maximum compile-time guarantees. Laravel Rust checks SQL column expressions (Monitor::status.eq(...)), route targets (route!(monitors::api_show)), mandatory authorization (#[validate(anyone)]), and non-serializable PasswordHash types at compile time. In Go, a mistyped column string is caught in tests, a missing auth.Authorize call is caught in code review, and keeping json:"-" on Password is a convention you have to preserve.
  • Zero garbage collection pauses and tightest memory ceiling. For latency-critical systems where even sub-millisecond GC pauses matter, or ultra-dense multi-tenant compute, Rust’s ownership model still has the highest ceiling.

Where Laravel Go is not the right fit (yet)

A few clear boundaries apply right now:

  • It is a 0.1.0 beta. APIs and config formats will change before 1.0. If you are shipping a mission-critical production app this week and cannot handle beta upgrades over the next couple of months, stay on Laravel PHP 13.
  • PHP ecosystem depth. Filament, Nova, Livewire, Cashier, Spatie’s catalog, and Laravel’s new Converse and Agent Kit live in PHP. If those packages are the reason you picked Laravel, PHP is still the right choice.
  • Static sites and edge micro-workers. For content sites like flaviocopes.com, Astro is simpler and faster at the edge. For tiny globally distributed edge endpoints, Cloudflare Workers still beat a regional origin server.

Two days ago this felt like a dream. Now you can choose between the strictness of Rust and the build speed of Go, with the same conventions, workflows, Reverb WebSockets, Inertia frontend, and Laravel Cloud platform underneath.

Install the new laravel CLI, run laravel new my-app --go, and try building a small service with it this week.

If you want a solid refresher on Go 1.27 modules, generics, goroutines, context, -race testing and more, keep my free Go Handbook open next to your editor.

Want me to talk about your product? You can sponsor this site.

Related posts about laravel: