System Design
The architecture follows a client-server pattern on your own hardware. A daemon process runs the core engine. Clients connect to access functionality. Every device functions as an equal peer in the network.The daemon runs continuously in the background, indexing files and syncing
data even when no UI is open.
Core Components
The Spacedrive Daemon
The daemon is a headless process that runs the VDFS core. It manages the library database, executes background jobs, and exposes an RPC interface for clients. The daemon handles three primary responsibilities:- Core engine lifecycle management
- Background task execution (indexing, sync, analysis)
- Client communication through RPC
Client Applications
Clients provide the user interface without containing business logic. The desktop app, mobile app, and CLI all connect to the daemon to execute operations. This separation keeps interfaces lightweight and ensures consistent behavior across platforms.Communication Protocol
Spacedrive implements Command Query Responsibility Segregation (CQRS) over RPC. Every operation falls into one of two categories: Commands change system state. They follow a three-phase lifecycle:The strict separation between commands and queries prevents accidental data
modification during read operations.
Code Organization
Operations (core/src/ops)
Operations implement the CQRS handlers. Each domain has its own module:
ops/entry- File and folder operationsops/tag- Tag managementops/location- Location indexingops/collection- Collection handling
Services (core/src/service)
Services orchestrate complex processes using lower-level operations:
NetworkService manages peer-to-peer connections between devices.
SyncService coordinates metadata synchronization across the network.
JobManager executes durable background tasks like file analysis and thumbnail generation.
Services run continuously, responding to events and coordinating between different parts of the system.
Mobile Architecture
iOS and Android apps embed the entire Rust core directly in the application binary. This embedded core enables mobile devices to function as complete Spacedrive nodes. Your phone can:- Index local photos and files
- Manage its own SQLite database
- Sync directly with other devices
- Operate without a desktop connection
System Lifecycle
The typical execution flow follows these steps:Startup Sequence
- Daemon Launch: The daemon starts when you launch the GUI app or run
sd start. CLI users can optionally configure auto-start on login usingsd daemon installon macOS. - Library Load: SQLite database opens and VDFS core initializes
- Service Activation: Background services start and announce on the network
- Client Connection: UI applications connect via RPC socket
Runtime Operation
During normal operation, clients send commands and queries to the daemon. The daemon processes requests, updates the database, and returns results. Background services continue indexing files and syncing with peers.Shutdown Process
The daemon stops all services gracefully. Pending database transactions complete. Open connections close. The library saves its state for the next startup.Performance Characteristics
The architecture optimizes for local-first operation: Zero network latency for local operations. File browsing and searching execute against the local database. Parallel processing across multiple CPU cores. The Rust core uses async/await for concurrent operations. Minimal memory footprint through lazy loading. Only active data loads into memory. Background indexing without blocking the UI. File analysis happens in separate worker threads.Security Model
Every component enforces security at multiple levels: Database encryption protects data at rest. RPC authentication prevents unauthorized access. Peer verification ensures you only sync with trusted devices.Extension System
Spacedrive provides a comprehensive SDK for building extensions that integrate seamlessly with core functionality. Extensions run in sandboxed WASM environments while maintaining full access to Spacedrive’s capabilities. The SDK enables developers to:- Define custom data models that sync across devices
- Build specialized interfaces for specific workflows
- Create AI-powered agents for data analysis
- Connect external services and platforms
Next Steps
Understanding the architecture provides the foundation for working with Spacedrive. Explore these topics next:- Libraries - How Spacedrive organizes your data
- Networking - Peer-to-peer communication details
- Sync - Multi-device synchronization protocols
