Architecture

Orbit is a small, modular React app. No framework magic — a thin IRC layer feeds a zustand store, which renders components.

Project tree

src/
  main.tsx  App.tsx  index.css
  core/
    config.ts  networks.ts  handoff.ts  i18n/
    irc/     client · transport · registration · ircv3 · server-info · parser · modes · casemap · numerics · caps · ctcp
    store.ts  store/   handler (+ sub-handlers) · commands · upload · account · text · context · persistence
  lib/       format.tsx · media.tsx · link-preview.tsx · editor.ts · escape.ts   ← presentation + editor helpers
  platform/  notify.ts · push.ts · avatars.ts                                    ← browser / OS integration
  ui/        appUpdate.ts · viewport.ts
  themes/    the light / dark / orbit / yomirc theme system
  modules/   api.ts · registry.ts · bus.ts · loader.ts · sandbox/               ← the plugin system
  components/
    Chat.tsx            ← thin assembler
    chat/      MessageList · MsgRow · SystemLine · Composer (+ composer/) · Sidebar · Topbar
    settings/  SettingsModal · rows · sections/
    modals/    Modals · Modal · one file per dialog
    profile/   ProfileModal
    Avatar · ConnectScreen · Turnstile · PluginBoundary

Layers

  • core/irc/ — the protocol. client.ts is a thin orchestrator over transport.ts (WebSocket, reconnect, send queues), registration.ts (the CAP/SASL handshake), ircv3.ts (capability negotiation + the cap-gated extended commands), and server-info.ts (parsed ISUPPORT + limits). parser.ts, modes.ts, casemap.ts, numerics.ts are pure primitives; caps.ts lists the requested capabilities.
  • core/store.ts — the zustand store. Incoming IRC events run through store/handler.ts, a dispatcher that delegates to focused sub-handlers (whois, membership, messaging, mode, numerics, …); outgoing user actions live in commands / upload / account. Pure helpers sit in store/text.ts and store/context.ts.
  • lib/format.tsx renders mIRC formatting → React; media.tsx + link-preview.tsx are the inline embeds; editor.ts is the rich-composer serialization.
  • components/ — the UI, grouped by area (chat/, settings/sections/, modals/, profile/), each large view split into small files behind a thin assembler (Chat.tsx).
  • modules/ — the runtime plugin system: api.ts is the Orbit API, sandbox/ the isolated, capability-gated tier.

Quality

Vitest unit tests cover the IRC layer, the store sub-handlers, and the pure helpers (200+ tests); lint, tests, and a Playwright end-to-end run against a live Ergo server all gate the self-hosted push-to-deploy.