Bus UI Portal Integration

Module pages with host-owned runtime context.

Portal helpers wrap module HTML in shared chrome while keeping public config, provider origins, static assets, and API bases explicit.

Portal pieces

PieceUse it forNames
ShellRender a module page with shared portal chrome.PortalShell
SessionRender safe public identity/session state from host context.Session
Host contextPass module id, base paths, public config, assets, and provider origins.uiportal.HostContext
Runtime configExpose non-secret JSON that frontend hosts can read.RuntimeConfig
ResolutionBuild module URLs and API URLs without hard-coded deployment paths.APIURLResolver

Example

Loading Portal demo...

Go API

import (
  gx "github.com/busdk/bus-gx/pkg/gx"
  uiportal "github.com/busdk/bus-ui/pkg/uiportal"
)

page := gx.Element("main", nil, gx.Text("Portal content"))

node := uiportal.PortalShell(uiportal.PortalShellProps{
  Title: "Accounting",
  HostContext: uiportal.HostContext{
    ModuleID:       "accounting",
    BasePath:       "/modules/accounting/",
    PortalBasePath: "/",
    PublicRuntimeConfig: map[string]any{
      "locale": "fi-FI",
    },
  },
  MainNodes: []gx.Node{
    page,
  },
})

html, err := gx.RenderHTML(node)

.gx source

In .gx source, author the visible component state as GX markup. Keep the Go API block above for the package helper or render-boundary call.

package busuiexamples

import gx "github.com/busdk/bus-gx/pkg/gx"

func PortalShellExample() gx.Node {
  return <PortalShell title="Accounting" moduleId="accounting">
    <main>Portal content</main>
  </PortalShell>
}