Panel Builder Architecture (pkg/filament)
The Panel Builder is the foundational orchestrator. A single GoLaravel application can register multiple independent panels (e.g. /admin, /partner, /portal, /app).
Panel Initialization & Core Configuration#
package main
import (
"time"
"github.com/golaravel/gofilament/pkg/filament"
"github.com/golaravel/gofilament/pkg/colors"
"github.com/golaravel/golaravel/pkg/golaravel"
)
func main() {
app := golaravel.Default()
adminPanel := filament.NewPanel("admin").
Path("/admin").
BrandName("Pulse Enterprise").
BrandLogo("/assets/logo.svg").
Favicon("/assets/favicon.ico").
HomeURL("/admin").
DarkMode(true).
SidebarCollapsibleOnDesktop().
MaxContentWidth(filament.Width7xl).
Colors(map[string]any{
colors.RolePrimary: colors.Amber,
colors.RoleGray: colors.Slate,
colors.RoleSuccess: colors.Emerald,
colors.RoleDanger: colors.Rose,
colors.RoleWarning: colors.Amber,
colors.RoleInfo: colors.Sky,
})
// Mount resources, widgets, and pages...
// adminPanel.Resource(myResource)
if err := adminPanel.Register(app); err != nil {
panic(err)
}
app.Run(":8080")
}
Dual-Engine Switching#
To switch a panel to the Flutter Multiplatform Engine:
adminPanel.
Engine(filament.EngineFlutter).
Flutter("client/build/web") // Points to compiled Flutter web distribution directory
When EngineFlutter is enabled, the panel serves the interactive multiplatform shell at the root path (/admin/) and mounts full REST API endpoints at /admin/api/*.
Navigation, Groups, Badges & Collapsible Sidebars#
Panels support hierarchical navigation grouping, custom ordering, and dynamic badge counters:
adminPanel.
NavigationGroups([]string{
"Shop Management",
"Operations & Logistics",
"System Configuration",
})
Inside individual resources:
resource.
NavigationGroup("Shop Management").
NavigationSort(1).
NavigationIcon(`<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 11V7a4 4 0 00-8 0v4M5 9h14l1 12H4L5 9z"/></svg>`).
NavigationBadge(func(ctx *filament.Context) string {
return "12 New"
})
Mobile Navigation & Bottom Navigation Bar#
GoFilament provides deep customization for mobile layouts:
adminPanel.
// Configure default mobile bottom bar navigation slots
MobileBottomNavItems("dashboard", "products", "orders", "account").
// Toggle whether labels appear below icons on mobile
MobileBottomNavShowLabels(true).
// Mutually exclusive account entrypoint:
// filament.AccountNavHeader: Circular avatar in top AppBar opening floating sheet
// filament.AccountNavBottomBar: Dedicated bottom bar tab opening full account hub
AccountNavPlacement(filament.AccountNavHeader)
App Versioning & Hot Update Detection#
Panels support build identification and automatic hot reload prompts:
adminPanel.
Version("v1.25.0").
BuildID("20261109-prod-sha9a1a").
RequireReloadOnUpdate(true)
Clients poll GET /admin/api/version. If a new BuildID or Version is published, clients automatically surface a non-intrusive update banner or trigger a smooth reload.
Customizable Pre-Flutter Loading Screen#
Eliminate blank screens while the multiplatform engine hydrates:
import "github.com/golaravel/gofilament/pkg/flutter"
adminPanel.FlutterLoading(func(cfg *flutter.LoadingConfig) {
cfg.Style = flutter.LoadingStylePulse // LoadingStyleSpinner | LoadingStyleBar | LoadingStylePulse
cfg.Title = "Pulse Fleet"
cfg.Subtitle = "Connecting to telemetry cluster..."
cfg.BackgroundColor = "#0F172A"
cfg.PrimaryColor = "#F59E0B"
cfg.TextColor = "#F8FAFC"
})
Global Search Configuration#
Global search queries across all resources via GET /admin/global-search?q=query:
adminPanel.
GlobalSearch(true).
GlobalSearchKeyBinding("k"). // Command+K / Ctrl+K
GlobalSearchResultsLimit(10).
GlobalSearchFuzzy(true)
Multi-Tenancy & Privacy Scoping#
adminPanel.
TenantScoping(true)
When active, GoFilament injects the tenant context from X-Tenant-ID header, route parameter, or session cookie into ctx.ActiveTenant(). All resource queries can automatically scope by this identifier.
Authentication & Session Security#
adminPanel.
RequiresAuth(true).
Login(true).
Registration(false).
PasswordReset(true).
Profile(true).
SessionDuration(24 * time.Hour).
RememberMeDuration(30 * 24 * time.Hour).
AuthValidator(func(ctx *filament.Context, email, password string) (any, error) {
// Validate credentials against database/Ent
return user, nil
}).
TokenValidator(func(token string) (any, error) {
// Validate bearer token for API access
return user, nil
})
Internationalization (i18n) & RTL Layout#
GoFilament integrates natively with github.com/golaravel/golaravel/pkg/translation:
adminPanel.
Locales("en", "ar", "es", "de").
DefaultLocale("en").
LocaleLabels(map[string]string{
"en": "English",
"ar": "العربية",
"es": "Español",
"de": "Deutsch",
}).
LocaleFlags(map[string]string{
"en": "🇺🇸",
"ar": "🇸🇦",
"es": "🇪🇸",
"de": "🇩🇪",
}).
Translations("ar", map[string]string{
"dashboard": "لوحة التحكم",
"products": "المنتجات",
"orders": "الطلبات",
"save": "حفظ",
"cancel": "إلغاء",
})
- When
aris active, the layout setsdir="rtl"in HTML/CSS and wraps Flutter inDirectionality(textDirection: TextDirection.rtl). - Live locale switching:
POST /admin/api/locale/switch?lang=ar. - Translation dictionary endpoint:
GET /admin/api/translations?locale=ar.