How janhq/jan works
1. This is a monorepo for Jan, a desktop-first AI application with a local runtime, optional cloud providers, and a documentation site.
The main product is the Tauri app; surrounding packages support model execution, plugins, docs, QA, and packaging for multiple platforms.
2. The primary user-facing app is web-app/, a React + Vite frontend.
Its architecture is organized around routes, providers, hooks, containers, services, and stores. The UI includes chat, threads, settings, assistants, projects, model management, MCP configuration, logs, and system monitoring.
3. The frontend is built around a service abstraction layer rather than direct backend calls.
web-app/src/services/* contains per-domain service interfaces and implementations such as app, core, dialogs, hardware, messages, models, providers, threads, updater, and window. This lets the same UI logic run against Tauri, default/mock, or mobile implementations.
4. Cross-cutting frontend state and behavior live in providers and hooks.
Providers manage data loading, extension state, theming, event handling, analytics, keyboard shortcuts, and the “service hub.” Hooks encapsulate the app’s operational workflows: model loading, thread management, tool approval, attachments, hardware, local API server, MCP servers, updates, and prompt composition.
5. The Rust backend in src-tauri/ is the control plane for the desktop app.
It exposes Tauri commands and internal modules for app setup, downloads, filesystem, MCP, server/proxying, system info, threads, updater, and extensions. This is where local desktop capabilities are implemented and where the frontend’s Tauri service layer ultimately routes actions.
6. Backend state is organized by domain, with persistence and session management centered on threads, models, and servers.
The Rust core modules include thread database logic, server proxying, app configuration, downloads, filesystem helpers, and update/session handling. This is the layer that coordinates app lifecycle, local storage, and operational state.
7. Model execution is split across runtime-specific subsystems and plugins.
The repo includes support for local llama.cpp, MLX, and Foundation Models, plus remote providers. The corresponding Tauri plugins manage process lifecycle, backend discovery, model loading/unloading, device enumeration, supported feature detection, and version handling.
8. There is a clear plugin boundary between Rust commands and JavaScript guest bindings.
Under src-tauri/plugins/*, each plugin has Rust command handlers, permission manifests, and a guest-js package for the frontend to call. This isolates privileged OS/model operations from the React layer while still exposing typed APIs.
9. The app’s AI features depend on two major data-processing subsystems: RAG and vector storage.
The RAG plugin parses documents, while the vector-db plugin creates collections, chunks text, stores embeddings/chunks, and supports attachment search. Together they back file attachments, retrieval-augmented prompts, and project/document workflows.
10. MCP is a first-class integration point for tool use and agentic workflows.
Both frontend and backend contain MCP-specific modules for server configuration, routing, telemetry, lockfiles, and tool approval. This is a distinct subsystem that sits alongside chat/model execution rather than being embedded in the chat UI itself.
11. The local OpenAI-compatible server is an important external boundary.
The backend exposes a localhost API server for other applications, and the frontend has dedicated settings and logs surfaces for it. This makes Jan both an end-user chat app and a local AI service host.
12. Persistence and filesystem layout are significant architectural concerns.
Threads, downloads, attachments, model files, and configuration data are all managed locally, with explicit filesystem helpers and data-folder settings in the UI. The architecture assumes local-first storage with privacy-sensitive boundaries.
13. autoqa/ is a separate functional subsystem for end-to-end validation.
It contains Python-based test orchestration, OS-specific install/download/setup scripts, screen recording, and reportportal integration. Its job is to exercise the shipped app across platforms rather than test a single library in isolation.
14. docs/ is an independent Next.js documentation and marketing site.
It publishes product docs, changelogs, API reference material, and tutorials, and includes an OpenAPI document. This is separate from the desktop runtime, but it mirrors product capabilities and release communication.
15. Packaging and release automation span multiple targets and platform-specific installers.
The repository includes Flatpak config, Tauri platform configs, MLX Swift server code, Windows/macOS/Linux workflows, and release automation scripts. These are not core runtime logic, but they define how the same product is built and distributed across environments.
16. If you draw the architecture, the main flows are: user action in web-app → service abstraction → Tauri command/plugin or local API server → model/runtime/process/filesystem/vector store → persisted local state and events back to the UI.
The key boundaries are frontend vs. Rust backend, command APIs vs. plugins, local models vs. remote providers, and product runtime vs. docs/QA/build infrastructure.
Main entry points: core Core domains · web-app App shell · workflows Packaging · services Services
Components 23
Frontend app
React/Vite desktop UI and its client-side architecture
- App shell · Primary Jan desktop frontend with routes, providers, hooks, and UI containers
web-app - Routes · Top-level app screens for chat, threads, settings, hub, logs, and system monitor
web-app/src/routes - Services · Domain service abstraction layer with Tauri/default/mobile implementations
web-app/src/services - Hooks · Operational hooks for model load, threads, MCP, attachments, updates, and prompts
web-app/src/hooks - Providers · Theme, events, analytics, keyboard shortcuts, extension state, and service hub wiring
web-app/src/providers - Stores · Local client stores for chat session and message queue behavior
web-app/src/stores
Desktop backend
Tauri control plane, core domains, and local server
- Core pkg · Shared browser-side core abstractions for extensions, engines, models, and types
core - Tauri backend · Desktop runtime commands, setup, lifecycle, and backend orchestration
src-tauri - Core domains · App, downloads, filesystem, MCP, server, system, threads, updater, and extension coordination
src-tauri/src/core - Local API · Local localhost API boundary and request proxying for external clients
src-tauri/src/core/server - Threads · Thread database, session state, and conversation lifecycle management
src-tauri/src/core/threads - MCP core · MCP server configuration, routing, telemetry, and lockfile handling
src-tauri/src/core/mcp - Updater · Update checks, session handling, and custom updater logic
src-tauri/src/core/updater
Plugins
Privileged Rust/JS plugin boundary for OS and model operations
- llama.cpp · Model loading, process lifecycle, backend discovery, and device/feature detection
src-tauri/plugins/tauri-plugin-llamacpp - MLX · Apple-native MLX model lifecycle and loaded-session management
src-tauri/plugins/tauri-plugin-mlx - Foundation Models · Swift-backed Foundation Models integration for Apple runtime support
src-tauri/plugins/tauri-plugin-foundation-models - RAG parser · Document parsing and ingestion for retrieval-augmented workflows
src-tauri/plugins/tauri-plugin-rag - Vector DB · Collections, chunking, attachment search, and persisted embedding storage
src-tauri/plugins/tauri-plugin-vector-db
Extensions
Reusable app extensions and model/runtime add-ons
- Extensions · Jan browser/browser-like extension layer and runtime-specific add-ons
extensions
Docs site
Independent Next.js documentation and marketing site
- Docs site · Documentation, changelog, tutorials, API reference, and product marketing
docs
QA
End-to-end validation and release exercise harness
- AutoQA · Python-based cross-platform install, launch, recording, and report automation
autoqa
Packaging
Build, installer, and platform release automation
- Packaging · Platform installers, Flatpak, MLX server, and CI release workflows
.github/workflows - MLX server · Standalone MLX server implementation used for Apple model execution support
mlx-server
Connections 27
- App shell → Routes: navigates · Routes define the user-facing screens and navigation structure
- App shell → Providers: wraps · Providers inject app-wide services, state, and runtime behavior
- App shell → Hooks: drives · Hooks coordinate workflows for chat, models, MCP, attachments, and updates
- App shell → Services: calls · UI logic reaches backend capabilities through service adapters
- Hooks → Services: uses · Operational hooks delegate effects and data access to services
- Providers → Services: configures · Service hub and global providers select the active runtime implementation
- Stores → Hooks: feeds · Stores support session and queue state used by app workflows
- Services → Tauri backend: bridges · Tauri implementations forward desktop actions into Rust commands
- Services → Core pkg: shares types · Frontend services and extensions consume shared core abstractions
- Tauri backend → Core domains: contains · Core Rust domains coordinate the desktop app lifecycle and features
- Core domains → Threads: persists · Thread storage and conversation state are centralized here
- Core domains → Local API: exposes · Local API server and proxying are managed by the server domain
- Core domains → MCP core: coordinates · MCP routing and approval flow are handled as a first-class backend domain
- Core domains → Updater: updates · Update session and version handling live in the updater domain
- Core domains → llama.cpp: invokes · Core runtime flows delegate model execution to the llama.cpp plugin
- Core domains → MLX: invokes · Apple MLX model execution is delegated to the MLX plugin
- Core domains → Foundation Models: invokes · Foundation Models support is separated behind its plugin boundary
- Core domains → RAG parser: ingests · Document parsing and retrieval preprocessing are plugin responsibilities
- Core domains → Vector DB: stores · Vector storage and attachment search are handled by the vector DB plugin
- RAG parser → Vector DB: feeds chunks · Parsed documents become stored chunks and embeddings for retrieval
- Extensions → Core pkg: builds on · Extensions use the shared browser/core model and engine abstractions
- Extensions → Tauri backend: extends · Extensions plug into desktop runtime capabilities and commands
- Docs site → Packaging: documents · Docs site communicates product capabilities, releases, and installation
- AutoQA → Packaging: validates · End-to-end QA exercises the packaged app across platforms
- Packaging → Tauri backend: builds · Tauri build and installer workflows package the desktop runtime
- Packaging → App shell: bundles · Frontend assets are assembled into the shipped desktop app
- Packaging → MLX server: ships · Platform packaging includes the standalone MLX service component