Note
Build an admin panel for Laravel Go, step by step
A fresh Laravel for Go app, a sign-in page, a users table and an edit form, in about fifteen minutes. Every step was run as written, and you write no React.
This guide takes a brand-new Laravel for Go app to a working admin panel: a sign-in page, a users table with search, sorting and CSV export, and a form that edits a user. No React to write, no Vite to configure. It takes about fifteen minutes.
Every step below was run as written on Laravel for Go 0.2 and the go branch of Tabletop at commit 4e9472b. The port is early alpha: if a step breaks on a newer commit, tell us.
What you need
- Go 1.27 or newer.
- The Laravel installer with Go support (
laravel new --go). - Nothing for the admin's frontend. The panel serves a prebuilt React client from inside the Go module.
1. Create the app
laravel new --go my-admin
cd my-adminThe skeleton talks to Postgres. For a quick start, switch it to SQLite: in bootstrap/app.go import go.laravel.com/db/sqlite instead of go.laravel.com/db/postgres and set Drivers: []db.Driver{sqlite.Driver}. Then point .env at a file:
DATABASE_URL=sqlite:storage/database.sqlite2. Add Tabletop
The Go port has no tagged release yet, so take it straight from the go branch. Go resolves the branch to a pseudo-version and pins it in go.mod:
go get github.com/DiVotek/tbtop/packages/go@go
go mod tidy3. Describe the panel
A panel is an admin.Panel value: where it lives, what it is called, who the signed-in user is and which pages it has. Create panel/panel.go:
package panel
import (
"github.com/DiVotek/tbtop/packages/go/admin"
"go.laravel.com/auth"
"go.laravel.com/web"
"app/models"
)
func Admin() *admin.Panel {
return &admin.Panel{
ID: "admin",
Prefix: "/admin",
Brand: "My Admin",
LoginPath: "/admin/login",
Driver: admin.SQLDriver{},
User: func(r *web.Request) any {
return models.CurrentUser(r.Context())
},
Logout: auth.Logout,
Pages: []*admin.Page{
loginPage(),
usersPage(),
userEditPage(),
},
}
}Authentication stays with the app. models.CurrentUser and auth.Logout already come with the skeleton, and the panel only asks who is signed in.
4. A sign-in page
The skeleton has no login screen, so the panel gets one. It is an ordinary page: public, centred, and a form whose submit calls Laravel for Go's auth.Attempt. Put it in panel/login.go:
type loginInput struct {
Email string `json:"email"`
Password string `json:"password"`
}
func loginPage() *admin.Page {
return &admin.Page{
Path: "login",
Title: "Sign in",
Layout: "center",
Public: true,
Middleware: []web.Middleware{auth.RedirectIfAuthenticated{}},
View: func(s *admin.S, _ *admin.PageCtx) (admin.Node, error) {
return s.FormFor[loginInput]("login",
s.Text("email").Label("Email").Required().Rules("email"),
s.Password("password").Label("Password").Required(),
s.ActionsRow(s.Action("submit").Label("Sign in").
Color(admin.ColorPrimary).Submit()),
).GuardUnsaved(false).Record(loginInput{}).
OnSubmit(func(ctx *admin.ActionCtx, in loginInput) (admin.Outcome, error) {
if err := auth.Attempt(ctx.Request, in.Email, in.Password, false); err != nil {
return nil, err
}
return admin.Redirect("/admin/users"), nil
}), nil
},
}
}A wrong password comes back from auth.Attempt as an input error on email, and the form shows it under that field. Nothing to wire.
5. The users table
A table is built over a model with s.TableFor. Columns, search, sorting and export are one chain, and RecordURL makes each row open its edit page. In panel/users.go:
func usersPage() *admin.Page {
return &admin.Page{
Path: "users",
Title: "Users",
Nav: &admin.NavEntry{Label: "Users", Icon: "users"},
View: func(s *admin.S, _ *admin.PageCtx) (admin.Node, error) {
return s.TableFor[models.User]().
Columns(
admin.Col("name").Label("Name").Sortable().Searchable(),
admin.Col("email").Label("Email").Sortable().Searchable(),
admin.Col("created_at").Label("Joined").Date("Y-m-d").Sortable(),
).
DefaultSort("created_at", "desc").
RecordURL(func(user models.User) string {
return "/admin/users/" + admin.ToString(user.ID) + "/edit"
}).
HeaderActions(s.ExportAction(admin.ExportOpts{Filename: "users"})), nil
},
}
}6. The edit form
The form is typed: FormFor[userInput] decodes the submit into a struct, after the rules ran on the server. Unique(...).Ignore(user.ID) lets a user keep their own email:
type userInput struct {
Name string `json:"name"`
Email string `json:"email"`
}
func userEditPage() *admin.Page {
return &admin.Page{
Path: "users/{user}/edit",
Title: "Edit user",
View: func(s *admin.S, page *admin.PageCtx) (admin.Node, error) {
user, err := model.Find[models.User](page, page.Params["user"])
if err != nil {
return nil, err
}
return s.FormFor[userInput]("user",
s.Text("name").Label("Name").Required().Rules("max:255"),
s.Text("email").Label("Email").Required().Rules("email").
Unique("users", "email").Ignore(user.ID),
s.ActionsRow(s.Action("save").Label("Save").
Color(admin.ColorPrimary).Submit()),
).Record(user).OnSubmit(func(ctx *admin.ActionCtx, in userInput) (admin.Outcome, error) {
values := db.Values{"name": in.Name, "email": in.Email}
if err := model.Update(ctx, &user, values); err != nil {
return nil, err
}
return admin.NewEffects().Notify("User saved."), nil
}), nil
},
}
}users.go imports admin, go.laravel.com/db, go.laravel.com/model and app/models.
7. Install the panel
The panel is a Laravel for Go package. Add it to laravel.Options in bootstrap/app.go, with github.com/DiVotek/tbtop/packages/go/admin and app/panel in the imports:
return laravel.Options{
Packages: []laravel.Package{
admin.New(panel.Admin()),
},
// Routes, Middleware and the rest stay as the skeleton wrote them.
}8. Run it
go run . key:generate
go run . migrate:fresh --seed
go run .Open /admin/users. A guest is sent to /admin/login; sign in as the user the skeleton seeds, test@example.com with the password password. You get the table with search, sorting and export, a click on the row opens the form, and Save shows a toast.
Before it leaves your laptop
In this guide every signed-in user is an admin: anyone who can sign in can open the panel and edit any user. Decide who may get in before you deploy. Panel.Middleware runs for every route of the panel, pages and endpoints alike, so a role check there covers everything; a page's own Middleware covers that page and its endpoints. The demo app keeps a role column on users for this.
Where the React went
Nowhere you have to look after. The module embeds a prebuilt build of the Tabletop client with go:embed, about 0.8 MB gzipped, and serves it under /vendor/tbtop-admin/. The panel's pages render through the package's own root view, so your app keeps its Vite setup for its own pages and the admin needs none. The same client renders tbtop/admin on Laravel and the Node.js and Rust ports.
Next steps
The demo app on the go branch, apps/go-demo, goes much further: posts with translatable fields, relations, filters, tabs, soft deletes, a media library, notifications and an MCP server for AI agents. Read its panel/ folder next to this guide. What the port is and how it fits Laravel for Go is on the Go admin builder page.
It is early alpha, so things will break. When they do, open an issue with the commit you were on.