GoFilament
You're reading the docs for v1.36.0, an older release. Go to v1.40.1 (latest).

Docs v1.36.0 Guide

Quickstart: Building an Admin Panel

1. Configure the Panel#

package main

import (
    "github.com/golaravel/gofilament/pkg/filament"
    "github.com/golaravel/gofilament/pkg/widgets"
    "github.com/golaravel/golaravel/pkg/golaravel"
)

func main() {
    app := golaravel.Default()

    // 1. Configure Panel
    adminPanel := filament.NewPanel("admin").
        Path("/admin").
        BrandName("Acme Operations").
        DarkMode(true).
        SidebarCollapsibleOnDesktop().
        MaxContentWidth(filament.Width7xl).
        NavigationGroups([]string{
            "Staff & Permissions",
            "Shop Management",
        })

    // 2. Add Dashboard KPI Widget with Sparklines
    adminPanel.Widget(widgets.NewStatsOverviewWidget(func(ctx *filament.Context) []widgets.Stat {
        return []widgets.Stat{
            *widgets.NewStat("Total Revenue", "$128,430").
                Description("+32% this month").
                Color("success").
                Chart([]int{15, 22, 35, 45, 60, 78, 128}),
            *widgets.NewStat("Active Orders", "84").
                Description("5 pending dispatch").
                Color("warning"),
        }
    }))

    // 3. Register Panel into GoLaravel
    adminPanel.Register(app)

    app.Run(":8080")
}

2. Define a Typed Ent Resource (Resource[T])#

package resources

import (
    "github.com/golaravel/gofilament/pkg/filament"
    "github.com/golaravel/gofilament/pkg/forms"
    "github.com/golaravel/gofilament/pkg/tables"
    "github.com/golaravel/gofilament/pkg/infolists"
    "my-app/app/ent"
)

type UserResource struct {
    *filament.BaseResource[*ent.User]
}

func NewUserResource() *UserResource {
    res := filament.NewResource[*ent.User]("users").
        ModelName("User").
        PluralModelName("Users").
        NavigationGroup("Staff & Permissions").
        NavigationIcon("heroicon-users").
        NavigationBadge(func(ctx *filament.Context) string {
            count, _ := ctx.Ent().User.Query().Count(ctx)
            return fmt.Sprintf("%d", count)
        }).
        Form(func(form *forms.Form) *forms.Form {
            return form.Schema(
                forms.Section("Account Profile").
                    Columns(2).
                    Schema(
                        forms.TextInput("name").Required().Placeholder("e.g. John Doe"),
                        forms.TextInput("email").Email().Required().Placeholder("user@example.com"),
                        forms.Select("role").
                            Options(map[string]string{
                                "admin":  "Administrator",
                                "editor": "Editor",
                                "viewer": "Viewer",
                            }).
                            Default("viewer"),
                        forms.Toggle("is_active").Label("Active Status"),
                    ),
            )
        }).
        Table(func(table *tables.Table[*ent.User]) *tables.Table[*ent.User] {
            return table.
                Columns(
                    tables.TextColumn[*ent.User]("id").Sortable(),
                    tables.TextColumn[*ent.User]("name").Searchable().Sortable().Weight("bold"),
                    tables.TextColumn[*ent.User]("email").Searchable().Copyable(),
                    tables.BadgeColumn[*ent.User]("role").Colors(map[string]string{
                        "admin":  "danger",
                        "editor": "warning",
                        "viewer": "success",
                    }),
                    tables.ToggleColumn[*ent.User]("is_active"),
                    tables.TextColumn[*ent.User]("created_at").DateTime().Sortable(),
                ).
                Filters(
                    tables.SelectFilter("role").Options(map[string]string{
                        "admin":  "Administrators",
                        "editor": "Editors",
                    }),
                ).
                Actions(
                    tables.ViewAction[*ent.User](),
                    tables.EditAction[*ent.User](),
                    tables.DeleteAction[*ent.User](),
                ).
                BulkActions(
                    tables.DeleteBulkAction(),
                )
        }).
        Infolist(func(infolist *infolists.Infolist) *infolists.Infolist {
            return infolist.Schema(
                infolists.Section("User Overview").
                    Columns(2).
                    Schema(
                        infolists.TextEntry("name").Weight("bold"),
                        infolists.TextEntry("email").Copyable(),
                        infolists.BadgeEntry("role"),
                        infolists.TextEntry("created_at").DateTime(),
                    ),
            )
        })

    return &UserResource{BaseResource: res}
}
    // In your resource constructor:
    userResource := resources.NewUserResource()

    // Bind directly to your Ent client with zero boilerplate!
    entdriver.BindClient(userResource, client.User)

Generated from README.md at v1.36.0 · released Nov 17, 2026