backofficeui

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package backofficeui embeds the generic back-office SPA and serves it from the engine binary under /app (ENG-38, the first-10-minutes path). It is the PRODUCT face of the backoffice-spec pattern: a CRUD admin UI generated ENTIRELY from /openapi.json at runtime — zero resource-specific screens, zero hardcoded domain knowledge — so ONE prebuilt bundle serves every schema this engine will ever boot. APP-VITRINA-S1 rebuilt its skin on the design system atina proved on this engine (ink sidebar, one accent, bundled Inter, positional lifecycle chips, a board derived from the state machine, drawer forms, toasts) — hand-written static CSS + vanilla JS, still no build step, still nothing domain-specific. In the minute-3 of a first contact, /app is the screen that feels like *your* app: your resources, your fields, your RBAC.

The SPA is no-build vanilla JS (ES modules), so unlike /admin and /editor there is no "assets not built" state: the source files ARE the bundle, committed and always embedded. It is the same pattern verified in examples/backoffice-guide/ (the teaching copy consumers adapt into their own SPA — that copy stays deliberately minimal and self-contained; this one may grow product polish). Everything either copy knows comes from the contract: x-appximo-relation/references, x-appximo-file(+policy), x-appximo-initial/transitions, x-appximo-virtual-resources.

Serving model (mirrors pkg/adminui): /app redirects to /app/ so the SPA's RELATIVE asset references resolve under the mount; /app/ serves the shell; /app/<file> serves the module files. All static, JWT-skipped (the shell loads before any token exists — the API calls it makes carry the Bearer), off the CRUD hot path.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(r chi.Router) error

Register mounts the back-office routes on r: /app (redirect), /app/ (shell) and /app/<file> (the ES-module files). The /app prefix is JWT-skipped (like /admin and /editor) and reserved against user static mounts.

func RegisterOpts added in v0.1.9

func RegisterOpts(r chi.Router, opts Options) error

RegisterOpts is Register with the theme/demo customization seams.

Types

type Banner struct {
	Text string `json:"text"`
	Href string `json:"href,omitempty"`
}

Banner is the consumer's return bar for /app (see Options.Banner).

type Options added in v0.1.9

type Options struct {
	// ThemeCSS, when non-empty, is served at /app/theme.css INSTEAD of the
	// embedded default (which is empty). style.css defines every color, radius
	// and font as --app-* tokens on :root and index.html links theme.css after
	// it, so a consumer re-skins the whole panel by redefining tokens here —
	// no rebuild, no fork. Stock binary: APPXIMO_APP_THEME_CSS=<path>.
	ThemeCSS []byte
	// DemoRoles lists the RBAC roles for which the SPA runs in DEMO MODE:
	// writes are simulated in a per-session in-memory overlay (a reload
	// resets) and never sent to the API. The role's server-side policy should
	// be read-only — the overlay is coherence for the visitor, the RBAC is
	// the security boundary. Published at /app/ui-config.json (role names are
	// not secrets; the endpoint lists only these). Stock binary:
	// APPXIMO_APP_DEMO_ROLES=<comma-separated>.
	DemoRoles []string
	// Banner, when set, is a one-line bar the SPA renders above its shell
	// (login and panel alike): the consumer's TEXT and ONE link — the way
	// back to the storefront/landing from a public demo panel (ENG-46). It
	// travels in /app/ui-config.json as {text, href} and the SPA renders it
	// as text + an <a> (textContent, never markup), so no HTML is injected;
	// Href is validated here (http/https/mailto/tel or a same-site path).
	// Stock binary: APPXIMO_APP_BANNER_TEXT + APPXIMO_APP_BANNER_HREF.
	Banner *Banner
}

Options customizes the served back-office without touching the embedded bundle (DEMO-SHOWCASE-S1 — "your panel, your colors").

Jump to

Keyboard shortcuts

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