// PART 06
UI server, suite shell, theme, and i18n
botui is the static front-end server: three site trees (suite on 3000, cloud
on 4000, login on 5000) served from botui/ui/, with botserver supplying
APIs and HTMX fragments behind them. Changes to HTML/JS/CSS need no
recompilation — refresh the page; only Rust changes in botui/src/ need
cargo build -p botui.
The three sites
| Port | Tree | Serves | Never serves |
|---|---|---|---|
| 3000 | botui/ui/suite/ |
chat, apps, desktop shell | /cloud/* |
| 4000 | botui/ui/cloud/ |
store, dashboard, plans, offers | /login, /signup (307 → 5000) |
| 5000 | botui/ui/login/ |
login, signup | application pages |
GB_LOGIN_URL (from the LOGIN_URL env var, default
http://localhost:5000) is injected into suite and cloud pages so the front
end can redirect to the login site without hardcoding it.
The desktop shell
suite/desktop.html bootstraps the workspace: window manager, taskbar, app
tiles, security context. Suite apps are HTMX fragments loaded into that shell
(hx-get partials); opening an app HTML directly breaks it, which is why
deep links always go through desktop routes (/drive, /chat/<bot>).
Module pattern for app code (botui/ui/suite/<app>/modules/):
<app>.html # loads plain <script> files in order
modules/
├── 01_state.js # config, state, constants
├── 02_render.js # rendering
├── 03_events.js # event handlers
└── 99_init.js # only the init() call
Plain scripts (not ES modules), globally visible via load order, each file
under 450 lines and starting with "use strict";, named
{order}_{firstFunctionName}.js.
Design system
DESIGN-SYSTEM.md at the repository root is the mandatory standard for every
UI (suite, cloud, login, assistant, splash, desktop):
- All colors, spacing, radii, shadows, motion and typography come from the
--id-*identity tokens inbotui/ui/suite/identity/tokens.css. - The default theme (
suite/public/themes/default.css) is identical to the design system; other themes vary only the accent color — never layout or component look. - Local fonts only (
identity/fonts.css), inline local icons, no CDN links. --id-focusis a box-shadow token used asbox-shadow, not an outline color.
i18n
No user-facing string is hardcoded. HTML uses data-i18n (plus
data-i18n-placeholder, -title, -aria-label); JS uses
gbT("key", "English fallback"). Every new or changed key must be added to
all locale catalogs — botlib/locales/{en,it,ru,pt-BR,es,fr,de,ja,ko,zh-CN}/*.ftl,
one .ftl per feature topic. Inventing auto-* keys (machine-generated,
uncatalogued) is forbidden, and status regions need
role="status" aria-live="polite".
What botserver contributes to the UI
| Surface | Endpoint family |
|---|---|
| HTMX fragments | /api/ui/*, /cloud/partials/* |
| Product/profile | GET /api/product (.product values) |
| App catalog + installs | /api/apps/* |
| WebSocket | /ws (chat, office events) |
botserver never returns a complete HTML page — if you find yourself writing
one in a route handler, it belongs in botui/ui/ instead.
Testing the UI
All web-facing verification is browser-based (Chrome CDP); opening apps
inside the desktop shell is mandatory — a direct app URL renders a broken
shell and proves nothing. Screenshots go to /tmp/, never the repository.