Skip to content
minderhqPublic

About

Minder management console — the operator web UI (React 18 + Vite + Tailwind). Talks to the Minder api-gateway.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

minder-client

Minder's management console — the operator web UI (open source, Apache-2.0). React 18 + Vite + React Router 7 + Tailwind 4, ~6.3k LOC. Served on :8009 (loopback + Traefik client.minder.local, forward-auth gated).

Distinct from OpenWebUI (that's the chat UI). This is the plugin-config / knowledge-base / pipeline / model / graph / voice management UI. It talks to the Minder api-gateway (:8000) through a thin typed fetch layer (src/lib/api.ts); it never calls downstream services directly.

This is a standalone repository. The Minder core consumes it as a git submodule (mounted at src/services/client) and builds this same Dockerfile via its compose stack — so the console is developed, tested, and versioned here, independently of the (closed-source) core.

Run / check

npm install
npm run dev          # Vite dev server (localhost:5173)

# The CI-mirroring checks — green locally ⇒ green in this repo's CI job. Run all
# four before pushing:
npm run typecheck    # tsc -b --noEmit
npm run lint         # eslint .
npm run test         # vitest run  (jsdom; pure-logic + hook/component tests)
npm run build        # tsc -b && vite build

Build-time configuration (VITE_*)

VITE_* vars are baked in at image build time (Vite convention), not read at container start — changing one means rebuilding the image, not just restarting. Set via the compose build.args (which read CLIENT_* from .env); each also has a matching ARG default in the Dockerfile.

Var Default Meaning
VITE_API_BASE_URL /api (image) api-gateway base for all fetch() calls. The image default is relative: the proxy in front serves the console at / and the gateway at /api on one hostname, so one image works on any domain. Set an absolute URL (e.g. http://localhost:8000) when the gateway is elsewhere; npm run dev falls back to http://localhost:8000.
VITE_OIDC_LOGIN_URL (empty) SSO login entry (full-page nav into Authelia's OIDC flow). No default — only a real Traefik + DNS + TLS deployment has it. When unset, the SSO button is hidden and local login is the only option (over localhost the *.minder.local host can't resolve, so a baked URL would dead-end).
VITE_AUTHELIA_PORTAL_URL (empty) Authelia self-service portal link on the Settings page. Same opt-in rule; plain text shown when unset.
VITE_DEPLOYMENT_MODE self-hosted saas, self-hosted or air-gapped. Decides the plan notices' actions: SaaS billing owners get Upgrade / trial; self-hosted shows "requires a licence" with no buy buttons; air-gapped never links outside.

Both *.minder.local URLs are empty-by-default on purpose (a recurring localhost dead-link class): render the link only when the deployment configures it. See src/lib/api.ts.

Security response headers (runtime)

nginx sends a Content-Security-Policy, X-Frame-Options: DENY, X-Content-Type-Options: nosniff, Referrer-Policy: no-referrer and, when the TLS front door forwarded an HTTPS request (X-Forwarded-Proto: https), Strict-Transport-Security. The default CSP:

default-src 'self'; script-src 'self'; style-src 'self';
img-src 'self' data: blob: https:; media-src 'self' blob:; font-src 'self' data:;
connect-src 'self' <origin of VITE_API_BASE_URL>; object-src 'none';
base-uri 'self'; form-action 'self'; frame-ancestors 'none'

script-src 'self' means no inline scripts: index.html loads public/theme-init.js instead (src/nginxConfig.test.ts checks this). The headers are written at container start by docker/security-headers.sh, so these env vars apply after a restart, no rebuild:

Var Default Meaning
CLIENT_SECURITY_HEADERS on off drops all of the headers above. Only when your own reverse proxy sets them.
CLIENT_CSP (empty) Replaces the whole default CSP, e.g. to allow another API origin.

Layout

src/
├── main.tsx                 # entry: BrowserRouter + <App/>
├── App.tsx                  # shell (sidebar/header) + Routes, wrapped in <ErrorBoundary>
├── pages/                   # one component per route (25 pages)
├── components/              # shared UI building blocks (below)
└── lib/                     # framework-agnostic helpers + hooks (below)

components/ — shared UI

  • ErrorBoundary.tsx — top-level render-crash guard (class component; no hook equivalent). Wraps <Routes> keyed by pathname, so any page throw shows a recoverable "Try again / Reload" fallback instead of blanking the app.
  • SourceBadge.tsx / PluginVersion.tsx — a plugin's source badge (text + icon + accessible name) and its version with the "newer version listed" hint, shared by the Discover and Installed plugin cards.
  • StatusLine.tsx — accessible status/error line (aria-live: polite for info, assertive for errors). The standard way pages surface load/mutation status.
  • EmptyState.tsx — the "nothing here yet" line for empty lists (one voice).
  • Sidebar.tsx / PageTabs.tsx / CommandPalette.tsx — all three render from lib/nav.ts (see "Navigation and routes" below).
  • RedirectWithQuery.tsx — <Navigate replace> that keeps ?query and #hash, used for every redirect in lib/routes.ts.
  • ExternalLink.tsx — new-tab link for an API-supplied URL (rel="noopener noreferrer"). Only http(s) URLs become links (lib/safeUrl.ts); anything else (javascript:, data:, …) shows as text with a note.
  • MindHubConnectionPlaceholder.tsx — informational panel on Platform › MindHub & sources until the real connection (#2201) lands. No controls.
  • PageHeader.tsx, InfoCallout.tsx, ConfirmDialog.tsx (via useConfirm()), Sidebar.tsx, UserMenu.tsx.

lib/ — helpers & hooks

  • api.ts — apiFetch<T> / apiFetchBlob (bearer injection, JSON/error handling, optional AbortSignal), ApiError, friendlyErrorMessage, and the Paginated<T> list envelope ({items,total,limit,offset}, matches the backend shared.models.PaginatedList — #501).
  • auth.tsx — AuthProvider / useAuth (JWT in sessionStorage; SSO callback
    • local login; silent token refresh). Pure claim helpers live in jwt.ts (decodeJwtClaims, localExpiryMs, refreshDelayMs) so they're testable without rendering the provider.
  • useAsyncResource.ts — declarative data-fetch hook: AbortController cancellation + stale-response race guard + opt-in timeoutMs. Replaces the hand-rolled data/status/isError/loadX/useEffect boilerplate. Adopt it when a page has deps-driven reloads or already re-fetches after mutations; skip it for a mount-only load that uses local optimistic add/filter (reload would only add round-trips).
  • usePaginatedList.ts — "load a page, then Load More" offset pagination for the marketplace catalog.
  • modelProviders.ts — typed /v1/model-providers calls and shapes for Cloud Providers (list, presets, create/update/delete, test, fetch-models), plus the model-id validation that mirrors the backend's rules.
  • modelDefaults.ts — typed /v1/model-defaults calls (the org's default model per role: answer, chat, extraction, utility), the Local/Cloud rule every model picker uses (a remote: id is Cloud unless its provider is marked local), and the knowledge-base data_policy (Cloud allowed / Local only) labels and error messages.
  • marketplace.ts — typed marketplace / plugin-registry calls and shapes (catalog, runtime-loaded plugins, installations/me); the start of #2198's single typed module. installedPlugins.ts + useInstalledPlugins.ts merge the runtime list with your installs for Installed › Plugins, joined by the backend's marketplace_plugin_id (the whole catalog is fetched only from a backend that predates those fields); pluginSource.ts maps the backend's install_source / origin to a source (First-party / Private git / Manifest upload / Submitted, MindHub reserved) for SourceBadge and Discover's ?source= filter (sent as the catalog's origin param). pluginSourceLegacy.ts holds the old repository-URL heuristic, used only for those older backends; pluginVersion.ts compares installed vs listed versions. submissionReview.ts holds the submission review queue's shapes, status vocabulary, reviewer transitions (mirroring the backend state machine) and confirm-dialog copy.
  • emailVerification.ts — registration email verification (#2447): the verify / resend calls mapped to outcomes (expired vs used link, cooldown from Retry-After, the 409 codes), the fragment-token reader, and the hook that swaps a signed-in session's restricted token for a full one once confirmed. WorkspaceGate shows CheckEmailPage while the account must confirm its address (profile, login response, or a 403 email_verification_required); the emailed link opens VerifyEmailPage (/verify-email#token=…).
  • ui.ts — Tailwind class constants (inputClass, primaryButtonClass, cardClass, badgeClass, …), the badgeTone {success,warn,danger} palette, confidenceBadgeColor, fieldHintClass, mutedTextClass. Change a style once here instead of N pages.
  • stt.ts (matchingSttLanguage), browser.ts, links.ts (openWebUiUrl), useDebouncedValue.ts, useElapsedSeconds.ts.

Navigation and routes

src/lib/nav.ts is the single source for the sidebar, the in-page tabs (PageTabs) and the ⌘K palette, including permission gating (visibleEntry / leafVisible, through useCan). src/lib/routes.ts holds the routes and every redirect. The menu has three layers for everyone (Use / Build / Me) and, below a divider, Organization (the tenant) and Platform (the installation), each row shown only to callers who hold its permission. One vocabulary is used for the route, the tab, the page title (PageHeader) and the palette entry; tests hold the pages' titles to nav.ts (its copy: src/i18n/messages). useRouteFocus moves focus to the new page's <h1> after a client-side navigation.

Section › entry Tabs → route Menu row for
Use › Home, Chat / · New chat /ask · History /rag/conversations every member
Build › Knowledge Knowledge bases /rag · Knowledge graph /rag/graph · Taxonomy review /rag/taxonomy-review every member
Build › Assistants /rag/pipelines every member
Build › Discover Plugins /marketplace/discover/plugins (?source=, ?q=) · Installed /marketplace/installed/plugins (AI tools pages /marketplace/{discover,installed}/ai-tools are linked from the plugin pages, no row) every member
Me › My team, My account /team · Profile /account · Voice /account/voice · My requests /account/requests every member
Organization › Overview, People /organization · Members, Invites, Requests (the inbox), Domains /organization/people/* org.settings.manage · org.members.manage
Organization › Teams, AI, Plugins /organization/teams · /organization/ai(/defaults) · /organization/plugins the page's key
Organization › Website chatbots /organization/chatbots(/:endpointId/conversations(/:sessionId)) org.chatbots.manage
Organization › Knowledge quality /organization/knowledge-quality (entity merges) org.settings.manage (the page serves any member)
Organization › Security, Plan & billing Audit log /organization/security/audit (the active org) · /organization/billing org.audit.view · org.billing.view
Platform Status & logs /status (public) · Local models /platform/models · Modules /platform/modules(/installed) · All organizations /platform/organizations · All users /platform/users · MindHub & sources /platform/sources(/:repositoryId) · Backups /platform/backups · Platform audit log /platform/audit Platform Admin

Old URLs (/plugins/*, /ai-tools/*, /bundles/*, /billing, /audit, /settings, /rag/public-chat/*, /marketplace/publish/*, …) redirect to these, query string included. Add to LEGACY_REDIRECTS when you move a page; never remove an entry.

Translations (i18n)

The console ships in English and Turkish. Copy lives in typed message catalogs, not in components:

  • src/i18n/messages/en.ts is the source of truth for the keys; src/i18n/messages/tr.ts is typed against it, so a key missing from (or extra in) any language fails tsc, and t() rejects unknown keys too.
  • In a component: const { t, plural, rich, formatDate, formatNumber } = useI18n(). t("shell.searchOrJump"); {name} placeholders take t(key, { name }); plurals are objects of CLDR forms (one, other, optional =0) read with plural(key, count); rich(key, { link: <a…/> }) fills a placeholder with a React node. Dates and numbers go through Intl in the active locale.
  • Outside React (e.g. friendlyErrorMessage): i18n().t(…).
  • Language on load: the saved choice (localStorage minder-locale), then the browser's languages, then English. Once a signed-in account's profile loads, its language wins: the user's own locale, then the org's default_locale, then the browser's languages, then English (adoptProfileLocale). Settings › Language applies the choice at once and saves it to the profile, switching back with an error if the save fails; signed-out pages stay browser-only. Org owners/admins set the org default on the Organization page. <html lang> follows.
  • Lint: files listed in I18N_MIGRATED_FILES (eslint.config.js) may not contain hard-coded user-facing text (JSX text, string children, aria-label, title, placeholder, …). When you move a file's copy into the catalogs, add it to that list. Write Turkish copy as natural Turkish with its proper characters (ç ğ ı İ ö ş ü), not a word-for-word rendering.

Why no i18n library: the catalogs are plain typed objects and the runtime is about 250 lines over Intl.PluralRules / NumberFormat / DateTimeFormat, so there is no extra dependency, keys are checked by tsc without codegen, and the whole change (runtime, both catalogs, migrated screens) adds about 9 kB gzipped to the bundle.

Tests

Vitest (jsdom). Currently pure logic + hooks + one component (api, jwt, stt, ui, browser, usePaginatedList, useAsyncResource, ErrorBoundary). The config is intentionally plugin-less (esbuild transforms JSX); component/hook tests via @testing-library/react work, but add an explicit cleanup() in afterEach — there's no global setup file, so auto-cleanup isn't registered. Fake-timer tests must use vi.advanceTimersByTimeAsync (not waitFor, which deadlocks under fake timers).

API contract

openapi/api-gateway.json is the API Gateway's OpenAPI spec, synced from the published copy on the docs site (https://raw.githubusercontent.com/minderhq/docs/main/docs/api/openapi/api-gateway.json).

  • npm run gen:api regenerates src/lib/api-types.gen.ts from it with openapi-typescript (pinned devDependency). Never edit the generated file; the hand-written DTOs in lib/types.ts etc. can adopt these types over time.
  • src/lib/apiContract.test.ts (part of npm test) checks every /v1/... path the client uses -- and, for apiFetch/apiFetchBlob/fetch calls with an inline method, the method -- exists in the spec. A call to a route the gateway doesn't serve fails CI. Known gaps go in its KNOWN_MISSING map, each with a reason.
  • CI drift check: CI downloads the published spec, runs gen:api, and fails if openapi/ or the generated types differ from what's committed. When the gateway's API changes, sync with:
curl -fsSL https://raw.githubusercontent.com/minderhq/docs/main/docs/api/openapi/api-gateway.json \
  -o openapi/api-gateway.json
npm run gen:api
npm test

About

Minder management console — the operator web UI (React 18 + Vite + Tailwind). Talks to the Minder api-gateway.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages