quickstart

package module
v0.21.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 23, 2026 License: MIT Imports: 64 Imported by: 0

README

Quickstart Defaults

The quickstart package (module github.com/goliatone/go-admin/quickstart) bundles opt-in defaults for go-admin so hosts can get a working admin with minimal wiring while keeping override hooks.

Bootstrap helpers

Each helper is optional and composable.

  • NewAdminConfig(basePath, title, defaultLocale string, opts ...AdminConfigOption) admin.Config - Inputs: base path/title/locale plus option setters. Outputs: admin.Config with quickstart defaults and overrides applied.

  • DefaultMinimalFeatures() map[string]bool - Outputs: minimal Stage 1 feature set (dashboard + cms).

  • WithDebugConfig(cfg admin.DebugConfig) AdminConfigOption - Inputs: debug config; outputs: option that applies debug config (used to derive debug gate defaults).

  • WithDebugFromEnv(opts ...DebugEnvOption) AdminConfigOption - Inputs: env mapping overrides; outputs: option that applies ADMIN_DEBUG* config/envs to debug config.

  • NewAdmin(cfg admin.Config, hooks AdapterHooks, opts ...AdminOption) (*admin.Admin, AdapterResult, error) - Inputs: config, adapter hooks, optional context/dependencies. Outputs: admin instance, adapter result summary, error.

  • NewAdminWithGoUsersPreferences(cfg admin.Config, repo types.PreferenceRepository, opts ...PreferencesOption) (*admin.Admin, error) - Inputs: config, go-users preference repo, options. Outputs: admin instance.

  • WithAdapterFlags(flags AdapterFlags) AdminOption - Inputs: adapter flags; outputs: option that bypasses env resolution.

  • WithFeatureDefaults(defaults map[string]bool) AdminOption - Inputs: feature default map; outputs: option that extends gate defaults used by NewAdmin.

  • EnablePreferences() PreferencesOption - Inputs: none; outputs: option to enable FeaturePreferences.

  • EnableFeature(feature admin.FeatureKey) PreferencesOption - Inputs: feature key; outputs: option to enable a single feature gate key.

  • WithPreferencesAdapterHooks(hooks AdapterHooks) PreferencesOption - Inputs: adapter hooks; outputs: option to apply quickstart adapter wiring.

  • NewExportBundle(opts ...ExportBundleOption) *ExportBundle - Inputs: go-export options (store/guard/actor/base path overrides). Outputs: runner/service plus go-admin registry/registrar/metadata adapters.

  • PreferencesPermissions() []PermissionDefinition - Outputs: default preferences permission definitions.

  • RegisterPreferencesPermissions(register PermissionRegisterFunc) error - Inputs: register func; outputs: error (registers default preferences permissions).

  • NewFiberErrorHandler(adm *admin.Admin, cfg admin.Config, isDev bool, opts ...FiberErrorHandlerOption) fiber.ErrorHandler - Inputs: admin, config, dev flag + options. Outputs: Fiber error handler.

  • WithFiberErrorMappers(mappers ...goerrors.ErrorMapper) FiberErrorHandlerOption - Inputs: extra mappers; outputs: error handler option (appended to defaults).

  • NewViewEngine(baseFS fs.FS, opts ...ViewEngineOption) (fiber.Views, error) - Inputs: base FS and view options. Outputs: Fiber views engine and error.

  • DefaultTemplateFuncs(opts ...TemplateFuncOption) map[string]any - Outputs: default template helpers (JSON, dict, singularize/pluralize, widget titles, etc.).

  • MergeTemplateFuncs(overrides map[string]any, opts ...TemplateFuncOption) map[string]any - Inputs: overrides + optional template options. Outputs: merged map for WithViewTemplateFuncs.

  • WithThemeContext(ctx router.ViewContext, adm *admin.Admin, req router.Context) router.ViewContext - Inputs: view context, admin, request. Outputs: context enriched with theme tokens/selection.

  • NewFiberServer(viewEngine fiber.Views, cfg admin.Config, adm *admin.Admin, isDev bool, opts ...FiberServerOption) (router.Server[*fiber.App], router.Router[*fiber.App]) - Inputs: views, config, admin, dev flag, server options. Outputs: go-router server adapter and router.

  • NewThemeSelector(name, variant string, tokenOverrides map[string]string, opts ...ThemeOption) (theme.Selector, *theme.Manifest, error) - Inputs: theme name/variant, token overrides, theme options. Outputs: selector, manifest, error.

  • NewStaticAssets(r router.Router[*fiber.App], cfg admin.Config, assetsFS fs.FS, opts ...StaticAssetsOption) - Inputs: router, config, host assets FS, asset options. Outputs: none (registers static routes).

  • ResolveDiskAssetsDir(marker string, candidates ...string) string - Inputs: marker file + candidate directories. Outputs: first matching directory.

  • RegisterAdminUIRoutes(r router.Router[*fiber.App], cfg admin.Config, adm *admin.Admin, auth admin.HandlerAuthenticator, opts ...UIRouteOption) error - Inputs: router/config/admin/auth wrapper + options. Outputs: error (registers dashboard + notifications UI routes).

  • RegisterAuthUIRoutes(r router.Router[*fiber.App], cfg admin.Config, auther *auth.Auther, cookieName string, opts ...AuthUIOption) error - Inputs: router/config/go-auth auther/cookie name + options. Outputs: error (registers login/logout/reset UI routes).

  • RegisterRegistrationUIRoutes(r router.Router[*fiber.App], cfg admin.Config, opts ...RegistrationUIOption) error - Inputs: router/config + options. Outputs: error (registers signup UI route).

  • AuthUIViewContext(cfg admin.Config, state AuthUIState, paths AuthUIPaths) router.ViewContext - Inputs: config/state/paths; outputs: view context with auth flags + paths.

  • AttachDebugMiddleware(r router.Router[T], cfg admin.Config, adm *admin.Admin) - Inputs: router/config/admin; outputs: none (registers debug request capture middleware).

  • AttachDebugLogHandler(cfg admin.Config, adm *admin.Admin) - Inputs: config/admin; outputs: none (wires slog debug handler).

  • ConfigureExportRenderers(bundle *ExportBundle, templatesFS fs.FS, opts ...ExportTemplateOption) error - Inputs: export bundle + templates FS + options. Outputs: error (registers template/PDF renderers).

  • NewModuleRegistrar(adm *admin.Admin, cfg admin.Config, modules []admin.Module, isDev bool, opts ...ModuleRegistrarOption) error - Inputs: admin, config, module list, dev flag, options. Outputs: error.

  • WithModuleFeatureGates(gates gate.FeatureGate) ModuleRegistrarOption - Inputs: feature gate; outputs: option to filter modules/menu items.

  • WithModuleFeatureDisabledHandler(handler func(feature, moduleID string) error) ModuleRegistrarOption - Inputs: handler; outputs: option for disabled modules.

  • WithGoAuth(adm *admin.Admin, routeAuth *auth.RouteAuthenticator, cfg auth.Config, authz admin.GoAuthAuthorizerConfig, authCfg *admin.AuthConfig, opts ...admin.GoAuthAuthenticatorOption) (*admin.GoAuthAuthenticator, *admin.GoAuthAuthorizer) - Inputs: admin, route auth, auth config, authz config, admin auth config, options. Outputs: adapters.

  • WithDefaultDashboardRenderer(adm *admin.Admin, viewEngine fiber.Views, cfg admin.Config, opts ...DashboardRendererOption) error - Inputs: admin, view engine, config, renderer options. Outputs: error.

  • WithDashboardTemplatesFS(fsys fs.FS) DashboardRendererOption - Inputs: template FS; outputs: renderer option for overrides.

  • WithDashboardEmbeddedTemplates(enabled bool) DashboardRendererOption - Inputs: boolean; outputs: renderer option to enable/disable embedded templates.

  • NewCompositeActivitySink(primary admin.ActivitySink, hooks dashboardactivity.Hooks, cfg dashboardactivity.Config) admin.ActivitySink - Inputs: primary sink, dashboard hooks/config. Outputs: activity sink bridge.

  • NewGoAuthActivitySink(sink admin.ActivitySink, opts ...GoAuthActivitySinkOption) auth.ActivitySink - Inputs: admin sink + options. Outputs: go-auth activity adapter.

  • NewSharedActivitySinks(primary admin.ActivitySink, hooks dashboardactivity.Hooks, cfg dashboardactivity.Config, opts ...GoAuthActivitySinkOption) SharedActivitySinks - Inputs: primary sink + dashboard hooks/config. Outputs: shared admin/go-auth sinks.

  • NewFormGenerator(openapiFS fs.FS, templatesFS fs.FS, opts ...FormGeneratorOption) (*formgenorchestrator.Orchestrator, error) - Inputs: OpenAPI FS, templates FS, optional configuration. Outputs: form generator orchestrator and error.

  • WithComponentRegistry(reg *components.Registry) FormGeneratorOption - Inputs: custom registry; outputs: option that replaces default components (clean replace).

  • WithComponentRegistryMergeDefaults(reg *components.Registry) FormGeneratorOption - Inputs: custom registry; outputs: option that merges into defaults, overriding matching names.

  • WithVanillaOption(opt formgenvanilla.Option) FormGeneratorOption - Inputs: vanilla renderer option; outputs: option applied last so it can override templates/styles/registry.

  • SecureLinkConfigFromEnv(basePath string) SecureLinkConfig - Inputs: base path; outputs: securelink config (env-driven).

  • DefaultSecureLinkRoutes(basePath string) map[string]string - Inputs: base path; outputs: securelink routes map.

  • NewSecureLinkManager(cfg SecureLinkConfig) (types.SecureLinkManager, error) - Inputs: securelink config; outputs: go-users securelink manager.

  • NewNotificationsSecureLinkManager(cfg SecureLinkConfig) (links.SecureLinkManager, error) - Inputs: securelink config; outputs: go-notifications securelink manager.

  • ApplySecureLinkManager(cfg *userssvc.Config, manager types.SecureLinkManager, opts ...SecureLinkUsersOption) - Inputs: go-users config + manager; outputs: config mutated with securelink routes/manager.

  • NewSecureLinkNotificationBuilder(manager links.SecureLinkManager, opts ...linksecure.Option) links.LinkBuilder - Inputs: notification manager + options; outputs: notification link builder.

  • RegisterOnboardingRoutes(r router.Router[*fiber.App], cfg admin.Config, handlers OnboardingHandlers, opts ...OnboardingRouteOption) error - Inputs: router/config/handlers; outputs: error (registers onboarding API routes).

  • RegisterUserMigrations(client *persistence.Client, opts ...UserMigrationsOption) error - Inputs: persistence client + options; outputs: error (registers go-auth + go-users migrations).

