Docs / Clients9 min readEdit on GitHub

The web client#

The web client in client/ is a Next.js 16 App Router application on React 19 and Tailwind 4. It renders the landing page and the public docs, the dashboard of a user's repositories, five views of each repository (overview, explorer, glossary, graph and chat, plus settings), and the account settings. This page explains its routes, how it fetches data, how authentication gates pages, its component layout, and the conventions that matter when changing it.

Terms used on this page#

  • Server component: a React component rendered on the Next.js server. It can read cookies and call the backend before any HTML is sent.
  • Client component: a file marked "use client", rendered in the browser too, which can hold state and handle events.
  • Server action: a function in a "use server" file that a component calls like a local function; Next.js runs it on the server.
  • Proxy: Next.js 16's name for what earlier versions called middleware: code that runs before a route renders. Illume's is src/proxy.ts.

Next.js 16 changed APIs and file conventions. client/AGENTS.md tells contributors to read the bundled guides in node_modules/next/dist/docs/ before writing client code, rather than relying on remembered Next.js behaviour.

Stack#

PackageVersionUsed for
next16.2routing, server components, server actions
react19.2
tailwindcss4styling, configured in app/globals.css
react-force-graph-3d, three1.29, 0.183the 3D graph page
react-markdown, remark-gfm, rehype-*the docs site and chat answers
mermaid12.3diagrams in the docs
geistGeist Sans for text, Geist Pixel Square for labels
vitest, @playwright/test5, 1.63unit and end-to-end tests

