Frontend
The Next.js app — routes, the agent UI, theming, the API client and how these docs are built.
Next.js 15 (App Router) with React 19 and TypeScript. It has no CSS framework: plain CSS on design tokens. Dependencies are kept to react-markdown, remark-gfm, lucide-react and clsx.
Routes
| Path | What |
|---|---|
/ and /docs/<page> | These docs (app/(docs)), pre-rendered from docs/*.md |
/setup, /login, /invite/<token> | First-run setup, sign-in, accepting invitations |
/app | The agent home: conversation, cards, quest rail |
/app/roadmap, /app/tasks, /app/frameworks, /app/policies, /app/evidence, /app/training, /app/team, /app/activity, /app/settings | The CISO view |
/app/audit/… | The auditor view: room, requirements, requests, findings |
/api/* | A streaming pass-through proxy to the backend |
The proxy (app/api/[...path]/route.ts) keeps cookies same-origin and streams responses unbuffered, which the agent's event stream needs. It reads MERIDIAN_API_URL at run time, so one image works against any backend.
Key components
| File | Role |
|---|---|
components/shell.tsx | Sidebar, top bar, ⌘K palette, keyboard shortcuts, CISO/Auditor toggle, role guards |
components/agent/useAgentThread.ts | Sends messages and card answers, parses the event stream, keeps the thread state |
components/agent/cards.tsx | Renders every card kind and turns clicks into actions |
components/agent/MessageView.tsx, Composer.tsx, QuestRail.tsx | Messages and tool rows; the input with attachments; progress rail |
components/auth.tsx | Branded sign-in frame |
components/docs.tsx, doc-markdown.tsx | Docs chrome, search, copy buttons, .env builder, Markdown rendering |
lib/api.ts · lib/types.ts | Typed API client mirroring the API reference; 401 → sign-in |
lib/sse.ts | Event-stream parser over fetch |
lib/brand.ts | White-labelling: applies the accent and derives ink, soft and dark-mode variants; pre-paint boot script |
Theming
app/styles/tokens.css defines every colour, shadow and font as CSS variables, for light and dark. Components only use tokens. White-labelling sets --brand-* overrides at run time, so one accent restyles the whole product.
These docs
lib/docs.ts reads docs/*.md at build time: front matter gives the title, description, group and order. Headings get GitHub-compatible anchors, so links work on GitHub and here. Links to other-page.md#section are rewritten to /docs/other-page#section, and images under docs/assets/ are served by a route. A fenced block tagged env-builder renders the interactive .env builder.