Template functions

NewViewEngine wires DefaultTemplateFuncs() when no template functions are supplied. WithViewTemplateFuncs is a strict override; use MergeTemplateFuncs if you want to keep defaults and add/override a subset. The go-router Pongo2 engine treats these helpers as functions (globals), not filters, so call them like {{ singularize(resource_label|default:resource)|title }} instead of {{ resource_label|singularize }}.

Template function options let you override widget title labels without touching the core map:

  • WithWidgetTitleOverrides(overrides map[string]string) TemplateFuncOption - merges label overrides into defaults.
  • WithWidgetTitleMap(titles map[string]string) TemplateFuncOption - replaces the default map entirely.
  • WithWidgetTitleFunc(fn func(string) string) TemplateFuncOption - provides a custom resolver.
funcs := quickstart.MergeTemplateFuncs(map[string]any{
	"titleize": strings.ToUpper,
}, quickstart.WithWidgetTitleOverrides(map[string]string{
	"admin.widget.user_profile_overview": "Profile Overview",
}))

views, err := quickstart.NewViewEngine(
	os.DirFS("./web"),
	quickstart.WithViewTemplateFuncs(funcs),
)
if err != nil {
	return err
}

UI routes

Quickstart includes opt-in helpers for common UI routes (admin shell, notifications, login/logout, password reset).

if err := quickstart.RegisterAdminUIRoutes(router, cfg, adm, authn); err != nil {
	return err
}

if err := quickstart.RegisterAuthUIRoutes(
	router,
	cfg,
	auther,
	authCookieName,
	quickstart.WithAuthUITitles("Login", "Password Reset"),
); err != nil {
	return err
}

if err := quickstart.RegisterRegistrationUIRoutes(
	router,
	cfg,
	quickstart.WithRegistrationUITitle("Register"),
); err != nil {
	return err
}

Password reset UI defaults to two pages:

  • Request: /admin/password-reset (template password_reset)
  • Confirm: /admin/password-reset/confirm (template password_reset_confirm)

Override the confirm route or template with WithAuthUIPasswordResetConfirmPath and WithAuthUIPasswordResetConfirmTemplate.

Theme assets for auth UI

Auth and registration UI routes support theme assets (logo, favicon) via dedicated options. Assets are exposed in templates as theme.assets.logo, theme.assets.favicon, etc.

authThemeAssets := map[string]string{
	"logo":    "logo.svg",
	"favicon": "favicon.svg",
}
authThemeAssetPrefix := path.Join(cfg.BasePath, "assets")

if err := quickstart.RegisterAuthUIRoutes(
	router,
	cfg,
	auther,
	authCookieName,
	quickstart.WithAuthUITitles("Login", "Password Reset"),
	quickstart.WithAuthUIThemeAssets(authThemeAssetPrefix, authThemeAssets),
); err != nil {
	return err
}

if err := quickstart.RegisterRegistrationUIRoutes(
	router,
	cfg,
	quickstart.WithRegistrationUITitle("Register"),
	quickstart.WithRegistrationUIThemeAssets(authThemeAssetPrefix, authThemeAssets),
); err != nil {
	return err
}

For manual route handlers, use WithAuthUIViewThemeAssets to merge theme assets into the view context:

viewCtx := router.ViewContext{
	"title":     cfg.Title,
	"base_path": cfg.BasePath,
}
viewCtx = quickstart.WithAuthUIViewThemeAssets(viewCtx, authThemeAssets, authThemeAssetPrefix)
return c.Render("register", viewCtx)

Templates use a conditional fallback pattern:

{% if theme and theme.assets and theme.assets.logo %}
<img src="{{ theme.assets.logo }}" alt="Logo" class="w-10 h-10" />
{% else %}
<!-- inline SVG fallback -->
{% endif %}

Quickstart wires onboarding routes and securelink helpers so hosts can opt in with minimal setup.

Feature gate keys (system scope) used by onboarding flows:

  • users.invite
  • users.password_reset
  • users.signup

Enable these via gate defaults (for example WithFeatureDefaults) or runtime overrides. Alias policy: users.self_registration is not supported; use users.signup.

