# jq-20/motrix-next architecture

> Architecture diagram of the GitHub repository jq-20/motrix-next, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jq-20/motrix-next
- Repository: https://github.com/jq-20/motrix-next

## Overview

Motrix Next is a cross-platform download manager with a Vue/Pinia interface and a Tauri/Rust backend supervising an Aria2 Next sidecar. The principal workflow accepts a URL, magnet, or torrent, prepares download options, submits a task to the engine, and presents task state and history. The graph also captures preferences, engine recovery, and browser-extension input. Some subsystem links are documented capabilities rather than sampled call sites; those are marked dashed or omitted where their wiring is not shown.

Main entry points: [`src/views/TaskView.vue`](https://github.com/jq-20/motrix-next/blob/main/src/views/TaskView.vue) (Task screens), [`src/composables/useAddTaskSubmit.ts`](https://github.com/jq-20/motrix-next/blob/main/src/composables/useAddTaskSubmit.ts) (Add task flow), [`src/stores/task/index.ts`](https://github.com/jq-20/motrix-next/blob/main/src/stores/task/index.ts) (Task management), [`src-tauri/src/engine/supervisor.rs`](https://github.com/jq-20/motrix-next/blob/main/src-tauri/src/engine/supervisor.rs) (Engine supervisor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Task interface"]
  node_task_ui["Task screens<br/>[TaskView.vue]"]
  node_add_task["Add task flow"]
  node_main_layout["Main layout<br/>[MainLayout.vue]"]
  node_task_details["Task details<br/>[TaskDetail.vue]"]
  node_preferences_view["Preference screens<br/>[PreferenceView.vue]"]
end

subgraph group_state["Application state"]
  node_task_store["Task management<br/>[index.ts]"]
  node_aria2_api["Aria2 API<br/>[aria2.ts]"]
  node_app_store["App input routing<br/>[app.ts]"]
  node_engine_store["Engine state<br/>[engine.ts]"]
  node_preferences[("Preferences<br/>[preference.ts]")]
  node_history_store[("Download history<br/>[history.ts]")]
end

subgraph group_backend["Native backend"]
  node_tauri_commands["Tauri commands<br/>[engine.rs]"]
  node_supervisor["Engine supervisor<br/>[supervisor.rs]"]
  node_aria2_client["Aria2 RPC client<br/>[client.rs]"]
  node_sqlite_history[("SQLite history<br/>[history.rs]")]
end

subgraph group_integrations["External integrations"]
  node_browser_extension(("Browser extension"))
  node_aria2_engine["Aria2 Next"]
end

node_user(("User"))

node_user -->|"manages downloads"| node_task_ui
node_task_ui -.->|"submits tasks"| node_add_task
node_add_task -->|"adds tasks"| node_task_store
node_add_task -->|"submits RPC"| node_aria2_api
node_task_store -->|"reads history"| node_history_store
node_task_store -->|"fetches task state"| node_aria2_api
node_task_ui -.->|"shows tasks"| node_task_store
node_task_ui -.->|"opens details"| node_task_details
node_browser_extension -->|"sends download input"| node_app_store
node_app_store -->|"routes submissions"| node_add_task
node_user -->|"configures downloads"| node_preferences_view
node_preferences_view -.->|"updates settings"| node_preferences
node_preferences -->|"refreshes runtime config"| node_tauri_commands
node_main_layout -.->|"displays engine state"| node_engine_store
node_engine_store -->|"invokes lifecycle commands"| node_tauri_commands
node_tauri_commands -->|"delegates lifecycle"| node_supervisor
node_supervisor -->|"probes RPC"| node_aria2_client
node_aria2_client -->|"sends JSON-RPC"| node_aria2_engine
node_history_store -.->|"persists records"| node_sqlite_history
node_supervisor -.->|"maintains history"| node_sqlite_history

click node_task_ui "https://github.com/jq-20/motrix-next/blob/main/src/views/TaskView.vue"
click node_add_task "https://github.com/jq-20/motrix-next/blob/main/src/composables/useAddTaskSubmit.ts"
click node_task_store "https://github.com/jq-20/motrix-next/blob/main/src/stores/task/index.ts"
click node_aria2_api "https://github.com/jq-20/motrix-next/blob/main/src/api/aria2.ts"
click node_app_store "https://github.com/jq-20/motrix-next/blob/main/src/stores/app.ts"
click node_engine_store "https://github.com/jq-20/motrix-next/blob/main/src/stores/engine.ts"
click node_preferences "https://github.com/jq-20/motrix-next/blob/main/src/stores/preference.ts"
click node_history_store "https://github.com/jq-20/motrix-next/blob/main/src/stores/history.ts"
click node_main_layout "https://github.com/jq-20/motrix-next/blob/main/src/layouts/MainLayout.vue"
click node_task_details "https://github.com/jq-20/motrix-next/blob/main/src/components/task/TaskDetail.vue"
click node_preferences_view "https://github.com/jq-20/motrix-next/blob/main/src/views/PreferenceView.vue"
click node_tauri_commands "https://github.com/jq-20/motrix-next/blob/main/src-tauri/src/commands/engine.rs"
click node_supervisor "https://github.com/jq-20/motrix-next/blob/main/src-tauri/src/engine/supervisor.rs"
click node_aria2_client "https://github.com/jq-20/motrix-next/blob/main/src-tauri/src/aria2/client.rs"
click node_sqlite_history "https://github.com/jq-20/motrix-next/blob/main/src-tauri/src/history.rs"

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_task_ui,node_add_task,node_main_layout,node_task_details,node_preferences_view,node_user toneBlue
class node_task_store,node_aria2_api,node_app_store,node_engine_store,node_preferences,node_history_store toneAmber
class node_tauri_commands,node_supervisor,node_aria2_client,node_sqlite_history toneMint
class node_browser_extension,node_aria2_engine toneRose
```

## Components

### Task interface

- [Task screens](https://github.com/jq-20/motrix-next/blob/main/src/views/TaskView.vue): `src/views/TaskView.vue`
- [Add task flow](https://github.com/jq-20/motrix-next/blob/main/src/composables/useAddTaskSubmit.ts): `src/composables/useAddTaskSubmit.ts`
- [Main layout](https://github.com/jq-20/motrix-next/blob/main/src/layouts/MainLayout.vue): `src/layouts/MainLayout.vue`
- [Task details](https://github.com/jq-20/motrix-next/blob/main/src/components/task/TaskDetail.vue): `src/components/task/TaskDetail.vue`
- [Preference screens](https://github.com/jq-20/motrix-next/blob/main/src/views/PreferenceView.vue): `src/views/PreferenceView.vue`

### Application state

- [Task management](https://github.com/jq-20/motrix-next/blob/main/src/stores/task/index.ts): `src/stores/task/index.ts`
- [Aria2 API](https://github.com/jq-20/motrix-next/blob/main/src/api/aria2.ts): `src/api/aria2.ts`
- [App input routing](https://github.com/jq-20/motrix-next/blob/main/src/stores/app.ts): `src/stores/app.ts`
- [Engine state](https://github.com/jq-20/motrix-next/blob/main/src/stores/engine.ts): `src/stores/engine.ts`
- [Preferences](https://github.com/jq-20/motrix-next/blob/main/src/stores/preference.ts): `src/stores/preference.ts`
- [Download history](https://github.com/jq-20/motrix-next/blob/main/src/stores/history.ts): `src/stores/history.ts`

### Native backend

- [Tauri commands](https://github.com/jq-20/motrix-next/blob/main/src-tauri/src/commands/engine.rs): `src-tauri/src/commands/engine.rs`
- [Engine supervisor](https://github.com/jq-20/motrix-next/blob/main/src-tauri/src/engine/supervisor.rs): `src-tauri/src/engine/supervisor.rs`
- [Aria2 RPC client](https://github.com/jq-20/motrix-next/blob/main/src-tauri/src/aria2/client.rs): `src-tauri/src/aria2/client.rs`
- [SQLite history](https://github.com/jq-20/motrix-next/blob/main/src-tauri/src/history.rs): `src-tauri/src/history.rs`

### External integrations

- **Browser extension**
- **Aria2 Next**

### Other components

- **User**

## Connections

- User → Task screens: manages downloads
- Task screens → Add task flow: submits tasks
- Add task flow → Task management: adds tasks (evidence: `src/composables/useAddTaskSubmit.ts`)
- Add task flow → Aria2 API: submits RPC (evidence: `src/composables/useAddTaskSubmit.ts`)
- Task management → Download history: reads history (evidence: `src/stores/task/index.ts`)
- Task management → Aria2 API: fetches task state (evidence: `src/stores/task/index.ts`)
- Task screens → Task management: shows tasks
- Task screens → Task details: opens details
- Browser extension → App input routing: sends download input (evidence: `src/stores/app.ts`)
- App input routing → Add task flow: routes submissions (evidence: `src/stores/app.ts`)
- User → Preference screens: configures downloads
- Preference screens → Preferences: updates settings
- Preferences → Tauri commands: refreshes runtime config (evidence: `src/stores/preference.ts`)
- Main layout → Engine state: displays engine state
- Engine state → Tauri commands: invokes lifecycle commands (evidence: `src/stores/engine.ts`)
- Tauri commands → Engine supervisor: delegates lifecycle (evidence: `src-tauri/src/commands/engine.rs`)
- Engine supervisor → Aria2 RPC client: probes RPC (evidence: `src-tauri/src/engine/supervisor.rs`)
- Aria2 RPC client → Aria2 Next: sends JSON-RPC (evidence: `src-tauri/src/aria2/client.rs`)
- Download history → SQLite history: persists records
- Engine supervisor → SQLite history: maintains history (evidence: `src-tauri/src/engine/supervisor.rs`)