Path alias @/* maps to src/*. The only environment variable is NEXT_PUBLIC_BACKEND_URL; see environment variables.

Routes#

RouteFileAccessWhat it shows
/app/page.tsxpublicthe landing page: hero constellation, features, walkthrough, FAQ
/loginapp/login/page.tsxpublicGitHub sign-in beside a live graph
/contactapp/contact/page.tsxpublicthe contact form
/mobileapp/mobile/page.tsxpublicdownload page for the Android app
/privacyapp/privacy/page.tsxpublicthe privacy policy, including how to delete an account
/docs, /docs/...app/docs/publicthese documents; see the docs site
/dashboardapp/dashboard/page.tsxsigned inthe repository collection, the free-tier banner, adding a repository; when empty, a card opening the sample repository
/settingsapp/settings/page.tsxsigned inaccount, AI credentials, free-tier allowance, agent settings, MCP tokens, account deletion
/repo/[id]app/repo/[id]/page.tsxsigned inwhile ingesting, the live pipeline board; when ready, the overview: brief, stats, where to start, risky files, owners
/repo/[id]/explorerapp/repo/[id]/explorer/page.tsxsigned inthe file tree with reading order, and a selected file's risk, owners, symbols, history and neighbourhood
/repo/[id]/glossaryapp/repo/[id]/glossary/page.tsxsigned inthe glossary, paginated, with an A to Z rail and search
/repo/[id]/graphapp/repo/[id]/graph/page.tsxsigned inthe 3D dependency graph; see rendering
/repo/[id]/chatapp/repo/[id]/chat/page.tsxsigned inconversations, presets, streamed agent answers, the live graph
/repo/[id]/settingsapp/repo/[id]/settings/page.tsxsigned inauto-update, the read-only share link, the analysed version, export, re-ingest and delete
/share/[token]app/share/[token]/page.tsxpublica shared repository, read-only: the overview, plus chat (switched off), graph, explorer and glossary; no settings
/dev/pipelineapp/dev/pipeline/page.tsxpublica harness that replays recorded ingest frames through the real pipeline board

[id] is the repository's repo_number, not its UUID. Pages that call UUID-keyed endpoints first load the repository to get its id.

Every route has a loading.tsx skeleton, so navigation streams immediately. app/error.tsx and app/repo/[id]/error.tsx are error boundaries, and app/not-found.tsx is the 404 page; the last two use StatusScreen. The root layout (app/layout.tsx) draws Starfield, a fixed canvas of twinkling pixel stars, behind every page at -z-20; the favicon and touch icon are app/icon.svg, app/favicon.ico and app/apple-icon.png. There is no /signup route: sign-in is through GitHub OAuth, and SignupForm.tsx is no longer rendered anywhere.

The repository layout#

app/repo/[id]/layout.tsx is a server component shared by every repository route. It loads the repository and its file-level graph once, wraps the children in RepoGraphProvider (RepoGraphContext.tsx) so client pages can read the graph without fetching it again, and renders RepoNavbar and BackgroundGraph. On the graph and settings routes the background is veiled; on the chat route it gives way to the chat's own live graph.

Shared views#

app/share/[token]/layout.tsx is the shell of the public, read-only view. It resolves the link through api/share.ts, which sends no cookie, and renders ShareNavbar, a "Read-only shared view" banner with a sign-up link, and the same ambient graph. The graph and chat fill the screen below the header, so the banner steps aside on them (isFullHeightSharePath) rather than push their bottom edge off screen: the graph shows the same notice as ReadOnlyPanel, passed to GraphClient through its notice prop and drawn above the search panel, and the chat page draws the same strip inside its fixed frame. Its metadata sets robots: { index: false } and referrer: "no-referrer". A wrong or switched-off link is notFound(), caught by app/share/not-found.tsx; a repository still being analysed (summary status, or a 409) and a rate limit (429) get their own ShareNotice.

The pages reuse the owner's presentational components rather than copying them: RepoOverview, GlossaryView, GraphClient and ExplorerClient take a basePath (where internal links point) and a readOnly flag (no chat links), and the explorer takes source="share" so its per-file requests go to the public routes without credentials (a string rather than loader functions, because a server page cannot pass functions to a client component). The owner's pages pass /repo/<number> and keep working unchanged.

The chat is listed in the shared navigation but switched off, since an answer runs a model on the owner's account. /share/[token]/chat renders SharedChat, the chat's empty state with the composer, the model picker and the starter questions all disabled under the read-only strip; it sends no request. Every shared route has a loading.tsx that re-exports the owner's skeleton for the same page, and app/share/loading.tsx, one segment up, covers the layout's own loading with a skeleton header, navigation and overview.

The sample repository#

lib/sample.ts holds SAMPLE_SHARE_URL, the share link of a sample repository the operator has analysed and shared. The landing page's "Try it on a real repo" button and "Sample repository" footer link and the empty dashboard's "Explore a sample repository" card all open it, so a visitor can see a finished analysis before signing up or adding a repository. It is a constant, not an environment variable: set it to the real /share/<token> path once, and never regenerate or switch off that link, or they all lead to the "link not available" page. Re-analysing the sample keeps its link.

Authentication#

sequenceDiagram
  participant B as Browser
  participant P as proxy.ts
  participant N as Next server
  participant A as API
  B->>P: GET /repo/12
  alt no access_token cookie
    P-->>B: redirect to /login
  else cookie present
    P->>N: continue
    N->>A: fetch with the forwarded cookie
    A-->>N: data, or 401
    N-->>B: HTML
  end
  • The session is the backend's httponly access_token cookie. The client never stores a token in localStorage.
  • proxy.ts redirects a request without the cookie away from any path starting with /dashboard, /repo or /settings, and a request with the cookie away from exactly / or /login to the dashboard. It only checks that the cookie exists; the backend validates it. Its matcher skips api, _next/static, _next/image and .png paths.
  • Because / redirects a signed-in user, the landing page is visible only when signed out.
  • Signing in sends the browser to ${NEXT_PUBLIC_BACKEND_URL}/api/v1/auth/github; the backend sets the cookie on its callback. See authentication.

Data fetching#

Fetching is hybrid, deliberately:

WhereHowCache
server components, via src/api/*fetch with cookie: (await headers()).get("cookie") forwardedno-store
server actions in src/actions/*fetch with Cookie: cookieStore.toString()no-store
client components and hooksfetch(..., { credentials: "include" }) straight to the backend originbrowser

Every file under src/api/ and src/actions/ is "use server". The browser reaches the backend at the absolute NEXT_PUBLIC_BACKEND_URL; there are no rewrites, so the backend's CORS configuration must allow the frontend origin with credentials.

ModuleFetches
api/auth.tsthe current user
api/repository.tsthe repository list and one repository
api/graph.tsGET /graph?level=
api/guide.tsthe onboarding guide and stats
api/glossary.tsglossary pages and search
api/ownership.tsownership and knowledge silos
api/fileDetail.tsone file's symbols and history
api/chat.tschat history
api/github.tsthe GitHub proxy (branches, commits, repository search)

Server actions cover writes: deleting, re-ingesting and syncing a repository, auto-update settings, AI credentials and agent settings, MCP tokens, and the .illume export. Actions that end in redirect() are called through utils/redirectingAction.ts, which tells a real redirect apart from a failure.

Client components that talk to the backend directly: the chat (useAgentStream, useConversation, useConversationList), the ingest WebSocket (useIngestStream), the repository picker and timeline (RepoPickerModal, useGitGraph), repository settings, repository thumbnails, the GitHub star count and the status line (SystemStatus, which reads the backend health probe).

Polling#

  • DashboardRefresh calls router.refresh() periodically while any repository on the dashboard is ingesting.
  • RepoStatusPoller does the same on a repository page while a background sync is running or the ingest has not finished.
  • IngestFlow refreshes once when an ingest completes or fails; see the WebSocket page.

The chat client#

The chat is the most involved part of the client and is documented with the backend it talks to:

  • hooks/useAgentStream.ts posts to the streaming endpoint and parses the response body with the small SSE parser in lib/agent/sse.ts.
  • lib/agent/reducer.ts is a pure state machine that folds events into a turn: steps, lanes, highlights for the live graph, the answer text and its citations.
  • lib/agent/presets.ts lists the presets, which are disabled for the user's tier and model, the advanced overrides, and what is remembered between visits.
  • ChatPage, TurnView, ActivityBlock, AnswerView, CitationCard, PresetPicker, AdvancedDrawer, ConversationSidebar and StaleNotice render it.

See chat and citations and the agent.

Component layout#

client/src/
  app/            routes, layouts, loading and error files, globals.css
  api/            "use server" reads for server components
  actions/        "use server" writes
  components/     page-level components
    chat/         the chat page and its parts
    docs/         the docs site renderer
    ingest/       the pipeline board and raw log
    landing/      landing page sections and demos
    ui/           shared building blocks: Button, Modal, Select, Switch, cards
  hooks/          client state and fetching
  lib/            pure logic: agent state, pixel graph scenes, docs loading, GitHub helpers
  utils/          small pure helpers
  types/          shared TypeScript types for API payloads
  proxy.ts        the auth gate

Pure logic lives in lib/ and utils/ with no React imports, so it can be unit-tested in Vitest's Node environment. utils/ingestFlow.ts and lib/agent/reducer.ts are the two examples that matter most.

Conventions#

  • WebGL only in the browser. Any component that uses Three.js is imported with next/dynamic and { ssr: false }, as GraphClient does.
  • Dynamic imports for heavy client-only code. The chat's LiveGraph is loaded only on wide screens; Mermaid is imported after mount.
  • Prettier formatting, two-space indent, format on save (configured in .zed/settings.json).
  • ESLint over src/ is report-only in CI. npm run lint currently reports about 50 problems, 30 of them no-explicit-any. Lint over tests/, e2e/, e2e-prod/ and vitest.config.ts blocks.
  • Type-check with typegen first: npx next typegen then npx tsc --noEmit (also npm run typecheck), because next-env.d.ts is gitignored.
  • One dark theme. The interface ships one palette; colours are CSS variables in globals.css.
  • The Graph type is loose. types/graph.ts declares language, fan_in and fan_out on every node, but symbol-level nodes from the API do not carry them.

Design trade-offs and limits#

  • Hybrid fetching. Server components give fast first paint with the session cookie; client fetches keep interactive pages live. The price is two ways of calling the same backend, and CORS configuration that must be right.
  • Existence-only gating. The proxy cannot tell an expired cookie from a valid one, so an expired session reaches a page and fails there with a 401 from the backend.
  • No client cache. Everything is no-store, so every navigation refetches.
  • Uncommitted redesign. Documentation and main disagree until the redesign is committed.