MeridianDocsSign in
Internals

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

PathWhat
/ and /docs/<page>These docs (app/(docs)), pre-rendered from docs/*.md
/setup, /login, /invite/<token>First-run setup, sign-in, accepting invitations
/appThe agent home: conversation, cards, quest rail
/app/roadmap, /app/tasks, /app/frameworks, /app/policies, /app/evidence, /app/training, /app/team, /app/activity, /app/settingsThe 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

FileRole
components/shell.tsxSidebar, top bar, ⌘K palette, keyboard shortcuts, CISO/Auditor toggle, role guards
components/agent/useAgentThread.tsSends messages and card answers, parses the event stream, keeps the thread state
components/agent/cards.tsxRenders every card kind and turns clicks into actions
components/agent/MessageView.tsx, Composer.tsx, QuestRail.tsxMessages and tool rows; the input with attachments; progress rail
components/auth.tsxBranded sign-in frame
components/docs.tsx, doc-markdown.tsxDocs chrome, search, copy buttons, .env builder, Markdown rendering
lib/api.ts · lib/types.tsTyped API client mirroring the API reference; 401 → sign-in
lib/sse.tsEvent-stream parser over fetch
lib/brand.tsWhite-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.