# spacedriveapp/spacedrive architecture

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

- Interactive diagram: https://gitdiagram.com/spacedriveapp/spacedrive
- Repository: https://github.com/spacedriveapp/spacedrive

## Overview

Spacedrive is personal data infrastructure: it catalogs files across user-controlled sources and exposes common operations through multiple clients. The main workflow is a person using a client to query or change a library; registered operations run through the daemon against indexed sources, with jobs tracking long-running work. The README also describes peer access, mounts, history, protection, and extensions as product capabilities. Some subsystem links below reflect README statements rather than sampled implementation; those use the README as evidence.

Main entry points: [`core/src/ops/mod.rs`](https://github.com/spacedriveapp/spacedrive/blob/main/core/src/ops/mod.rs) (Registered operations), [`core/src/infra/daemon/dispatch.rs`](https://github.com/spacedriveapp/spacedrive/blob/main/core/src/infra/daemon/dispatch.rs) (Daemon API), [`core/src/library/manager.rs`](https://github.com/spacedriveapp/spacedrive/blob/main/core/src/library/manager.rs) (Library manager), [`core/src/infra/db/entities/space.rs`](https://github.com/spacedriveapp/spacedrive/blob/main/core/src/infra/db/entities/space.rs) (Library database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["User clients"]
  node_cli["CLI<br/>[main.rs]"]
  node_desktop["Desktop app<br/>[server.rs]"]
  node_web["Web interface<br/>[main.tsx]"]
  node_mobile["Mobile app"]
  node_native["Photos app<br/>[main.rs]"]
  node_sdk["TypeScript SDK<br/>[client.ts]"]
end

subgraph group_runtime["Operations runtime"]
  node_daemon["Daemon API<br/>[dispatch.rs]"]
  node_operations["Registered operations<br/>[mod.rs]"]
  node_jobs["Durable jobs<br/>[manager.rs]"]
end

subgraph group_catalog["Library and catalog"]
  node_library["Library manager<br/>[manager.rs]"]
  node_domain["Resource model<br/>[resource.rs]"]
  node_database[("Library database<br/>[space.rs]")]
  node_indexing["Live indexing<br/>[job.rs]"]
  node_search["Search pipeline<br/>[pipeline.rs]"]
end

subgraph group_access["Remote access"]
  node_sync["Peer synchronization<br/>[peer_log.rs]"]
  node_mounts["Source mounts<br/>[mod.rs]"]
end

subgraph group_capabilities["Product capabilities"]
  node_fileops["File operations<br/>[planner.rs]"]
  node_volumes["Volumes and sources<br/>[manager.rs]"]
  node_history["History and snapshots<br/>[mod.rs]"]
  node_extensions["Extensions<br/>[manager.rs]"]
  node_adapters["External adapters<br/>[engine.rs]"]
end

node_person(("Person or software"))

node_person -->|"uses"| node_cli
node_person -->|"uses"| node_desktop
node_person -->|"uses"| node_web
node_person -->|"uses"| node_mobile
node_person -->|"uses"| node_native
node_person -->|"invokes"| node_sdk
node_cli -->|"sends requests"| node_daemon
node_desktop -->|"connects"| node_daemon
node_web -->|"calls operations"| node_daemon
node_mobile -->|"calls operations"| node_daemon
node_native -->|"reads snapshots"| node_daemon
node_sdk -->|"calls operations"| node_daemon
node_daemon -->|"dispatches"| node_operations
node_operations -->|"uses library"| node_library
node_operations -->|"starts jobs"| node_jobs
node_library -->|"persists records"| node_database
node_library -->|"manages resources"| node_domain
node_operations -->|"runs indexing"| node_indexing
node_operations -->|"runs search"| node_search
node_operations -->|"validates and executes"| node_fileops
node_indexing -->|"updates catalog"| node_database
node_search -->|"queries catalog"| node_database
node_volumes -->|"tracks changes"| node_library
node_library -->|"synchronizes models"| node_sync
node_operations -->|"exposes history"| node_history
node_operations -->|"serves mounts"| node_mounts
node_sync -->|"streams source bytes"| node_mounts
node_operations -->|"runs extensions"| node_extensions
node_volumes -.->|"uses external sources"| node_adapters

click node_cli "https://github.com/spacedriveapp/spacedrive/blob/main/apps/cli/src/main.rs"
click node_desktop "https://github.com/spacedriveapp/spacedrive/blob/main/apps/tauri/src-tauri/src/server.rs"
click node_web "https://github.com/spacedriveapp/spacedrive/blob/main/apps/web/src/main.tsx"
click node_mobile "https://github.com/spacedriveapp/spacedrive/blob/main/apps/mobile/src/client/SpacedriveClient.ts"
click node_native "https://github.com/spacedriveapp/spacedrive/blob/main/apps/native/src/main.rs"
click node_sdk "https://github.com/spacedriveapp/spacedrive/blob/main/packages/ts-client/src/client.ts"
click node_daemon "https://github.com/spacedriveapp/spacedrive/blob/main/core/src/infra/daemon/dispatch.rs"
click node_operations "https://github.com/spacedriveapp/spacedrive/blob/main/core/src/ops/mod.rs"
click node_jobs "https://github.com/spacedriveapp/spacedrive/blob/main/core/src/infra/job/manager.rs"
click node_library "https://github.com/spacedriveapp/spacedrive/blob/main/core/src/library/manager.rs"
click node_domain "https://github.com/spacedriveapp/spacedrive/blob/main/core/src/domain/resource.rs"
click node_database "https://github.com/spacedriveapp/spacedrive/blob/main/core/src/infra/db/entities/space.rs"
click node_indexing "https://github.com/spacedriveapp/spacedrive/blob/main/core/src/ops/indexing/job.rs"
click node_search "https://github.com/spacedriveapp/spacedrive/blob/main/core/src/ops/search/pipeline.rs"
click node_fileops "https://github.com/spacedriveapp/spacedrive/blob/main/core/src/ops/files/planner.rs"
click node_volumes "https://github.com/spacedriveapp/spacedrive/blob/main/core/src/volume/manager.rs"
click node_history "https://github.com/spacedriveapp/spacedrive/blob/main/core/src/infra/sync/event_log/mod.rs"
click node_sync "https://github.com/spacedriveapp/spacedrive/blob/main/core/src/infra/sync/peer_log.rs"
click node_mounts "https://github.com/spacedriveapp/spacedrive/blob/main/core/src/ops/mounts/mod.rs"
click node_extensions "https://github.com/spacedriveapp/spacedrive/blob/main/core/src/infra/extension/manager.rs"
click node_adapters "https://github.com/spacedriveapp/spacedrive/blob/main/crates/archive/src/engine.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_cli,node_desktop,node_web,node_mobile,node_native,node_sdk toneBlue
class node_daemon,node_operations,node_jobs toneAmber
class node_library,node_domain,node_database,node_indexing,node_search toneMint
class node_sync,node_mounts toneRose
class node_fileops,node_volumes,node_history,node_extensions,node_adapters,node_person toneIndigo
```

## Components

### User clients

- [CLI](https://github.com/spacedriveapp/spacedrive/blob/main/apps/cli/src/main.rs): `apps/cli/src/main.rs`
- [Desktop app](https://github.com/spacedriveapp/spacedrive/blob/main/apps/tauri/src-tauri/src/server.rs): `apps/tauri/src-tauri/src/server.rs`
- [Web interface](https://github.com/spacedriveapp/spacedrive/blob/main/apps/web/src/main.tsx): `apps/web/src/main.tsx`
- [Mobile app](https://github.com/spacedriveapp/spacedrive/blob/main/apps/mobile/src/client/SpacedriveClient.ts): `apps/mobile/src/client/SpacedriveClient.ts`
- [Photos app](https://github.com/spacedriveapp/spacedrive/blob/main/apps/native/src/main.rs): `apps/native/src/main.rs`
- [TypeScript SDK](https://github.com/spacedriveapp/spacedrive/blob/main/packages/ts-client/src/client.ts): `packages/ts-client/src/client.ts`

### Operations runtime

- [Daemon API](https://github.com/spacedriveapp/spacedrive/blob/main/core/src/infra/daemon/dispatch.rs): `core/src/infra/daemon/dispatch.rs`
- [Registered operations](https://github.com/spacedriveapp/spacedrive/blob/main/core/src/ops/mod.rs): `core/src/ops/mod.rs`
- [Durable jobs](https://github.com/spacedriveapp/spacedrive/blob/main/core/src/infra/job/manager.rs): `core/src/infra/job/manager.rs`

### Library and catalog

- [Library manager](https://github.com/spacedriveapp/spacedrive/blob/main/core/src/library/manager.rs): `core/src/library/manager.rs`
- [Resource model](https://github.com/spacedriveapp/spacedrive/blob/main/core/src/domain/resource.rs): `core/src/domain/resource.rs`
- [Library database](https://github.com/spacedriveapp/spacedrive/blob/main/core/src/infra/db/entities/space.rs): `core/src/infra/db/entities/space.rs`
- [Live indexing](https://github.com/spacedriveapp/spacedrive/blob/main/core/src/ops/indexing/job.rs): `core/src/ops/indexing/job.rs`
- [Search pipeline](https://github.com/spacedriveapp/spacedrive/blob/main/core/src/ops/search/pipeline.rs): `core/src/ops/search/pipeline.rs`

### Remote access

- [Peer synchronization](https://github.com/spacedriveapp/spacedrive/blob/main/core/src/infra/sync/peer_log.rs): `core/src/infra/sync/peer_log.rs`
- [Source mounts](https://github.com/spacedriveapp/spacedrive/blob/main/core/src/ops/mounts/mod.rs): `core/src/ops/mounts/mod.rs`

### Product capabilities

- [File operations](https://github.com/spacedriveapp/spacedrive/blob/main/core/src/ops/files/planner.rs): `core/src/ops/files/planner.rs`
- [Volumes and sources](https://github.com/spacedriveapp/spacedrive/blob/main/core/src/volume/manager.rs): `core/src/volume/manager.rs`
- [History and snapshots](https://github.com/spacedriveapp/spacedrive/blob/main/core/src/infra/sync/event_log/mod.rs): `core/src/infra/sync/event_log/mod.rs`
- [Extensions](https://github.com/spacedriveapp/spacedrive/blob/main/core/src/infra/extension/manager.rs): `core/src/infra/extension/manager.rs`
- [External adapters](https://github.com/spacedriveapp/spacedrive/blob/main/crates/archive/src/engine.rs): `crates/archive/src/engine.rs`

### Other components

- **Person or software**

## Connections

- Person or software → CLI: uses
- Person or software → Desktop app: uses
- Person or software → Web interface: uses
- Person or software → Mobile app: uses
- Person or software → Photos app: uses
- Person or software → TypeScript SDK: invokes
- CLI → Daemon API: sends requests (evidence: `apps/cli/src/main.rs`)
- Desktop app → Daemon API: connects
- Web interface → Daemon API: calls operations
- Mobile app → Daemon API: calls operations
- Photos app → Daemon API: reads snapshots (evidence: `apps/native/src/main.rs`)
- TypeScript SDK → Daemon API: calls operations
- Daemon API → Registered operations: dispatches
- Registered operations → Library manager: uses library
- Registered operations → Durable jobs: starts jobs
- Library manager → Library database: persists records (evidence: `core/src/library/manager.rs`)
- Library manager → Resource model: manages resources (evidence: `core/src/library/manager.rs`)
- Registered operations → Live indexing: runs indexing
- Registered operations → Search pipeline: runs search (evidence: `core/src/ops/search/pipeline.rs`)
- Registered operations → File operations: validates and executes
- Live indexing → Library database: updates catalog
- Search pipeline → Library database: queries catalog
- Volumes and sources → Library manager: tracks changes (evidence: `core/src/volume/manager.rs`)
- Library manager → Peer synchronization: synchronizes models
- Registered operations → History and snapshots: exposes history
- Registered operations → Source mounts: serves mounts
- Peer synchronization → Source mounts: streams source bytes
- Registered operations → Extensions: runs extensions
- Volumes and sources → External adapters: uses external sources
