Go has become a popular choice for backend development because it offers fast compilation, built-in concurrency, a strong standard library, and straightforward deployment. Developers can build web servers using Go's standard net/http package or choose frameworks that provide additional features such as routing, database access, authentication, and background jobs.
However, building a complete web application with Go often means selecting and integrating several independent libraries. One package handles routing, another manages database queries, and additional tools handle validation, queues, sessions, and frontend integration.
Laravel Go takes a different approach. Released in beta on December 2, 2026, it brings Laravel's full-stack development experience to the Go ecosystem while keeping Go's programming conventions.
It provides routing, middleware, validation, database models, migrations, authentication, queues, workflows, mail, WebSockets, and testing utilities. Underneath these features, it uses Go's standard net/http package and goroutines rather than depending on another web framework.
This article explains what Laravel Go is, how to install it, how to create a web application, and how to build common backend features using its APIs. It also covers the framework's architecture, database integration, background processing, testing, and deployment considerations.
What Is Laravel Go?
Laravel Go is a full-stack web application framework that brings Laravel's conventions and development tools to Go.
It is designed for developers who want the performance and simplicity of Go without assembling every part of a web application independently.
The framework uses Go's standard library as its foundation. This means an application can integrate with existing Go handlers and middleware instead of requiring developers to adopt an entirely separate HTTP stack.
Some of its main features include:
Routing and middleware.
Request handling and typed validation.
Sessions, cookies, and authentication.
Database queries, models, and migrations.
Cache and Redis integration.
Background jobs and queue processing.
Concurrent tasks and durable workflows.
Email and notifications.
Event broadcasting and WebSockets.
React, Vue, and Svelte integration through Inertia.
Server-rendered views and templates.
Automated testing and OpenTelemetry tracing.
Laravel Go is written in idiomatic Go. It uses ordinary structs, interfaces, functions, generics, and context.Context rather than trying to reproduce PHP syntax in another language.
How Laravel Go Differs From Laravel PHP
Laravel PHP and Laravel Go share a development philosophy, but they are different frameworks built for different language ecosystems.
Laravel PHP provides a mature application framework with an extensive package ecosystem. Laravel Go uses Go's standard HTTP server, goroutines, and explicit dependency management.
Area | Laravel PHP | Laravel Go |
|---|
Language | PHP | Go |
Execution model | PHP runtime and application server environment | Compiled Go application |
HTTP foundation | Laravel's PHP application stack | Go net/http |
Concurrency | PHP runtime and supported server models | Goroutines |
Models | PHP classes and Eloquent | Go structs and generic model builders |
Validation | Laravel validation rules | Typed Go structs and validation rules |
Dependencies | Composer | Go modules |
Frontend integration | Blade and Inertia | Views and Inertia |
Deployment | PHP runtime environment | Compiled Go binary |
Laravel Go is not a replacement for Laravel PHP. It is another option for teams that prefer Go for backend development.
It is also important to remember that Laravel Go is currently in beta. APIs and configuration may change before version 1.0, so developers should check the documentation and release notes before upgrading an application.
Prerequisites for Laravel Go
Before creating an application, install the required development tools.
The current Laravel Go installation guide requires:
Tool | Requirement |
|---|
Go | 1.27 or later |
Node.js | LTS release |
Git | Installed and available in the terminal |
Laravel CLI | Latest Laravel Go-compatible CLI |
Database | PostgreSQL by default, with other supported options |
You can check the installed Go version:
go version
Check Node.js and npm:
node --version
npm --version
Check Git:
git --version
Make sure the versions meet the framework's current installation requirements before continuing.
Installing the Laravel CLI
Laravel Go uses the Laravel CLI to create applications and execute framework commands.
On macOS and Linux, install the CLI using:
curl -fsSL https://laravel.com/install.sh | sh
On Windows, use PowerShell:
powershell -ExecutionPolicy Bypass -c "irm https://laravel.com/install.ps1 | iex"
After installation, open a new terminal and verify that the CLI is available:
laravel --version
The new CLI is installed in the user's Laravel binary directory and adds that location to PATH.
If you already have Laravel Herd or an older Composer-based Laravel installer, check which laravel command your terminal executes. Multiple installations can create PATH conflicts.
On macOS and Linux, use:
which -a laravel
On Windows, use:
Get-Command laravel -All
Make sure the terminal resolves the new Laravel CLI before creating the Go application.
Creating Your First Laravel Go Application
Once the prerequisites are installed, create a new project:
laravel new example-app --go
Move into the project directory:
cd example-app
The CLI creates the application structure, prepares the environment configuration, installs frontend dependencies, and compiles the application.
The generated application includes Inertia, React, TypeScript, Tailwind CSS, and Vite Plus as its initial frontend setup.
The Go module is named app, so application packages use imports such as app/models and app/handlers.
A simplified project structure looks like this:
example-app/
app/
bootstrap/
app.go
database/
migrations/
seeders/
handlers/
jobs/
models/
resources/
views/
routes/
web.go
api.go
services/
services.go
tests/
.env
go.mod
go.sum
package.json
The exact structure may grow as the application develops. The important idea is that Laravel Go separates routing, handlers, models, services, database operations, and background jobs into recognizable areas.
Understanding the Laravel Go Application Architecture
Laravel Go follows a structured application architecture.
When a browser or API client sends a request, the framework matches it against the registered routes. Middleware can process the request before it reaches the handler.
The handler performs the required application operation, which may include validation, database access, or calling another service. It then returns an HTTP response.
A simplified request flow looks like this:
HTTP Client
|
v
Go net/http Server
|
v
Laravel Routing
|
v
Middleware
|
v
Request Handler
|
+------> Validation
|
+------> Models / Database
|
+------> Application Services
|
v
Response
|
v
HTTP Client
The application is compatible with Go's http.Handler interface. Laravel's web.Request also embeds the standard http.Request.
This is useful because developers can integrate existing Go HTTP handlers and middleware into the application.
Explicit Dependency Management
Laravel Go does not rely on a hidden dynamic dependency container for application services.
Instead, shared dependencies are initialized at startup and made available through the framework's services and context mechanisms.
This makes application dependencies easier to identify, replace, and test.
For example, an application may initialize a database-related service, an email client, and an external API client once during startup.
Request-specific information and database transaction context can then flow through context.Context.
This approach follows common Go practices and makes the relationship between application components more explicit.
Creating Routes and Request Handlers
Routing is one of the first features developers need when building a web application.
Laravel Go registers web routes in routes/web.go and API routes in routes/api.go.
You can define a route using an inline function or connect it to a handler function in another package.
Consider the following example:
// routes/web.go
package routes
import (
"go.laravel.com/config"
"go.laravel.com/routing"
"go.laravel.com/web"
"app/handlers/posts"
)
func Web(
route *routing.Router,
cfg *config.Config,
) {
route.Get(
"/greeting",
func(r *web.Request) *web.Response {
return web.Text("Hello World")
},
)
route.Get(
"/posts",
posts.Index,
).Name("posts.index")
route.Get(
"/posts/{post}",
posts.Show,
).Name("posts.show")
route.Post(
"/posts",
posts.Store,
).Name("posts.store")
}
The example defines four routes.
The greeting route returns a simple text response. The posts routes connect requests to handler functions in the posts package.
Named routes make it easier to generate URLs and redirect users without manually repeating route paths.
For example:
web.RedirectRoute(
"posts.show",
"post",
post.ID,
)
Laravel Go also supports route groups, middleware, and route model binding.
Route model binding can load a model using a route parameter and return a 404 response when the requested record does not exist.
This helps keep handlers focused on application behavior instead of repeating lookup logic.
Validating Requests With Go Structs
Request validation is important for both web forms and APIs.
Laravel Go uses ordinary Go structs with JSON tags and a Rules method to describe incoming data.
For example, suppose an application allows users to create posts.
Create a form structure:
package posts
import (
"go.laravel.com/model"
"go.laravel.com/validation"
"go.laravel.com/validation/rule"
"app/models"
)
type StorePost struct {
Title string `json:"title"`
Body string `json:"body"`
}
func (f *StorePost) Rules() validation.Rules {
return validation.For(
f,
rule.Field(
&f.Title,
rule.Required,
rule.Max(255),
model.Unique[models.Post](),
),
rule.Field(
&f.Body,
rule.Required,
),
)
}
The structure defines two fields: Title and Body.
The Rules method describes the validation requirements.
For example, the title is required, must not exceed 255 characters, and must be unique in the Post model. The body is also required.
The framework uses pointers to the struct fields when defining validation rules. This connects validation directly to the Go type system instead of relying entirely on manually typed field names.
Using Validation in a Handler
The handler can validate the request before creating the database record.
func Store(r *web.Request) *web.Response {
form, err := r.Validate[StorePost]()
if err != nil {
return web.Fail(err)
}
post := models.Post{
Title: form.Title,
Body: form.Body,
}
if err := model.Create(r, &post); err != nil {
return web.Fail(err)
}
return web.RedirectRoute(
"posts.show",
"post",
post.ID,
)
}
The Validate method binds incoming request data to the StorePost structure and applies the declared rules.
If validation fails, web.Fail handles the error. Browser requests can be redirected back with validation errors, while API clients receive a 422 response.
This approach keeps request parsing and validation close to the data structure that describes the request.
Working With Database Models
Laravel Go includes an ORM-style model layer built around ordinary Go structs.
Each model field represents a database column. Relationships can be declared using model struct tags.
For example:
package models
import "time"
type Post struct {
ID int64 `json:"id"`
UserID int64 `json:"user_id"`
Title string `json:"title"`
Body string `json:"body"`
Votes int64 `json:"votes" db:",default"`
PublishedAt *time.Time `json:"published_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
User *User `json:"user,omitzero" model:"belongs_to"`
Comments []Comment `json:"comments,omitzero" model:"has_many"`
}
The Post structure represents a database record.
It also defines two relationships:
The model tags describe the relationship types.
Querying Models
Laravel Go provides generic query builders that return typed results.
For example:
posts, err := model.Query[models.Post]().
WhereNotNull("published_at").
WhereGe("votes", 10).
Latest("published_at").
With("user", "comments").
Limit(10).
Get(r)
if err != nil {
return web.Fail(err)
}
This query retrieves published posts with at least ten votes, orders them by publication date, loads their user and comment relationships, and limits the result to ten records.
The result is a typed slice of Post models.
The With method is particularly useful because relationships are loaded explicitly. Reading a relationship field does not silently execute another database query.
This helps prevent accidental N+1 query problems.
Database Migrations and Configuration
Database migrations help developers manage schema changes over time.
Laravel Go provides a schema builder that supports PostgreSQL, MySQL, MariaDB, and SQLite.
Migrations are written in Go and stored in the database/migrations directory. They are compiled into the application binary along with other application resources.
This means a deployed application can run its migrations without requiring the original source tree to be present.
New applications use PostgreSQL by default.
The database connection is configured through the DATABASE_URL environment variable:
DATABASE_URL=postgres://user:password@localhost/laravel
For a local application, configure the connection details according to your PostgreSQL installation.
Then run:
laravel migrate
Laravel Go can also use SQLite, MySQL, or MariaDB.
For example, an SQLite configuration can use:
DATABASE_URL=sqlite:storage/database.sqlite
When switching database drivers, update the driver imports and configuration in bootstrap/app.go, then run:
go mod tidy
For production applications, use the same database engine in development and production whenever practical. This helps identify differences in SQL behavior, migrations, and data types before deployment.
Running Background Jobs With Queues
Not every operation should happen while an HTTP request is waiting for a response.
For example, generating a report, processing an uploaded file, sending an email, or preparing a video may take longer than a typical request should remain open.
Laravel Go includes a queue system for moving this work outside the request lifecycle.
A queued job can be represented by a Go struct with a Handle method.
package jobs
import (
"context"
"app/models"
"app/services"
)
type ProcessPodcast struct {
Podcast models.Podcast `queue:"model"`
}
func (j ProcessPodcast) Handle(
ctx context.Context,
) error {
return services.From(ctx).
Audio.Process(ctx, j.Podcast)
}
The Handle method contains the work performed by the queue worker.
The queue:model tag tells the framework to store the model's identifier rather than serializing the complete model object. When the job runs, Laravel loads a fresh record.
This is useful when the underlying model may change between job dispatch and execution.
Dispatching a Job
A handler can dispatch the job:
_, err := queue.Dispatch(
r,
jobs.ProcessPodcast{
Podcast: podcast,
},
)
if err != nil {
return web.Fail(err)
}
Laravel Go provides a common queue API for database-backed queues, Redis, Amazon SQS, and Laravel Cloud managed queues.
It also supports retries, job middleware, chains, and batches.
For production applications, configure retry limits and failure handling according to the type of work being processed. A job that sends an email, for example, should be designed carefully so that retries do not accidentally send duplicate messages.
Running Concurrent Tasks
Go provides goroutines for concurrent execution. Laravel Go builds on this model with a task package that helps run related operations concurrently while preserving application context.
Suppose a dashboard needs the number of users and the number of orders.
Both queries are independent, so they can run concurrently.
package dashboard
import (
"context"
"go.laravel.com/db"
"go.laravel.com/task"
"go.laravel.com/web"
)
func Show(r *web.Request) *web.Response {
var users int
var orders int
err := task.Run(
r,
func(ctx context.Context) error {
var err error
users, err = db.Table("users").Count(ctx)
return err
},
func(ctx context.Context) error {
var err error
orders, err = db.Table("orders").Count(ctx)
return err
},
)
if err != nil {
return web.Fail(err)
}
return web.JSON(
map[string]int{
"users": users,
"orders": orders,
},
)
}
The task.Run function executes the independent operations concurrently.
If one task fails, the framework cancels the remaining task contexts. This allows in-flight database queries and HTTP operations that respect the context to stop early.
The framework also provides task.Go for launching an individual goroutine and collecting its result later.
This is useful when a request needs information from multiple independent services.
However, concurrency should be used where operations are genuinely independent. Running too many database queries simultaneously can increase connection pressure rather than improve response time.
Building Frontends With Inertia
Laravel Go supports modern frontend development through Inertia.
Inertia allows developers to build applications using React, Vue, or Svelte without maintaining a completely separate JSON API for every page.
A handler can return an Inertia response with properties that the frontend receives.
For example:
package posts
import (
"go.laravel.com/inertia"
"go.laravel.com/model"
"go.laravel.com/web"
"app/models"
)
func Index(r *web.Request) *web.Response {
posts, err := model.Query[models.Post]().
Latest("created_at").
Limit(20).
Get(r)
if err != nil {
return web.Fail(err)
}
return inertia.Render(
"Posts/Index",
inertia.Props{
"posts": posts,
},
)
}
The handler loads the required records and passes them to the Posts/Index frontend page.
Laravel Go also supports deferred props, live props, prefetching, polling, flash data, history encryption, and server-side rendering.
For applications that do not need a JavaScript frontend, the framework also provides server-rendered views and templates.
Testing Laravel Go Applications
Testing is an important part of backend development.
Laravel Go integrates with Go's standard testing package and provides helpers for testing the complete HTTP application.
For example:
package posts_test
import (
"net/url"
"testing"
"go.laravel.com/tests"
)
func TestGuestsCannotPublishPosts(
t *testing.T,
) {
client := tests.New(t)
client.Post(
"/posts",
url.Values{
"title": {"Hello"},
"body": {"World"},
},
).AssertRedirect("/login")
}
The tests.New(t) helper boots an isolated application for testing.
The test can send HTTP requests and verify the response without manually starting a separate server.
Laravel Go also provides testing support for application fakes and time-dependent logic.
You can use the standard Go test command:
go test ./...
For continuous integration, run tests alongside formatting, linting, and frontend checks.
The framework's development tooling also provides:
npm run check
This checks frontend formatting, lint rules, and types.
Running the Application Locally
After configuring the database, run the migrations:
laravel migrate
Start the development environment:
laravel dev
This command starts the application, a queue worker, and Vite Plus together.
Open the application in a browser:
http://127.0.0.1:8000
The development command also rebuilds and restarts the Go application when Go source files or the environment configuration change.
Frontend changes are handled through Vite's hot-reloading workflow.
You can list the application's registered routes using:
laravel route:list
To see the other available application commands, run:
laravel list
Deploying a Laravel Go Application
Laravel Go applications can be deployed as compiled Go binaries.
Before building the application for production, compile the frontend assets:
npm run build
Then build the Go application:
go build -o app .
Run the binary:
./app
The application can be deployed to your own infrastructure or to Laravel Cloud.
Before deploying, review the production environment configuration.
For example:
APP_ENV=production
APP_DEBUG=false
Debug mode should remain disabled in production because detailed error pages may expose internal error messages and stack traces.
Health Checks
Laravel Go includes a health-check route that can be used by load balancers and monitoring systems.
The default route is:
/up
It returns a successful response once the application has started.
You can configure the health-check path in bootstrap/app.go.
A production deployment should use health checks to verify application availability and detect unhealthy instances.
Database and Queue Configuration
Production applications should use managed or properly maintained database and queue services.
Laravel Go supports PostgreSQL, MySQL, Redis, and Amazon SQS queue integrations, along with Laravel Cloud managed services.
Keep database credentials, API keys, and encryption secrets in environment configuration or an appropriate secrets-management system.
Do not commit the .env file to source control.
Laravel Go Compared With Other Go Web Frameworks
Go already has several established web frameworks and libraries.
Laravel Go enters an ecosystem where developers can choose between a minimal standard-library approach and more feature-rich frameworks.
Framework or approach | Main focus | Typical use |
|---|
Go net/http | Standard HTTP server and handlers | Small services and custom backend architectures |
Gin | Lightweight HTTP framework | REST APIs and microservices |
Echo | HTTP framework with middleware and routing | APIs and web applications |
Fiber | Express-inspired web framework | Fast HTTP applications |
Laravel Go | Full-stack application framework | Applications needing integrated backend and frontend features |
The main difference is the number of features provided together.
With net/http, developers can build almost anything, but they need to select and integrate additional libraries.
Frameworks such as Gin and Echo provide routing and middleware while leaving other architectural choices to the application.
Laravel Go provides a more integrated structure, including models, validation, migrations, queues, workflows, authentication, and frontend integration.
This can reduce initial setup work, although it also means adopting the framework's conventions and lifecycle.
Best Practices for Building Applications With Laravel Go
When starting a Laravel Go project, consider these practices:
Keep routes focused on mapping requests to handlers.
Move complex business logic into dedicated application packages.
Use typed request structs for validation.
Define models and relationships clearly.
Load relationships explicitly to avoid unnecessary database queries.
Use context.Context for request-specific operations.
Initialize shared dependencies at application startup.
Move long-running work into queues.
Use concurrent tasks only for independent operations.
Write integration tests for important HTTP workflows.
Keep environment secrets outside source control.
Test migrations against the same database engine used in production.
Review beta release notes before upgrading framework versions.
Since Laravel Go is still in beta, avoid assuming that its current APIs and configuration will remain unchanged before version 1.0.
For a business-critical application, evaluate the framework's maturity, documentation, package ecosystem, upgrade process, and support requirements before committing to it.
Advantages and Limitations of Laravel Go
Laravel Go provides several advantages for developers who want to build complete applications with Go.
It combines routing, validation, database access, queues, authentication, and frontend integration under one framework. Its foundation in net/http also makes it easier to work with existing Go HTTP libraries.
The use of ordinary Go types and explicit service dependencies keeps the programming model familiar to Go developers.
However, there are limitations to consider.
The framework is new and still in beta. Its ecosystem is smaller than established Go frameworks, and APIs may change before the first stable release.
It also introduces framework-specific conventions that developers must learn. Teams that prefer minimal dependencies or full control over every backend component may find the standard library or a smaller framework more suitable.
Summary
Laravel Go brings Laravel's full-stack development philosophy to the Go ecosystem.
Built directly on Go's net/http package and goroutines, it provides routing, typed validation, models, database migrations, authentication, queues, workflows, WebSockets, and Inertia integration.
Developers can create an application using the Laravel CLI, define routes and handlers, work with typed database models, validate incoming requests, and move long-running operations into background queues.
Its integrated tooling can reduce the amount of setup required to build a modern Go web application.
Laravel Go is still in beta, so developers should evaluate its current capabilities and potential API changes before adopting it for critical production systems.
For teams that want Go's programming model together with Laravel's batteries-included approach, it is a framework worth exploring.
Join the conversation! Your thoughts help the community grow.