Securelink env defaults:

  • ADMIN_SECURELINK_KEY (required to enable manager in quickstart)
  • ADMIN_SECURELINK_BASE_URL (default http://localhost:8080)
  • ADMIN_SECURELINK_QUERY_KEY (default token)
  • ADMIN_SECURELINK_AS_QUERY (default true)
  • ADMIN_SECURELINK_EXPIRATION (default 72h)

Route helpers:

  • RegisterOnboardingRoutes (API endpoints under /admin/api/onboarding by default)
  • RegisterAuthUIRoutes + RegisterRegistrationUIRoutes (UI pages)

See docs/GUIDE_ONBOARDING.md for token lifecycle details, error response shape, and override hook examples.

User migrations

Quickstart registers go-auth + go-users core migrations out of the box:

if err := quickstart.RegisterUserMigrations(client); err != nil {
	return err
}

If you run without go-auth, disable auth migrations and enable go-users auth bootstrap/extras:

if err := quickstart.RegisterUserMigrations(
	client,
	quickstart.WithUserMigrationsAuthEnabled(false),
	quickstart.WithUserMigrationsAuthBootstrapEnabled(true),
	quickstart.WithUserMigrationsAuthExtrasEnabled(true),
); err != nil {
	return err
}

Static assets (opt-in disk fallback)

diskAssetsDir := quickstart.ResolveDiskAssetsDir(
	"output.css",
	"path/to/pkg/client/assets",
	"assets",
)
quickstart.NewStaticAssets(r, cfg, client.Assets(), quickstart.WithDiskAssetsDir(diskAssetsDir))

Usage example

cfg := quickstart.NewAdminConfig("/admin", "Admin", "en")
exportBundle := quickstart.NewExportBundle()
adm, adapters, err := quickstart.NewAdmin(cfg, quickstart.AdapterHooks{
	PersistentCMS: func(ctx context.Context, defaultLocale string) (admin.CMSOptions, string, error) {
		return admin.CMSOptions{}, "in-memory CMS", nil
	},
}, quickstart.WithAdminDependencies(admin.Dependencies{
	ExportRegistry:  exportBundle.Registry,
	ExportRegistrar: exportBundle.Registrar,
	ExportMetadata:  exportBundle.Metadata,
}))
if err != nil {
	return err
}

// Register definitions and row sources on exportBundle.Runner.
// exportBundle.Runner.Definitions.Register(...)
// exportBundle.Runner.RowSources.Register(...)

views, err := quickstart.NewViewEngine(os.DirFS("./web"))
if err != nil {
	return err
}

srv, r := quickstart.NewFiberServer(views, cfg, adm, true)
quickstart.NewStaticAssets(r, cfg, os.DirFS("./web"))
_ = quickstart.NewModuleRegistrar(adm, cfg, []admin.Module{}, true)

_ = adapters
_ = srv
cfg := quickstart.NewAdminConfig(
	"/admin",
	"Admin",
	"en",
)
flags := config.Admin.AdapterFlags
adm, adapters, err := quickstart.NewAdmin(
	cfg,
	hooks,
	quickstart.WithAdapterFlags(flags),
	quickstart.WithFeatureDefaults(quickstart.DefaultMinimalFeatures()),
)
if err != nil {
	return err
}
_ = adapters
_ = adm
err = quickstart.NewModuleRegistrar(
	adm,
	cfg,
	modules,
	isDev,
)
if err != nil {
	return err
}
authn, authz := quickstart.WithGoAuth(
	adm,
	routeAuth,
	authConfig,
	admin.GoAuthAuthorizerConfig{DefaultResource: "admin"},
	&admin.AuthConfig{
		LoginPath:    "/admin/login",
		LogoutPath:   "/admin/logout",
		RedirectPath: "/admin",
	},
)
_ = authn
_ = authz
if err := quickstart.WithDefaultDashboardRenderer(adm, views, cfg); err != nil {
	return err
}
formgen, err := quickstart.NewFormGenerator(os.DirFS("./openapi"), os.DirFS("./forms"))
if err != nil {
	return err
}
_ = formgen
registry := components.New()
registry.MustRegister("permission-matrix", components.Descriptor{
	Renderer: permissionMatrixRenderer,
})

formgen, err := quickstart.NewFormGenerator(
	os.DirFS("./openapi"),
	os.DirFS("./forms"),
	quickstart.WithComponentRegistryMergeDefaults(registry),
	quickstart.WithVanillaOption(formgenvanilla.WithStylesheet("/admin/assets/forms.css")),
)
if err != nil {
	return err
}
_ = formgen

WithVanillaOption(...) is applied last, so it can override templates/styles/registry. Use WithComponentRegistry(...) instead of the merge option to replace defaults entirely.

Debug quickstart

Debug is opt-in and requires module registration plus middleware/log wiring. Call the helpers after the debug module is registered so the collector is available.

Environment mapping defaults:

  • ADMIN_DEBUG=true enables cfg.Debug.Enabled, ToolbarMode, CaptureSQL, CaptureLogs, and sets the debug feature gate default.
  • ADMIN_DEBUG_ALLOWED_IPS=1.2.3.4,5.6.7.8 populates cfg.Debug.AllowedIPs.
  • ADMIN_DEBUG_SQL and ADMIN_DEBUG_LOGS override the capture flags.
  • ADMIN_DEBUG_TOOLBAR and ADMIN_DEBUG_TOOLBAR_PANELS override toolbar behavior/panels.
cfg := quickstart.NewAdminConfig(
	"/admin",
	"Admin",
	"en",
	quickstart.WithDebugFromEnv(),
)

adm, _, err := quickstart.NewAdmin(cfg, hooks, quickstart.WithAdminDependencies(deps))
if err != nil {
	return err
}

modules := []admin.Module{
	// core modules...
}
if cfg.Debug.Enabled {
	modules = append(modules, admin.NewDebugModule(cfg.Debug))
}

if err := quickstart.NewModuleRegistrar(
	adm,
	cfg,
	modules,
	isDev,
); err != nil {
	return err
}

if cfg.Debug.Enabled {
	quickstart.AttachDebugMiddleware(r, cfg, adm)
	quickstart.AttachDebugLogHandler(cfg, adm)
}

repoOptions := adm.DebugQueryHookOptions()
repo := repository.MustNewRepositoryWithOptions[*MyModel](db, handlers, repoOptions...)

Preferences quickstart

  • FeaturePreferences remains opt-in: pass EnablePreferences() or supply WithFeatureDefaults(map[string]bool{"preferences": true}) when building the admin gate.
  • A 403 on /admin/api/preferences usually means the default permissions are missing (admin.preferences.view, admin.preferences.edit).
  • Read query params: levels, keys, include_traces, include_versions, tenant_id, org_id.
  • Clear/delete semantics: send clear/clear_keys or empty values for known keys to delete user-level overrides.
  • Non-user writes (tenant/org/system) require admin.preferences.manage_tenant, admin.preferences.manage_org, admin.preferences.manage_system.
  • See ../docs/GUIDE_MOD_PREFERENCES.md for module behavior, traces, and clear semantics.
prefsStore, err := quickstart.NewGoUsersPreferencesStore(preferenceRepo)
if err != nil {
	return err
}

adm, err := admin.New(cfg, admin.Dependencies{
	PreferencesStore: prefsStore,
})
if err != nil {
	return err
}
_ = adm
adm, err := quickstart.NewAdminWithGoUsersPreferences(
	cfg,
	preferenceRepo,
	quickstart.EnablePreferences(),
)
if err != nil {
	return err
}
_ = adm
err := quickstart.RegisterPreferencesPermissions(func(def quickstart.PermissionDefinition) error {
	return permissions.Register(def.Key, def.Description)
})
if err != nil {
	return err
}

Stage 1 minimal flow

  • Build config with NewAdminConfig(...) and pass WithFeatureDefaults(DefaultMinimalFeatures()) to NewAdmin.
  • Resolve adapter flags from config and pass via WithAdapterFlags(...).
  • Register modules with NewModuleRegistrar (uses adm.FeatureGate() by default).
  • Wire auth with WithGoAuth(...) (include *admin.AuthConfig when needed).
  • Enable dashboard SSR with WithDefaultDashboardRenderer(...) (override templates as needed).

References

  • ../QUICKBOOT_TDD.md
  • ../QUICKBOOT_TSK.md

Compatibility note

If you previously imported quickstart as part of the root module, keep the same import path but add a direct require on github.com/goliatone/go-admin/quickstart in your go.mod (or use a local replace/go.work entry during dev). The APIs are unchanged; only the module boundary moved.

What’s included

  • Navigation: slug-derived menu IDs/lookup, parent scaffolder for grouped/collapsible defaults, idempotent seeding (SeedNavigation), deterministic ordering, permission filtering, collapsible state, NAV_DEBUG logging/JSON, and view helpers (WithNav, BuildNavItems).
  • Sidebar: embedded templates/partials and assets (CSS/JS) with collapse + submenu persistence; apps can override by adding their own template/assets FS ahead of the defaults.
  • Error handling: Fiber error handler that returns JSON for API paths and renders the branded error page (with nav/theme/session) for HTML routes.
  • Adapters: config- or env-flagged wiring for persistent CMS (USE_PERSISTENT_CMS), go-options settings (USE_GO_OPTIONS), and go-users activity sink (USE_GO_USERS_ACTIVITY) with safe in-memory fallbacks.
  • Auth debug: GoAuthAuthorizer supports AUTH_DEBUG=true or config flag for structured decision logging (logger injectable).

Flags and debug

  • USE_PERSISTENT_CMS=true – swap to persistent CMS via provided hook.
  • USE_GO_OPTIONS=true – swap settings backend to go-options adapter.
  • USE_GO_USERS_ACTIVITY=true – use go-users activity sink if available.
  • RESET_NAV_MENU=true – reset target menu before seeding (backends must expose reset hook).
  • NAV_DEBUG=true – include nav JSON in views; NAV_DEBUG_LOG=true – log nav payload.
  • AUTH_DEBUG=true – emit structured auth decisions.

Overrides

  • Templates/Assets: prepend your own FS via WithViewTemplatesFS/WithViewAssetsFS to override the embedded sidebar.
  • Navigation seed: pass custom items to SeedNavigation; module menu contributions are deduped by ID.
  • Module gating: WithModuleFeatureGates(customGate) with optional WithModuleFeatureDisabledHandler.
  • Dashboard SSR: provide WithDashboardTemplatesFS and/or disable embedded templates via WithDashboardEmbeddedTemplates(false).
  • Error handler: swap quickstart.NewFiberErrorHandler with your own if needed.

Documentation

Index

Constants

View Source
const DefaultNavMenuCode = "admin_main"

DefaultNavMenuCode is the quickstart default menu identifier.

Variables

View Source
var ErrSeedNavigationRequiresGoCMS = fmt.Errorf("quickstart: SeedNavigation requires a go-cms backed menu service")

ErrSeedNavigationRequiresGoCMS is returned when SeedNavigation is invoked with a non go-cms backed menu service.

Functions

func ApplyAdapterIntegrations

func ApplyAdapterIntegrations(adm *admin.Admin, result *AdapterResult, hooks AdapterHooks)

ApplyAdapterIntegrations wires optional adapters post-admin initialization.

func ApplySecureLinkManager added in v0.19.0

func ApplySecureLinkManager(cfg *userssvc.Config, manager userstypes.SecureLinkManager, opts ...SecureLinkUsersOption)

ApplySecureLinkManager wires securelink settings into go-users config.

func ApplySecureLinkManagerToAuth added in v0.19.0

func ApplySecureLinkManagerToAuth(target SecureLinkManagerSetter, manager userstypes.SecureLinkManager)

ApplySecureLinkManagerToAuth wires the securelink manager into go-auth style handlers.

func AttachDebugLogHandler added in v0.15.0

func AttachDebugLogHandler(cfg admin.Config, adm *admin.Admin)

AttachDebugLogHandler wires slog to the debug collector when CaptureLogs is enabled.

func AttachDebugMiddleware added in v0.15.0

func AttachDebugMiddleware[T any](r router.Router[T], cfg admin.Config, adm *admin.Admin)

AttachDebugMiddleware registers the debug request capture middleware on the router.

func AttachGoAuthActivitySink added in v0.19.0

func AttachGoAuthActivitySink(auther *auth.Auther, sink admin.ActivitySink, opts ...GoAuthActivitySinkOption)

AttachGoAuthActivitySink wires the go-auth activity adapter into the auther.

func AuthUIViewContext added in v0.19.0

func AuthUIViewContext(cfg admin.Config, state AuthUIState, paths AuthUIPaths) router.ViewContext

AuthUIViewContext builds a view context with auth flags + paths.

func BuildNavItems

func BuildNavItems(adm *admin.Admin, cfg admin.Config, ctx context.Context, active string) []map[string]any

BuildNavItems builds navigation menu items from the admin menu service.

func BuildNavItemsForPlacement

func BuildNavItemsForPlacement(adm *admin.Admin, cfg admin.Config, placements PlacementConfig, placement string, ctx context.Context, active string) []map[string]any

BuildNavItemsForPlacement resolves a menu for a placement and returns render-ready entries.

func ConfigureExportRenderers added in v0.13.0

func ConfigureExportRenderers(bundle *ExportBundle, templatesFS fs.FS, opts ...ExportTemplateOption) error

ConfigureExportRenderers registers template + PDF renderers using the provided templates FS.

func DashboardTemplatesFS

func DashboardTemplatesFS() fs.FS

DashboardTemplatesFS returns the embedded dashboard templates filesystem.

func DefaultAdminFeatures

func DefaultAdminFeatures() map[string]bool

DefaultAdminFeatures returns the baseline feature defaults for quickstart.

func DefaultMenuParents

func DefaultMenuParents(menuCode string) []admin.MenuItem

DefaultMenuParents returns the baseline parents/groups used by quickstart modules.

func DefaultMinimalFeatures

func DefaultMinimalFeatures() map[string]bool

DefaultMinimalFeatures returns a Stage 1 friendly feature default set.

func DefaultSecureLinkRoutes added in v0.19.0

func DefaultSecureLinkRoutes(basePath string) map[string]string

DefaultSecureLinkRoutes builds the route map used by securelink managers.

func DefaultTemplateFuncs

func DefaultTemplateFuncs(opts ...TemplateFuncOption) map[string]any

DefaultTemplateFuncs returns shared template functions for view rendering.

func DefaultThemeTokens

func DefaultThemeTokens() map[string]string

DefaultThemeTokens returns the baseline theme tokens used by quickstart.

func EnsureDefaultMenuParents

func EnsureDefaultMenuParents(ctx context.Context, menuSvc admin.CMSMenuService, menuCode, locale string) error

EnsureDefaultMenuParents scaffolds the default parents so module menus can nest without seeds.

func MergeComponentDescriptors

func MergeComponentDescriptors(base, override components.Descriptor) components.Descriptor

MergeComponentDescriptors combines a default descriptor with an override. Renderer uses the override when provided; assets are appended.

func MergeTemplateFuncs

func MergeTemplateFuncs(overrides map[string]any, opts ...TemplateFuncOption) map[string]any

MergeTemplateFuncs combines default functions with caller overrides.

func NewAdminConfig

func NewAdminConfig(basePath, title, defaultLocale string, opts ...AdminConfigOption) admin.Config

NewAdminConfig builds a baseline admin config with quickstart defaults.

func NewAdminWithGoUsersPreferences

func NewAdminWithGoUsersPreferences(cfg admin.Config, repo types.PreferenceRepository, opts ...PreferencesOption) (*admin.Admin, error)

NewAdminWithGoUsersPreferences wires a go-users preferences store and returns an admin instance.

func NewCompositeActivitySink

func NewCompositeActivitySink(primary admin.ActivitySink, hooks dashboardactivity.Hooks, cfg dashboardactivity.Config) admin.ActivitySink

NewCompositeActivitySink forwards admin activity entries to the primary sink and dashboard hooks.

func NewFiberErrorHandler

func NewFiberErrorHandler(adm *admin.Admin, cfg admin.Config, isDev bool, opts ...FiberErrorHandlerOption) fiber.ErrorHandler

NewFiberErrorHandler returns a default error handler that renders JSON for API paths and an HTML error page (with nav + theme) for non-API paths.

func NewFiberServer

func NewFiberServer(viewEngine fiber.Views, cfg admin.Config, adm *admin.Admin, isDev bool, opts ...FiberServerOption) (router.Server[*fiber.App], router.Router[*fiber.App])

NewFiberServer constructs a Fiber-backed router adapter with quickstart defaults.

func NewFormGenerator

func NewFormGenerator(openapiFS fs.FS, templatesFS fs.FS, opts ...FormGeneratorOption) (*formgenorchestrator.Orchestrator, error)

NewFormGenerator creates a form generator from OpenAPI and template filesystems.

func NewGoAuthActivitySink added in v0.19.0

func NewGoAuthActivitySink(sink admin.ActivitySink, opts ...GoAuthActivitySinkOption) auth.ActivitySink

NewGoAuthActivitySink adapts go-auth activity events into the admin activity sink.

func NewModuleRegistrar

func NewModuleRegistrar(adm *admin.Admin, cfg admin.Config, modules []admin.Module, isDev bool, opts ...ModuleRegistrarOption) error

NewModuleRegistrar seeds navigation and registers modules deterministically.

func NewNotificationsSecureLinkManager added in v0.19.0

func NewNotificationsSecureLinkManager(cfg SecureLinkConfig) (links.SecureLinkManager, error)

NewNotificationsSecureLinkManager builds a go-notifications compatible securelink manager.

func NewSecureLinkManager added in v0.19.0

func NewSecureLinkManager(cfg SecureLinkConfig) (userstypes.SecureLinkManager, error)

NewSecureLinkManager builds a go-users compatible securelink manager.

func NewSecureLinkNotificationBuilder added in v0.19.0

func NewSecureLinkNotificationBuilder(manager links.SecureLinkManager, opts ...linknotifications.Option) links.LinkBuilder

NewSecureLinkNotificationBuilder builds a securelink link builder for go-notifications.

func NewStaticAssets

func NewStaticAssets(r router.Router[*fiber.App], cfg admin.Config, assetsFS fs.FS, opts ...StaticAssetsOption)

NewStaticAssets registers static asset routes with quickstart defaults.

func NewThemeSelector

func NewThemeSelector(name, variant string, tokenOverrides map[string]string, opts ...ThemeOption) (theme.Selector, *theme.Manifest, error)

NewThemeSelector registers a default theme manifest and returns a selector.

func NewViewEngine

func NewViewEngine(baseFS fs.FS, opts ...ViewEngineOption) (fiber.Views, error)

NewViewEngine builds a view engine with quickstart sidebar fallbacks.

func RegisterAdminUIRoutes added in v0.13.0

func RegisterAdminUIRoutes(r router.Router[*fiber.App], cfg admin.Config, adm *admin.Admin, auth admin.HandlerAuthenticator, opts ...UIRouteOption) error

RegisterAdminUIRoutes registers default UI routes (dashboard + notifications).

func RegisterAuthUIRoutes added in v0.13.0

func RegisterAuthUIRoutes(r router.Router[*fiber.App], cfg admin.Config, auther *auth.Auther, cookieName string, opts ...AuthUIOption) error

RegisterAuthUIRoutes registers login, logout, and password reset UI routes.

func RegisterOnboardingRoutes added in v0.19.0

func RegisterOnboardingRoutes(r router.Router[*fiber.App], cfg admin.Config, handlers OnboardingHandlers, opts ...OnboardingRouteOption) error

RegisterOnboardingRoutes registers onboarding API endpoints.

func RegisterPreferencesPermissions

func RegisterPreferencesPermissions(register PermissionRegisterFunc) error

RegisterPreferencesPermissions registers the default preferences permissions.

func RegisterRegistrationUIRoutes added in v0.19.0

func RegisterRegistrationUIRoutes(r router.Router[*fiber.App], cfg admin.Config, opts ...RegistrationUIOption) error

RegisterRegistrationUIRoutes registers the registration UI route.

func RegisterUserMigrations added in v0.19.0

func RegisterUserMigrations(client *persistence.Client, opts ...UserMigrationsOption) error

RegisterUserMigrations registers go-auth and go-users migrations with sensible defaults. By default it registers go-auth migrations plus go-users core migrations.

func ResolveDiskAssetsDir added in v0.13.0

func ResolveDiskAssetsDir(marker string, candidates ...string) string

ResolveDiskAssetsDir returns the first candidate directory that contains the marker file.

func SeedNavigation

func SeedNavigation(ctx context.Context, opts SeedNavigationOptions) error

SeedNavigation seeds a menu using go-cms cms.SeedMenu.

func SidebarAssetsFS

func SidebarAssetsFS() fs.FS

SidebarAssetsFS returns the embedded sidebar assets (sidebar.js, sidebar.css).

func SidebarTemplatesFS

func SidebarTemplatesFS() fs.FS

SidebarTemplatesFS returns the embedded sidebar templates (partials/sidebar.html).

func WithAuthUIViewContext added in v0.19.0

func WithAuthUIViewContext(ctx router.ViewContext, cfg admin.Config, state AuthUIState, paths AuthUIPaths) router.ViewContext

WithAuthUIViewContext merges auth flags + paths into an existing view context.

func WithAuthUIViewThemeAssets added in v0.19.0

func WithAuthUIViewThemeAssets(ctx router.ViewContext, assets map[string]string, assetPrefix string) router.ViewContext

WithAuthUIViewThemeAssets merges theme assets into an existing view context. It creates or extends the "theme" map with an "assets" sub-map containing the provided asset paths. If assetPrefix is provided, each asset filename is resolved to a full path by joining with the prefix.

This function does not add query-string theme/variant handling; it only provides static asset paths for auth UI templates.

func WithDefaultDashboardRenderer

func WithDefaultDashboardRenderer(adm *admin.Admin, viewEngine fiber.Views, cfg admin.Config, opts ...DashboardRendererOption) error

WithDefaultDashboardRenderer registers a basic dashboard SSR renderer when none is set.

func WithFallbackFS

func WithFallbackFS(primary fs.FS, fallbacks ...fs.FS) fs.FS

WithFallbackFS builds a MultiFS preferring the primary FS first.

func WithFeatureTemplateContext added in v0.20.0

func WithFeatureTemplateContext(ctx router.ViewContext, reqCtx context.Context, scope any, snapshot any) router.ViewContext

WithFeatureTemplateContext injects feature helper keys into a view context when missing.

func WithGoAuth

WithGoAuth wires go-auth adapters into the admin instance.

func WithNav

func WithNav(ctx router.ViewContext, adm *admin.Admin, cfg admin.Config, active string, reqCtx context.Context) router.ViewContext

WithNav adds session, theme, and navigation payload to the view context.

func WithNavPlacements

func WithNavPlacements(ctx router.ViewContext, adm *admin.Admin, cfg admin.Config, placements PlacementConfig, placement string, active string, reqCtx context.Context) router.ViewContext

WithNavPlacements is like WithNav but allows selecting a placement-specific menu.

func WithThemeContext added in v0.13.0

func WithThemeContext(ctx router.ViewContext, adm *admin.Admin, req router.Context) router.ViewContext

WithThemeContext resolves the active theme (with optional query overrides) and adds it to the view context.

Types

type AdapterFlags

type AdapterFlags struct {
	UsePersistentCMS   bool
	UseGoOptions       bool
	UseGoUsersActivity bool
}

AdapterFlags captures adapter switches (config or env).

func ResolveAdapterFlags

func ResolveAdapterFlags() AdapterFlags

ResolveAdapterFlags reads environment toggles.

type AdapterHooks

type AdapterHooks struct {
	// PersistentCMS should build CMSOptions when persistent storage is desired.
	// Return backend label (for logging) alongside options.
	PersistentCMS func(ctx context.Context, defaultLocale string) (admin.CMSOptions, string, error)
	// GoOptions should swap settings to go-options backend.
	GoOptions func(adm *admin.Admin) (string, error)
	// GoUsersActivity should build an activity sink backed by go-users (or nil).
	GoUsersActivity func() admin.ActivitySink
}

AdapterHooks supplies host-specific builders for optional adapters.

type AdapterResult

type AdapterResult struct {
	Flags            AdapterFlags
	CMSBackend       string
	SettingsBackend  string
	ActivityBackend  string
	ActivitySink     admin.ActivitySink
	PersistentCMSSet bool
	Config           admin.Config
}

AdapterResult describes applied adapters/backends.

func ConfigureAdapters

func ConfigureAdapters(ctx context.Context, cfg admin.Config, hooks AdapterHooks) (admin.Config, AdapterResult)

ConfigureAdapters mutates the admin config (CMS) based on env flags and available hooks.

func ConfigureAdaptersWithFlags

func ConfigureAdaptersWithFlags(ctx context.Context, cfg admin.Config, hooks AdapterHooks, flags AdapterFlags) (admin.Config, AdapterResult)

ConfigureAdaptersWithFlags mutates the admin config (CMS) based on supplied flags.

func NewAdmin

func NewAdmin(cfg admin.Config, hooks AdapterHooks, opts ...AdminOption) (*admin.Admin, AdapterResult, error)

NewAdmin constructs an admin instance with adapter wiring applied.

type AdminConfigOption

type AdminConfigOption func(*admin.Config)

AdminConfigOption mutates the base admin config.

func WithDebugConfig added in v0.15.0

func WithDebugConfig(debugCfg admin.DebugConfig) AdminConfigOption

WithDebugConfig merges a debug config into the admin config.

func WithDebugFromEnv added in v0.15.0

func WithDebugFromEnv(opts ...DebugEnvOption) AdminConfigOption

WithDebugFromEnv maps ADMIN_DEBUG* environment variables into the admin config.

func WithNavMenuCode

func WithNavMenuCode(code string) AdminConfigOption

WithNavMenuCode overrides the default navigation menu code.

func WithTheme

func WithTheme(name, variant string) AdminConfigOption

WithTheme overrides the base theme name/variant.

func WithThemeAssetPrefix

func WithThemeAssetPrefix(prefix string) AdminConfigOption

WithThemeAssetPrefix sets a default asset prefix used by themes.

func WithThemeTokens

func WithThemeTokens(tokens map[string]string) AdminConfigOption

WithThemeTokens merges custom theme tokens.

type AdminOption

type AdminOption func(*adminOptions)

AdminOption customizes NewAdmin behavior.

func WithAdapterFlags

func WithAdapterFlags(flags AdapterFlags) AdminOption

WithAdapterFlags overrides env-driven adapter flag resolution.

func WithAdminContext

func WithAdminContext(ctx context.Context) AdminOption

WithAdminContext sets the context used when resolving adapter hooks.

func WithAdminDependencies

func WithAdminDependencies(deps admin.Dependencies) AdminOption

WithAdminDependencies sets the admin dependencies passed to admin.New.

func WithFeatureDefaults added in v0.20.0

func WithFeatureDefaults(defaults map[string]bool) AdminOption

WithFeatureDefaults overrides or extends the feature defaults used to build the gate.

type AsyncRequesterFactory

type AsyncRequesterFactory func(service export.Service, logger export.Logger) exportapi.AsyncRequester

AsyncRequesterFactory builds an async requester after the export service is initialized.

type AuthUIOption added in v0.13.0

type AuthUIOption func(*authUIOptions)

AuthUIOption customizes the auth UI routes.

func WithAuthUIBasePath added in v0.13.0

func WithAuthUIBasePath(basePath string) AuthUIOption

WithAuthUIBasePath overrides the base path used by auth UI routes.

func WithAuthUICookie added in v0.13.0

func WithAuthUICookie(cookie router.Cookie) AuthUIOption

WithAuthUICookie overrides the auth cookie defaults.

func WithAuthUIFeatureGate added in v0.20.0

func WithAuthUIFeatureGate(gate fggate.FeatureGate) AuthUIOption

WithAuthUIFeatureGate sets the feature gate used for default guards.

func WithAuthUILoginPath added in v0.13.0

func WithAuthUILoginPath(route string) AuthUIOption

WithAuthUILoginPath overrides the login route path.

func WithAuthUILoginRedirect added in v0.13.0

func WithAuthUILoginRedirect(route string) AuthUIOption

WithAuthUILoginRedirect overrides the redirect path after login.

func WithAuthUILogoutPath added in v0.13.0

func WithAuthUILogoutPath(route string) AuthUIOption

WithAuthUILogoutPath overrides the logout route path.

func WithAuthUILogoutRedirect added in v0.13.0

func WithAuthUILogoutRedirect(route string) AuthUIOption

WithAuthUILogoutRedirect overrides the redirect path after logout.

func WithAuthUIPasswordResetConfirmPath added in v0.19.0

func WithAuthUIPasswordResetConfirmPath(route string) AuthUIOption

WithAuthUIPasswordResetConfirmPath overrides the password reset confirm route path.

func WithAuthUIPasswordResetConfirmTemplate added in v0.19.0

func WithAuthUIPasswordResetConfirmTemplate(name string) AuthUIOption

WithAuthUIPasswordResetConfirmTemplate overrides the password reset confirm template name.

func WithAuthUIPasswordResetConfirmTitle added in v0.19.0

func WithAuthUIPasswordResetConfirmTitle(title string) AuthUIOption

WithAuthUIPasswordResetConfirmTitle overrides the view title for the confirm reset page.

func WithAuthUIPasswordResetEnabled added in v0.13.0

func WithAuthUIPasswordResetEnabled(fn func(admin.Config) bool) AuthUIOption

WithAuthUIPasswordResetEnabled overrides the password reset feature guard.

func WithAuthUIPasswordResetPath added in v0.13.0

func WithAuthUIPasswordResetPath(route string) AuthUIOption

WithAuthUIPasswordResetPath overrides the password reset route path.

func WithAuthUIRegisterPath added in v0.19.0

func WithAuthUIRegisterPath(route string) AuthUIOption

WithAuthUIRegisterPath overrides the self-registration route path.

func WithAuthUISelfRegistrationEnabled added in v0.19.0

func WithAuthUISelfRegistrationEnabled(fn func(admin.Config) bool) AuthUIOption

WithAuthUISelfRegistrationEnabled overrides the self-registration feature guard.

func WithAuthUITemplates added in v0.13.0

func WithAuthUITemplates(loginTemplate, passwordResetTemplate string) AuthUIOption

WithAuthUITemplates overrides the login and password reset templates.

func WithAuthUIThemeAssets added in v0.19.0

func WithAuthUIThemeAssets(prefix string, assets map[string]string) AuthUIOption

WithAuthUIThemeAssets sets theme assets (logo, favicon, etc.) for auth UI templates. The prefix is prepended to each asset filename to form the full URL path. Assets are exposed in templates as theme.assets.logo, theme.assets.favicon, etc.

func WithAuthUITitles added in v0.13.0

func WithAuthUITitles(loginTitle, passwordResetTitle string) AuthUIOption

WithAuthUITitles overrides the view titles for login and password reset.

func WithAuthUIViewContextBuilder added in v0.13.0

func WithAuthUIViewContextBuilder(builder AuthUIViewContextBuilder) AuthUIOption

WithAuthUIViewContextBuilder overrides the default view context builder.

type AuthUIPaths added in v0.19.0

type AuthUIPaths struct {
	BasePath                 string
	PasswordResetPath        string
	PasswordResetConfirmPath string
	RegisterPath             string
}

AuthUIPaths captures common auth-related route paths for templates.

type AuthUIState added in v0.19.0

type AuthUIState struct {
	PasswordResetEnabled    bool
	SelfRegistrationEnabled bool
}

AuthUIState captures feature-guarded flags used by auth templates.

func AuthUIStateFromGate added in v0.20.0

func AuthUIStateFromGate(ctx context.Context, gate fggate.FeatureGate, scope fggate.ScopeSet) AuthUIState

AuthUIStateFromGate derives auth UI flags from the feature gate.

type AuthUIViewContextBuilder added in v0.13.0

type AuthUIViewContextBuilder func(ctx router.ViewContext, c router.Context) router.ViewContext

AuthUIViewContextBuilder mutates the view context for auth UI routes.

type DashboardRendererOption

type DashboardRendererOption func(*dashboardRendererOptions)

DashboardRendererOption customizes the default dashboard renderer setup.

func WithDashboardEmbeddedTemplates

func WithDashboardEmbeddedTemplates(enabled bool) DashboardRendererOption

WithDashboardEmbeddedTemplates toggles the embedded dashboard templates.

func WithDashboardTemplatesFS

func WithDashboardTemplatesFS(fsys fs.FS) DashboardRendererOption

WithDashboardTemplatesFS appends a template filesystem to the renderer.

type DebugEnvOption added in v0.15.0

type DebugEnvOption struct {
	EnabledKey       string
	AllowedIPsKey    string
	CaptureSQLKey    string
	CaptureLogsKey   string
	ToolbarModeKey   string
	ToolbarPanelsKey string
}

DebugEnvOption customizes which environment variables map to debug config.

type ExportBundle

type ExportBundle struct {
	Runner    *export.Runner
	Service   export.Service
	Registry  admin.ExportRegistry
	Registrar admin.ExportHTTPRegistrar
	Metadata  admin.ExportMetadataProvider
}

ExportBundle wires go-export integrations for go-admin.

func NewExportBundle

func NewExportBundle(opts ...ExportBundleOption) *ExportBundle

NewExportBundle constructs default go-export wiring for go-admin.

type ExportBundleOption

type ExportBundleOption func(*exportBundleOptions)

ExportBundleOption customizes NewExportBundle behavior.

func WithExportActorProvider

func WithExportActorProvider(provider export.ActorProvider) ExportBundleOption

WithExportActorProvider sets the actor provider for export requests.

func WithExportAsyncInProcess

func WithExportAsyncInProcess(timeout time.Duration) ExportBundleOption

WithExportAsyncInProcess enables in-process async exports using a background goroutine. This is suitable for demos; production should use a job runner/queue.

func WithExportAsyncRequester

func WithExportAsyncRequester(factory AsyncRequesterFactory) ExportBundleOption

WithExportAsyncRequester configures async export requests (for 202 + status/download URLs).

func WithExportBasePath

func WithExportBasePath(path string) ExportBundleOption

WithExportBasePath overrides the default export base path. Provide a full path ("/admin/exports") or a suffix ("exports").

func WithExportDeliveryPolicy

func WithExportDeliveryPolicy(policy export.DeliveryPolicy) ExportBundleOption

WithExportDeliveryPolicy overrides the delivery policy defaults.

func WithExportGuard

func WithExportGuard(guard export.Guard) ExportBundleOption

WithExportGuard sets the go-export guard.

func WithExportHistoryPath

func WithExportHistoryPath(path string) ExportBundleOption

WithExportHistoryPath overrides the history endpoint path.

func WithExportLogger

func WithExportLogger(logger export.Logger) ExportBundleOption

WithExportLogger sets the go-export logger.

func WithExportMaxBufferBytes

func WithExportMaxBufferBytes(maxBytes int64) ExportBundleOption

WithExportMaxBufferBytes sets the max buffer size for sync downloads.

func WithExportPathSuffix

func WithExportPathSuffix(suffix string) ExportBundleOption

WithExportPathSuffix overrides the default base path suffix when no base path is set.

func WithExportQueryRequestDecoder

func WithExportQueryRequestDecoder(decoder exportapi.RequestDecoder) ExportBundleOption

WithExportQueryRequestDecoder overrides the querystring request decoder.

func WithExportRequestDecoder

func WithExportRequestDecoder(decoder exportapi.RequestDecoder) ExportBundleOption

WithExportRequestDecoder overrides the JSON request decoder.

func WithExportStore

func WithExportStore(store export.ArtifactStore) ExportBundleOption

WithExportStore sets the artifact store used by go-export.

func WithExportTracker

func WithExportTracker(tracker export.ProgressTracker) ExportBundleOption

WithExportTracker sets the progress tracker used by go-export.

type ExportTemplateOption added in v0.13.0

type ExportTemplateOption func(*exportTemplateOptions)

ExportTemplateOption customizes the default export template renderers.

func WithExportPDFRenderer added in v0.13.0

func WithExportPDFRenderer(builder func(exporttemplate.Renderer) (exportpdf.Renderer, error)) ExportTemplateOption

WithExportPDFRenderer overrides the default PDF renderer builder.

func WithExportTemplateFuncs added in v0.13.0

func WithExportTemplateFuncs(funcs map[string]any) ExportTemplateOption

WithExportTemplateFuncs sets the template helpers used by the export renderer.

func WithExportTemplateMaxRows added in v0.13.0

func WithExportTemplateMaxRows(rows int) ExportTemplateOption

WithExportTemplateMaxRows overrides the buffered template row limit.

func WithExportTemplateName added in v0.13.0

func WithExportTemplateName(name string) ExportTemplateOption

WithExportTemplateName overrides the default template name ("export").

type FiberErrorHandlerOption added in v0.19.0

type FiberErrorHandlerOption func(*fiberErrorHandlerOptions)

FiberErrorHandlerOption customizes the quickstart Fiber error handler.

func WithFiberErrorMappers added in v0.19.0

func WithFiberErrorMappers(mappers ...goerrors.ErrorMapper) FiberErrorHandlerOption

WithFiberErrorMappers appends custom error mappers to the defaults.

type FiberServerOption

type FiberServerOption func(*fiberServerOptions)

FiberServerOption customizes the Fiber server defaults.

func WithFiberConfig

func WithFiberConfig(mutator func(*fiber.Config)) FiberServerOption

WithFiberConfig overrides the default Fiber config.

func WithFiberErrorHandler

func WithFiberErrorHandler(handler fiber.ErrorHandler) FiberServerOption

WithFiberErrorHandler overrides the default error handler.

func WithFiberLogger

func WithFiberLogger(enabled bool) FiberServerOption

WithFiberLogger toggles the default logger middleware.

func WithFiberMiddleware

func WithFiberMiddleware(handlers ...fiber.Handler) FiberServerOption

WithFiberMiddleware appends middleware to the default stack.

type FormGeneratorOption

type FormGeneratorOption func(*formGeneratorConfig)

FormGeneratorOption configures the form generator.

func WithComponentRegistry

func WithComponentRegistry(reg *components.Registry) FormGeneratorOption

WithComponentRegistry replaces the default component registry.

func WithComponentRegistryMergeDefaults

func WithComponentRegistryMergeDefaults(reg *components.Registry) FormGeneratorOption

WithComponentRegistryMergeDefaults merges a custom registry into defaults. Custom components override built-ins with the same name.

func WithVanillaOption

func WithVanillaOption(opt formgenvanilla.Option) FormGeneratorOption

WithVanillaOption appends a vanilla renderer option. These are applied last to allow overrides.

type GoAuthActivitySinkOption added in v0.19.0

type GoAuthActivitySinkOption func(*goAuthActivitySinkOptions)

GoAuthActivitySinkOption customizes how go-auth activity events are mapped.

func WithGoAuthActivityChannel added in v0.19.0

func WithGoAuthActivityChannel(channel string) GoAuthActivitySinkOption

WithGoAuthActivityChannel overrides the channel used for go-auth events.

func WithGoAuthActivityObjectType added in v0.19.0

func WithGoAuthActivityObjectType(objectType string) GoAuthActivitySinkOption

WithGoAuthActivityObjectType overrides the object type used for go-auth events.

type GoUsersPreferencesStore

type GoUsersPreferencesStore struct {
	// contains filtered or unexported fields
}

GoUsersPreferencesStore bridges go-users preferences into the admin preferences contract.

func NewGoUsersPreferencesStore

func NewGoUsersPreferencesStore(repo types.PreferenceRepository) (*GoUsersPreferencesStore, error)

NewGoUsersPreferencesStore builds a preferences store backed by go-users.

func (*GoUsersPreferencesStore) Delete

func (*GoUsersPreferencesStore) Resolve

func (*GoUsersPreferencesStore) Upsert

type ModuleRegistrarOption

type ModuleRegistrarOption func(*moduleRegistrarOptions)

ModuleRegistrarOption customizes module registration behavior.

func WithModuleFeatureDisabledHandler

func WithModuleFeatureDisabledHandler(handler func(feature, moduleID string) error) ModuleRegistrarOption

WithModuleFeatureDisabledHandler configures how feature-disabled modules are handled.

func WithModuleFeatureGates

func WithModuleFeatureGates(gates fggate.FeatureGate) ModuleRegistrarOption

WithModuleFeatureGates enables feature-gated module filtering.

func WithModuleMenuItems

func WithModuleMenuItems(items ...admin.MenuItem) ModuleRegistrarOption

WithModuleMenuItems appends base menu items before seeding.

func WithModuleRegistrarContext

func WithModuleRegistrarContext(ctx context.Context) ModuleRegistrarOption

WithModuleRegistrarContext sets the context used for navigation seeding.

func WithSeedNavigation

func WithSeedNavigation(enabled bool) ModuleRegistrarOption

WithSeedNavigation toggles navigation seeding.

func WithSeedNavigationOptions

func WithSeedNavigationOptions(mutator func(*SeedNavigationOptions)) ModuleRegistrarOption

WithSeedNavigationOptions mutates the seed options before execution.

type MultiFS

type MultiFS []fs.FS

MultiFS tries each filesystem in order until one succeeds.

func (MultiFS) Open

func (m MultiFS) Open(name string) (fs.File, error)

Open implements fs.FS to provide fallback resolution.

func (MultiFS) Stat

func (m MultiFS) Stat(name string) (fs.FileInfo, error)

Stat implements fs.StatFS so callers can validate roots without requiring Open(".") to exist.

type OnboardingHandlers added in v0.19.0

type OnboardingHandlers struct {
	Invite               router.HandlerFunc
	VerifyInvite         router.HandlerFunc
	AcceptInvite         router.HandlerFunc
	SelfRegister         router.HandlerFunc
	ConfirmRegistration  router.HandlerFunc
	RequestPasswordReset router.HandlerFunc
	ConfirmPasswordReset router.HandlerFunc
	TokenMetadata        router.HandlerFunc
}

OnboardingHandlers provides handlers for onboarding routes.

type OnboardingRouteKey added in v0.19.0

type OnboardingRouteKey string

OnboardingRouteKey identifies a specific onboarding endpoint.

const (
	OnboardingRouteInvite               OnboardingRouteKey = "invite"
	OnboardingRouteInviteVerify         OnboardingRouteKey = "invite.verify"
	OnboardingRouteInviteAccept         OnboardingRouteKey = "invite.accept"
	OnboardingRouteRegister             OnboardingRouteKey = "register"
	OnboardingRouteRegisterConfirm      OnboardingRouteKey = "register.confirm"
	OnboardingRoutePasswordResetRequest OnboardingRouteKey = "password.reset.request"
	OnboardingRoutePasswordResetConfirm OnboardingRouteKey = "password.reset.confirm"
	OnboardingRouteTokenMetadata        OnboardingRouteKey = "token.metadata"
)

type OnboardingRouteOption added in v0.19.0

type OnboardingRouteOption func(*onboardingRouteOptions)

OnboardingRouteOption customizes onboarding route registration.

func WithOnboardingAuth added in v0.19.0

func WithOnboardingAuth(auth admin.HandlerAuthenticator) OnboardingRouteOption

WithOnboardingAuth configures the handler authenticator for protected routes.

func WithOnboardingBasePath added in v0.19.0

func WithOnboardingBasePath(basePath string) OnboardingRouteOption

WithOnboardingBasePath overrides the onboarding API base path.

func WithOnboardingProtectedRoutes added in v0.19.0

func WithOnboardingProtectedRoutes(keys ...OnboardingRouteKey) OnboardingRouteOption

WithOnboardingProtectedRoutes overrides which routes should be auth-wrapped.

func WithOnboardingRoutePaths added in v0.19.0

func WithOnboardingRoutePaths(paths OnboardingRoutePaths) OnboardingRouteOption

WithOnboardingRoutePaths overrides specific onboarding route paths.

type OnboardingRoutePaths added in v0.19.0

type OnboardingRoutePaths struct {
	Invite               string
	InviteVerify         string
	InviteAccept         string
	Register             string
	RegisterConfirm      string
	PasswordResetRequest string
	PasswordResetConfirm string
	TokenMetadata        string
}

OnboardingRoutePaths captures full route paths for onboarding endpoints.

func DefaultOnboardingRoutePaths added in v0.19.0

func DefaultOnboardingRoutePaths(basePath string) OnboardingRoutePaths

DefaultOnboardingRoutePaths builds onboarding API paths from the base path.

type PermissionDefinition

type PermissionDefinition struct {
	Key         string
	Description string
}

PermissionDefinition describes a permission entry for registration.

func PreferencesPermissions

func PreferencesPermissions() []PermissionDefinition

PreferencesPermissions returns the default permissions for preferences.

type PermissionRegisterFunc

type PermissionRegisterFunc func(def PermissionDefinition) error

PermissionRegisterFunc registers a permission definition with a host registry.

type PlacementConfig

type PlacementConfig struct {
	MenuCodes      map[string]string
	DashboardAreas map[string]string
}

PlacementConfig maps logical placements to menu codes and dashboard areas.

func DefaultPlacements

func DefaultPlacements(cfg admin.Config) PlacementConfig

DefaultPlacements builds a placement map seeded with defaults.

func (PlacementConfig) DashboardAreaFor

func (p PlacementConfig) DashboardAreaFor(placement, fallback string) string

DashboardAreaFor returns the dashboard area for a placement, with fallback support.

func (PlacementConfig) MenuCodeFor

func (p PlacementConfig) MenuCodeFor(placement, fallback string) string

MenuCodeFor returns the menu code for a placement, falling back to the provided default.

type PreferencesOption

type PreferencesOption func(*preferencesOptions)

PreferencesOption customizes NewAdminWithGoUsersPreferences behavior.

func EnableFeature

func EnableFeature(feature admin.FeatureKey) PreferencesOption

EnableFeature enables a single admin feature key.

func EnablePreferences

func EnablePreferences() PreferencesOption

EnablePreferences enables the preferences feature gate.

func WithPreferencesAdapterHooks

func WithPreferencesAdapterHooks(hooks AdapterHooks) PreferencesOption

WithPreferencesAdapterHooks sets adapter hooks used by NewAdminWithGoUsersPreferences.

type RegistrationUIOption added in v0.19.0

type RegistrationUIOption func(*registrationUIOptions)

RegistrationUIOption customizes the registration UI route.

func WithRegistrationUIBasePath added in v0.19.0

func WithRegistrationUIBasePath(basePath string) RegistrationUIOption

WithRegistrationUIBasePath overrides the base path used by registration UI routes.

func WithRegistrationUIEnabled added in v0.19.0

func WithRegistrationUIEnabled(fn func(admin.Config) bool) RegistrationUIOption

WithRegistrationUIEnabled overrides the self-registration feature guard.

func WithRegistrationUIFeatureGate added in v0.20.0

func WithRegistrationUIFeatureGate(gate fggate.FeatureGate) RegistrationUIOption

WithRegistrationUIFeatureGate sets the feature gate used for default guards.

func WithRegistrationUIMode added in v0.19.0

func WithRegistrationUIMode(fn func(admin.Config) string) RegistrationUIOption

WithRegistrationUIMode overrides the registration mode label in the view context.

func WithRegistrationUIPasswordResetPath added in v0.19.0

func WithRegistrationUIPasswordResetPath(route string) RegistrationUIOption

WithRegistrationUIPasswordResetPath overrides the password reset route path.

func WithRegistrationUIRegisterPath added in v0.19.0

func WithRegistrationUIRegisterPath(route string) RegistrationUIOption

WithRegistrationUIRegisterPath overrides the registration route path.

func WithRegistrationUITemplate added in v0.19.0

func WithRegistrationUITemplate(name string) RegistrationUIOption

WithRegistrationUITemplate overrides the registration template name.

func WithRegistrationUIThemeAssets added in v0.19.0

func WithRegistrationUIThemeAssets(prefix string, assets map[string]string) RegistrationUIOption

WithRegistrationUIThemeAssets sets theme assets (logo, favicon, etc.) for registration UI templates. The prefix is prepended to each asset filename to form the full URL path. Assets are exposed in templates as theme.assets.logo, theme.assets.favicon, etc.

func WithRegistrationUITitle added in v0.19.0

func WithRegistrationUITitle(title string) RegistrationUIOption

WithRegistrationUITitle overrides the registration view title.

func WithRegistrationUIViewContextBuilder added in v0.19.0

func WithRegistrationUIViewContextBuilder(builder RegistrationUIViewContextBuilder) RegistrationUIOption

WithRegistrationUIViewContextBuilder overrides the default view context builder.

type RegistrationUIViewContextBuilder added in v0.19.0

type RegistrationUIViewContextBuilder func(ctx router.ViewContext, c router.Context) router.ViewContext

RegistrationUIViewContextBuilder mutates the view context for registration routes.

type SecureLinkConfig added in v0.19.0

type SecureLinkConfig struct {
	SigningKey string
	Expiration time.Duration
	BaseURL    string
	QueryKey   string
	AsQuery    bool
	Routes     map[string]string
}

SecureLinkConfig captures securelink defaults for onboarding flows.

func SecureLinkConfigFromEnv added in v0.19.0

func SecureLinkConfigFromEnv(basePath string) SecureLinkConfig

SecureLinkConfigFromEnv builds a securelink config from environment variables.

func (SecureLinkConfig) Enabled added in v0.19.0

func (c SecureLinkConfig) Enabled() bool

Enabled reports whether the config has enough data to build a manager.

func (SecureLinkConfig) GetAsQuery added in v0.19.0

func (c SecureLinkConfig) GetAsQuery() bool

func (SecureLinkConfig) GetBaseURL added in v0.19.0

func (c SecureLinkConfig) GetBaseURL() string

func (SecureLinkConfig) GetExpiration added in v0.19.0

func (c SecureLinkConfig) GetExpiration() time.Duration

func (SecureLinkConfig) GetQueryKey added in v0.19.0

func (c SecureLinkConfig) GetQueryKey() string

func (SecureLinkConfig) GetRoutes added in v0.19.0

func (c SecureLinkConfig) GetRoutes() map[string]string

func (SecureLinkConfig) GetSigningKey added in v0.19.0

func (c SecureLinkConfig) GetSigningKey() string

type SecureLinkManagerSetter added in v0.19.0

type SecureLinkManagerSetter interface {
	WithSecureLinkManager(userstypes.SecureLinkManager)
}

SecureLinkManagerSetter allows injecting securelink managers into host components.

type SecureLinkUIConfig added in v0.19.0

type SecureLinkUIConfig struct {
	QueryKey string
	AsQuery  bool
}

SecureLinkUIConfig exposes link parsing details for templates.

func SecureLinkUIConfigFromEnv added in v0.19.0

func SecureLinkUIConfigFromEnv(basePath string) SecureLinkUIConfig

SecureLinkUIConfigFromEnv reads securelink parsing defaults from env.

type SecureLinkUsersOption added in v0.19.0

type SecureLinkUsersOption func(*secureLinkUsersOptions)

SecureLinkUsersOption customizes go-users securelink wiring.

func WithSecureLinkInviteRoute added in v0.19.0

func WithSecureLinkInviteRoute(route string) SecureLinkUsersOption

WithSecureLinkInviteRoute overrides the invite accept route key used by go-users.

func WithSecureLinkPasswordResetRoute added in v0.19.0

func WithSecureLinkPasswordResetRoute(route string) SecureLinkUsersOption

WithSecureLinkPasswordResetRoute overrides the password reset route key used by go-users.

func WithSecureLinkRegistrationRoute added in v0.19.0

func WithSecureLinkRegistrationRoute(route string) SecureLinkUsersOption

WithSecureLinkRegistrationRoute overrides the registration route key used by go-users.

type SeedNavigationOptions

type SeedNavigationOptions struct {
	MenuSvc    admin.CMSMenuService
	MenuCode   string
	Items      []admin.MenuItem
	Reset      bool
	ResetEnv   string
	Locale     string
	Logf       func(format string, args ...any)
	SkipLogger bool

	// AutoCreateParents allows seeds to omit intermediate path segments; go-cms will scaffold them as group nodes.
	AutoCreateParents bool
}

SeedNavigationOptions drives the quickstart menu seeding workflow.

type SessionUser

type SessionUser struct {
	ID              string            `json:"id,omitempty"`
	Subject         string            `json:"subject,omitempty"`
	Username        string            `json:"username,omitempty"`
	Email           string            `json:"email,omitempty"`
	Role            string            `json:"role,omitempty"`
	TenantID        string            `json:"tenant_id,omitempty"`
	OrganizationID  string            `json:"organization_id,omitempty"`
	ResourceRoles   map[string]string `json:"resource_roles,omitempty"`
	Metadata        map[string]any    `json:"metadata,omitempty"`
	Scopes          []string          `json:"scopes,omitempty"`
	IssuedAt        *time.Time        `json:"issued_at,omitempty"`
	ExpiresAt       *time.Time        `json:"expires_at,omitempty"`
	IsAuthenticated bool              `json:"is_authenticated"`
	DisplayName     string            `json:"display_name,omitempty"`
	Subtitle        string            `json:"subtitle,omitempty"`
	Initial         string            `json:"initial,omitempty"`
	AvatarURL       string            `json:"avatar_url,omitempty"`
}

SessionUser captures session metadata to expose in templates and APIs.

func BuildSessionUser

func BuildSessionUser(ctx context.Context) SessionUser

BuildSessionUser extracts actor/claims data from the request context.

func FilterSessionUser

func FilterSessionUser(session SessionUser, gate fggate.FeatureGate) SessionUser

FilterSessionUser hides tenant/org data when those features are disabled.

func (SessionUser) ToViewContext

func (s SessionUser) ToViewContext() map[string]any

ToViewContext converts the session into snake_case keys for templates.

type SharedActivitySinks added in v0.19.0

type SharedActivitySinks struct {
	Admin admin.ActivitySink
	Auth  auth.ActivitySink
}

SharedActivitySinks bundles the admin + go-auth adapters.

func NewSharedActivitySinks added in v0.19.0

NewSharedActivitySinks builds a shared activity sink for admin/go-users/go-auth.

type StaticAssetsOption

type StaticAssetsOption func(*staticAssetsOptions)

StaticAssetsOption customizes the asset mounting behavior.

func WithAssetsPrefix

func WithAssetsPrefix(prefix string) StaticAssetsOption

WithAssetsPrefix overrides the base assets route prefix.

func WithDiskAssetsDir

func WithDiskAssetsDir(dir string) StaticAssetsOption

WithDiskAssetsDir configures a disk-backed asset directory (for dev overrides).

func WithDiskAssetsFS

func WithDiskAssetsFS(fsys fs.FS) StaticAssetsOption

WithDiskAssetsFS supplies a disk asset filesystem directly.

func WithEChartsPrefix

func WithEChartsPrefix(prefix string) StaticAssetsOption

WithEChartsPrefix overrides the go-dashboard ECharts assets prefix.

func WithExtraAssetsFS

func WithExtraAssetsFS(fsys ...fs.FS) StaticAssetsOption

WithExtraAssetsFS appends additional asset fallbacks.

func WithFormgenPrefix

func WithFormgenPrefix(prefix string) StaticAssetsOption

WithFormgenPrefix overrides the formgen assets route prefix.

func WithRuntimePrefix

func WithRuntimePrefix(prefix string) StaticAssetsOption

WithRuntimePrefix overrides the formgen runtime route prefix.

func WithSidebarAssetsFS

func WithSidebarAssetsFS(fsys fs.FS) StaticAssetsOption

WithSidebarAssetsFS overrides the default quickstart sidebar assets.

type TemplateFuncOption

type TemplateFuncOption func(*templateFuncOptions)

TemplateFuncOption customizes default template functions.

func WithTemplateFeatureGate added in v0.20.0

func WithTemplateFeatureGate(gate fggate.FeatureGate, opts ...fgtemplates.HelperOption) TemplateFuncOption

WithTemplateFeatureGate registers feature template helpers using the provided gate.

func WithWidgetTitleFunc

func WithWidgetTitleFunc(fn func(string) string) TemplateFuncOption

WithWidgetTitleFunc replaces the widget title resolver.

func WithWidgetTitleMap

func WithWidgetTitleMap(titles map[string]string) TemplateFuncOption

WithWidgetTitleMap replaces the default widget title map.

func WithWidgetTitleOverrides

func WithWidgetTitleOverrides(overrides map[string]string) TemplateFuncOption

WithWidgetTitleOverrides updates the default widget title map.

type ThemeOption

type ThemeOption func(*themeOptions)

ThemeOption customizes the default theme manifest/registry.

func WithThemeAssets

func WithThemeAssets(prefix string, files map[string]string) ThemeOption

WithThemeAssets configures default assets for the manifest.

func WithThemeManifest

func WithThemeManifest(manifest *theme.Manifest) ThemeOption

WithThemeManifest overrides the default manifest entirely.

func WithThemeRegistry

func WithThemeRegistry(registry theme.Registry) ThemeOption

WithThemeRegistry supplies a registry for theme registration.

func WithThemeVariants

func WithThemeVariants(variants map[string]theme.Variant) ThemeOption

WithThemeVariants overrides the default variant definitions.

type UIRouteOption added in v0.13.0

type UIRouteOption func(*uiRouteOptions)

UIRouteOption customizes the default UI route wiring.

func WithUIActivityActive added in v0.14.0

func WithUIActivityActive(active string) UIRouteOption

WithUIActivityActive sets the active menu key for the activity route.

func WithUIActivityPath added in v0.14.0

func WithUIActivityPath(route string) UIRouteOption

WithUIActivityPath overrides the activity route path.

func WithUIActivityRoute added in v0.14.0

func WithUIActivityRoute(enabled bool) UIRouteOption

WithUIActivityRoute toggles the activity route registration.

func WithUIActivityTemplate added in v0.14.0

func WithUIActivityTemplate(name string) UIRouteOption

WithUIActivityTemplate overrides the activity template name.

func WithUIActivityTitle added in v0.14.0

func WithUIActivityTitle(title string) UIRouteOption

WithUIActivityTitle overrides the activity view title.

func WithUIBasePath added in v0.13.0

func WithUIBasePath(basePath string) UIRouteOption

WithUIBasePath overrides the base path used to build default routes.

func WithUIDashboardActive added in v0.13.0

func WithUIDashboardActive(active string) UIRouteOption

WithUIDashboardActive sets the active menu key for the dashboard route.

func WithUIDashboardPath added in v0.13.0

func WithUIDashboardPath(route string) UIRouteOption

WithUIDashboardPath overrides the dashboard route path.

func WithUIDashboardRoute added in v0.13.0

func WithUIDashboardRoute(enabled bool) UIRouteOption

WithUIDashboardRoute toggles the dashboard route registration.

func WithUIDashboardTemplate added in v0.13.0

func WithUIDashboardTemplate(name string) UIRouteOption

WithUIDashboardTemplate overrides the dashboard template name.

func WithUIDashboardTitle added in v0.13.0

func WithUIDashboardTitle(title string) UIRouteOption

WithUIDashboardTitle overrides the dashboard view title.

func WithUIFeatureFlagsActive added in v0.21.0

func WithUIFeatureFlagsActive(active string) UIRouteOption

WithUIFeatureFlagsActive sets the active menu key for the feature flags route.

func WithUIFeatureFlagsPath added in v0.21.0

func WithUIFeatureFlagsPath(route string) UIRouteOption

WithUIFeatureFlagsPath overrides the feature flags route path.

func WithUIFeatureFlagsRoute added in v0.21.0

func WithUIFeatureFlagsRoute(enabled bool) UIRouteOption

WithUIFeatureFlagsRoute toggles the feature flags route registration.

func WithUIFeatureFlagsTemplate added in v0.21.0

func WithUIFeatureFlagsTemplate(name string) UIRouteOption

WithUIFeatureFlagsTemplate overrides the feature flags template name.

func WithUIFeatureFlagsTitle added in v0.21.0

func WithUIFeatureFlagsTitle(title string) UIRouteOption

WithUIFeatureFlagsTitle overrides the feature flags view title.

func WithUINotificationsActive added in v0.13.0

func WithUINotificationsActive(active string) UIRouteOption

WithUINotificationsActive sets the active menu key for the notifications route.

func WithUINotificationsPath added in v0.13.0

func WithUINotificationsPath(route string) UIRouteOption

WithUINotificationsPath overrides the notifications route path.

func WithUINotificationsRoute added in v0.13.0

func WithUINotificationsRoute(enabled bool) UIRouteOption

WithUINotificationsRoute toggles the notifications route registration.

func WithUINotificationsTemplate added in v0.13.0

func WithUINotificationsTemplate(name string) UIRouteOption

WithUINotificationsTemplate overrides the notifications template name.

func WithUINotificationsTitle added in v0.13.0

func WithUINotificationsTitle(title string) UIRouteOption

WithUINotificationsTitle overrides the notifications view title.

func WithUIViewContextBuilder added in v0.13.0

func WithUIViewContextBuilder(builder UIViewContextBuilder) UIRouteOption

WithUIViewContextBuilder overrides the default view context builder.

type UIViewContextBuilder added in v0.13.0

type UIViewContextBuilder func(ctx router.ViewContext, active string, c router.Context) router.ViewContext

UIViewContextBuilder mutates the view context for UI routes.

type UserMigrationsOption added in v0.19.0

type UserMigrationsOption func(*userMigrationsOptions)

UserMigrationsOption customizes user-related migrations registration.

func WithUserMigrationsAuthBootstrapEnabled added in v0.19.0

func WithUserMigrationsAuthBootstrapEnabled(enabled bool) UserMigrationsOption

WithUserMigrationsAuthBootstrapEnabled toggles go-users auth bootstrap migrations.

func WithUserMigrationsAuthBootstrapFS added in v0.19.0

func WithUserMigrationsAuthBootstrapFS(fsys fs.FS) UserMigrationsOption

WithUserMigrationsAuthBootstrapFS overrides go-users auth bootstrap migrations.

func WithUserMigrationsAuthEnabled added in v0.19.0

func WithUserMigrationsAuthEnabled(enabled bool) UserMigrationsOption

WithUserMigrationsAuthEnabled toggles go-auth migrations.

func WithUserMigrationsAuthExtrasEnabled added in v0.19.0

func WithUserMigrationsAuthExtrasEnabled(enabled bool) UserMigrationsOption

WithUserMigrationsAuthExtrasEnabled toggles go-users auth extras migrations.

func WithUserMigrationsAuthExtrasFS added in v0.19.0

func WithUserMigrationsAuthExtrasFS(fsys fs.FS) UserMigrationsOption

WithUserMigrationsAuthExtrasFS overrides go-users auth extras migrations.

func WithUserMigrationsAuthFS added in v0.19.0

func WithUserMigrationsAuthFS(fsys fs.FS) UserMigrationsOption

WithUserMigrationsAuthFS overrides the go-auth migrations filesystem (rooted at data/sql/migrations).

func WithUserMigrationsCoreEnabled added in v0.19.0

func WithUserMigrationsCoreEnabled(enabled bool) UserMigrationsOption

WithUserMigrationsCoreEnabled toggles go-users core migrations.

func WithUserMigrationsCoreFS added in v0.19.0

func WithUserMigrationsCoreFS(fsys fs.FS) UserMigrationsOption

WithUserMigrationsCoreFS overrides the go-users core migrations filesystem (rooted at data/sql/migrations).

func WithUserMigrationsValidationTargets added in v0.19.0

func WithUserMigrationsValidationTargets(targets ...string) UserMigrationsOption

WithUserMigrationsValidationTargets overrides validation targets used by go-persistence-bun.

type ViewEngineOption

type ViewEngineOption func(*viewEngineOptions)

ViewEngineOption customizes the view engine config.

func WithViewAssetsFS

func WithViewAssetsFS(fsys ...fs.FS) ViewEngineOption

WithViewAssetsFS appends asset fallbacks.

func WithViewDebug

func WithViewDebug(enabled bool) ViewEngineOption

WithViewDebug toggles view engine debug mode.

func WithViewEmbed

func WithViewEmbed(enabled bool) ViewEngineOption

WithViewEmbed toggles embedded filesystem usage.

func WithViewExt

func WithViewExt(ext string) ViewEngineOption

WithViewExt sets the template extension.

func WithViewFeatureGate added in v0.20.0

func WithViewFeatureGate(gate fggate.FeatureGate, helperOpts ...fgtemplates.HelperOption) ViewEngineOption

WithViewFeatureGate registers feature template helpers using the provided gate.

func WithViewReload

func WithViewReload(enabled bool) ViewEngineOption

WithViewReload toggles template reload behavior.

func WithViewTemplateFuncs

func WithViewTemplateFuncs(funcs map[string]any) ViewEngineOption

WithViewTemplateFuncs overrides template functions.

func WithViewTemplatesFS

func WithViewTemplatesFS(fsys ...fs.FS) ViewEngineOption

WithViewTemplatesFS appends template fallbacks.

func WithViewURLPrefix

func WithViewURLPrefix(prefix string) ViewEngineOption

WithViewURLPrefix sets the assets URL prefix.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL