Jump to content

Chuk Chat Architecture

From Chuk Wiki

Chuk Chat Architecture

[edit]

This page explains the system architecture at a level that is useful for curious users, product people, and technical readers.

Four-layer architecture

[edit]

Chuk Chat is organized in four main layers:

  1. Presentation layer: pages, chat UI, sidebars, settings screens.
  2. Service layer: business logic (chat handling, model config, sync, encryption helpers).
  3. Data layer: models and persisted chat data.
  4. Platform layer: platform-specific behavior for mobile, desktop, and web.

Why this architecture is used

[edit]
  • Easier maintenance and safer updates
  • Better testing and reliability
  • Clear separation between UI, logic, and storage

Platform structure

[edit]
  • Desktop (Windows, macOS, Linux): multi-panel layout with sidebar plus chat workspace.
  • Mobile (Android): single-panel chat with slide-out navigation and mobile input UX.
  • Web: desktop-style layout with browser-safe platform stubs where needed.

State and sync model

[edit]
  • UI state (input focus, scroll position) stays local to screens.
  • App state (chat content, selected model, preferences) is managed by services.
  • Persisted state (chat history, preferences) is stored and synced, with encrypted chat content.

Streaming architecture

[edit]

Chuk Chat supports both:

  • HTTP SSE streaming (POST /v1/ai/chat)
  • WebSocket streaming (/v1/ai/chat/ws)

This gives good browser compatibility plus stable mobile streaming behavior.

Security architecture highlights

[edit]
  • End-to-end encrypted chat storage
  • Certificate pinning on supported native platforms
  • Zero-data-retention provider filtering at the routing layer
[edit]