# atlessc/qwen-drive architecture

> Architecture diagram of the GitHub repository atlessc/qwen-drive, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/atlessc/qwen-drive
- Repository: https://github.com/atlessc/qwen-drive

## Overview

Qwen Drive is a desktop-primary, local-first personal computing environment. A user works through the Next.js PWA to chat or use focus areas such as Projects, Search, Journal, and Knowledge; requests cross the same-origin API boundary into a separate Fastify core. Deterministic server code owns exact operations, while inference runtimes provide model reasoning. The graph also preserves documented local-model, optional web-search, Mac-context, and bootstrap capabilities. Evidence is limited to the README, tree, and sampled excerpts, so uncertain internal route-to-service wiring is omitted.

Main entry points: [`server/index.ts`](https://github.com/atlessc/qwen-drive/blob/main/server/index.ts) (Fastify core), [`src/App.tsx`](https://github.com/atlessc/qwen-drive/blob/main/src/App.tsx) (Next.js PWA), [`server/inference/service.ts`](https://github.com/atlessc/qwen-drive/blob/main/server/inference/service.ts) (Inference service), [`server/db/index.ts`](https://github.com/atlessc/qwen-drive/blob/main/server/db/index.ts) (SQLite data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["PWA experience"]
  node_pwa["Next.js PWA<br/>[App.tsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.tsx]"]
end

subgraph group_core["Core services"]
  node_chat["Chat and orchestration<br/>[chats-api.ts]"]
  node_inference["Inference service<br/>[service.ts]"]
  node_fastify["Fastify core<br/>[index.ts]"]
end

subgraph group_focus["Focus areas"]
  node_projects["Projects and sessions<br/>[projects.ts]"]
  node_coding["Coding Agent<br/>[service.ts]"]
  node_search["Local search<br/>[service.ts]"]
  node_journal["Journal<br/>[api.ts]"]
  node_health["Health<br/>[api.ts]"]
  node_knowledge["Knowledge<br/>[service.ts]"]
  node_people["People<br/>[people.ts]"]
  node_personal["Personal Context<br/>[service.ts]"]
  node_tasks["Tasks<br/>[tasks.ts]"]
  node_usage["Usage<br/>[Usage.tsx]"]
end

subgraph group_platform["Local platform"]
  node_database[("SQLite data<br/>[index.ts]")]
  node_modelruntimes["Local model runtimes<br/>[ollama.ts]"]
  node_websearch["Brave Search"]
  node_mac["macOS context<br/>[service.ts]"]
  node_bootstrap["Bootstrap service<br/>[index.ts]"]
end

node_user(("User"))

node_user -->|"uses"| node_pwa
node_pwa -->|"API requests"| node_fastify
node_fastify -->|"dispatches"| node_inference
node_inference -->|"invokes"| node_modelruntimes
node_fastify -->|"serves chat"| node_chat
node_fastify -->|"serves projects"| node_projects
node_fastify -->|"serves agent"| node_coding
node_fastify -->|"serves search"| node_search
node_fastify -->|"serves journal"| node_journal
node_fastify -->|"serves health"| node_health
node_fastify -->|"serves knowledge"| node_knowledge
node_fastify -->|"serves context"| node_personal
node_chat -->|"requests reasoning"| node_inference
node_pwa -->|"presents"| node_dashboard
node_pwa -->|"requests projects"| node_projects
node_pwa -->|"via core"| node_database
node_fastify -->|"uses"| node_database
node_fastify -.->|"searches online"| node_websearch
node_fastify -.->|"reads approved context"| node_mac
node_user -->|"plans or starts"| node_bootstrap
node_tasks -->|"stores tasks"| node_database

click node_pwa "https://github.com/atlessc/qwen-drive/blob/main/src/App.tsx"
click node_chat "https://github.com/atlessc/qwen-drive/blob/main/server/chats-api.ts"
click node_inference "https://github.com/atlessc/qwen-drive/blob/main/server/inference/service.ts"
click node_fastify "https://github.com/atlessc/qwen-drive/blob/main/server/index.ts"
click node_projects "https://github.com/atlessc/qwen-drive/blob/main/server/projects.ts"
click node_coding "https://github.com/atlessc/qwen-drive/blob/main/server/coding-agent/service.ts"
click node_search "https://github.com/atlessc/qwen-drive/blob/main/server/search/service.ts"
click node_journal "https://github.com/atlessc/qwen-drive/blob/main/server/journal/api.ts"
click node_health "https://github.com/atlessc/qwen-drive/blob/main/server/health/api.ts"
click node_knowledge "https://github.com/atlessc/qwen-drive/blob/main/server/knowledge/service.ts"
click node_people "https://github.com/atlessc/qwen-drive/blob/main/server/people.ts"
click node_dashboard "https://github.com/atlessc/qwen-drive/blob/main/components/dashboard/Dashboard.tsx"
click node_personal "https://github.com/atlessc/qwen-drive/blob/main/server/personal-context/service.ts"
click node_tasks "https://github.com/atlessc/qwen-drive/blob/main/server/tasks.ts"
click node_usage "https://github.com/atlessc/qwen-drive/blob/main/components/usage/Usage.tsx"
click node_database "https://github.com/atlessc/qwen-drive/blob/main/server/db/index.ts"
click node_modelruntimes "https://github.com/atlessc/qwen-drive/blob/main/server/inference/runtimes/ollama.ts"
click node_mac "https://github.com/atlessc/qwen-drive/blob/main/server/mac-context/service.ts"
click node_bootstrap "https://github.com/atlessc/qwen-drive/blob/main/server/bootstrap/index.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_pwa,node_dashboard,node_user toneBlue
class node_chat,node_inference,node_fastify toneAmber
class node_projects,node_coding,node_search,node_journal,node_health,node_knowledge,node_people,node_personal,node_tasks,node_usage toneMint
class node_database,node_modelruntimes,node_websearch,node_mac,node_bootstrap toneRose
```

## Components

### PWA experience

- [Next.js PWA](https://github.com/atlessc/qwen-drive/blob/main/src/App.tsx): `src/App.tsx`
- [Dashboard](https://github.com/atlessc/qwen-drive/blob/main/components/dashboard/Dashboard.tsx): `components/dashboard/Dashboard.tsx`

### Core services

- [Chat and orchestration](https://github.com/atlessc/qwen-drive/blob/main/server/chats-api.ts): `server/chats-api.ts`
- [Inference service](https://github.com/atlessc/qwen-drive/blob/main/server/inference/service.ts): `server/inference/service.ts`
- [Fastify core](https://github.com/atlessc/qwen-drive/blob/main/server/index.ts): `server/index.ts`

### Focus areas

- [Projects and sessions](https://github.com/atlessc/qwen-drive/blob/main/server/projects.ts): `server/projects.ts`
- [Coding Agent](https://github.com/atlessc/qwen-drive/blob/main/server/coding-agent/service.ts): `server/coding-agent/service.ts`
- [Local search](https://github.com/atlessc/qwen-drive/blob/main/server/search/service.ts): `server/search/service.ts`
- [Journal](https://github.com/atlessc/qwen-drive/blob/main/server/journal/api.ts): `server/journal/api.ts`
- [Health](https://github.com/atlessc/qwen-drive/blob/main/server/health/api.ts): `server/health/api.ts`
- [Knowledge](https://github.com/atlessc/qwen-drive/blob/main/server/knowledge/service.ts): `server/knowledge/service.ts`
- [People](https://github.com/atlessc/qwen-drive/blob/main/server/people.ts): `server/people.ts`
- [Personal Context](https://github.com/atlessc/qwen-drive/blob/main/server/personal-context/service.ts): `server/personal-context/service.ts`
- [Tasks](https://github.com/atlessc/qwen-drive/blob/main/server/tasks.ts): `server/tasks.ts`
- [Usage](https://github.com/atlessc/qwen-drive/blob/main/components/usage/Usage.tsx): `components/usage/Usage.tsx`

### Local platform

- [SQLite data](https://github.com/atlessc/qwen-drive/blob/main/server/db/index.ts): `server/db/index.ts`
- [Local model runtimes](https://github.com/atlessc/qwen-drive/blob/main/server/inference/runtimes/ollama.ts): `server/inference/runtimes/ollama.ts`
- **Brave Search**
- [macOS context](https://github.com/atlessc/qwen-drive/blob/main/server/mac-context/service.ts): `server/mac-context/service.ts`
- [Bootstrap service](https://github.com/atlessc/qwen-drive/blob/main/server/bootstrap/index.ts): `server/bootstrap/index.ts`

### Other components

- **User**

## Connections

- User → Next.js PWA: uses
- Next.js PWA → Fastify core: API requests
- Fastify core → Inference service: dispatches
- Inference service → Local model runtimes: invokes
- Fastify core → Chat and orchestration: serves chat
- Fastify core → Projects and sessions: serves projects
- Fastify core → Coding Agent: serves agent
- Fastify core → Local search: serves search
- Fastify core → Journal: serves journal
- Fastify core → Health: serves health
- Fastify core → Knowledge: serves knowledge
- Fastify core → Personal Context: serves context
- Chat and orchestration → Inference service: requests reasoning
- Next.js PWA → Dashboard: presents
- Next.js PWA → Projects and sessions: requests projects
- Next.js PWA → SQLite data: via core
- Fastify core → SQLite data: uses
- Fastify core → Brave Search: searches online
- Fastify core → macOS context: reads approved context
- User → Bootstrap service: plans or starts
- Tasks → SQLite data: stores tasks
