apps/server/README.md
HTTP server for Spacedrive with embedded daemon (RPC only, no web UI).
sd-server runs the Spacedrive daemon and exposes RPC endpoints over HTTP. Perfect for:
sd-cli┌─────────────────────────────────────────┐
│ sd-server (HTTP Server) │
│ ┌───────────────────────────────────┐ │
│ │ Axum HTTP Server (Port 8080) │ │
│ │ ├─ /health (healthcheck) │ │
│ │ └─ /rpc (proxy to daemon) │ │
│ └───────────────────────────────────┘ │
│ ↓ │
│ ┌───────────────────────────────────┐ │
│ │ Embedded Daemon │ │
│ │ (Unix socket: daemon.sock) │ │
│ │ ├─ Core VDFS │ │
│ │ ├─ Indexing │ │
│ │ ├─ P2P Networking │ │
│ │ └─ File Operations │ │
│ └───────────────────────────────────┘ │
└─────────────────────────────────────────┘
Unlike Tauri (desktop app), the server:
Build the server:
cargo build -p sd-server
Run the server:
# Development mode (creates temp data dir)
cargo run -p sd-server
# Production mode (requires DATA_DIR)
DATA_DIR=/path/to/data cargo run -p sd-server --release
Access the RPC endpoint:
Perfect for TrueNAS, Unraid, or any Docker-compatible NAS.
Create a .env file:
# REQUIRED: Set your credentials
SD_AUTH=admin:your-secure-password
# Optional: Change port
PORT=8080
# Optional: Disable auth (NOT RECOMMENDED)
# SD_AUTH=disabled
Start with docker-compose:
cd apps/server
docker-compose up -d
Access the server:
http://your-nas-ip:8080.env| Variable | Description | Default | Required |
|---|---|---|---|
DATA_DIR | Path to Spacedrive data directory | /data (in Docker) | Yes (production) |
PORT | HTTP server port | 8080 | No |
SD_AUTH | Authentication credentials (format: user:pass,user2:pass2) | None | Recommended |
SD_P2P | Enable P2P networking | true | No |
RUST_LOG | Log level | info,sd_core=debug | No |
IMPORTANT: Always set SD_AUTH in production!
# Single user
SD_AUTH=admin:securepassword123
# Multiple users
SD_AUTH=admin:pass1,user:pass2,readonly:pass3
# Disable (NOT RECOMMENDED - only for trusted networks)
SD_AUTH=disabled
Uses HTTP Basic Authentication. The server will return 401 Unauthorized if credentials don't match.
The server stores all data in DATA_DIR:
$DATA_DIR/
├── daemon/
│ └── daemon.sock # Unix socket for RPC
├── libraries/
│ └── *.sdlibrary/ # Library databases
├── logs/ # Application logs
└── current_library_id.txt # Last opened library
Docker volumes: Mounted at /data inside the container.
Navigate to Apps in TrueNAS web UI
Click "Launch Docker Image"
Configure:
8080 to host/mnt/pool/spacedrive to /dataSD_AUTH=admin:yourpasswordTZ=America/New_York (your timezone)Add storage pools (optional):
/mnt/tank/photos → /photos in containerdocker run -d \
--name spacedrive \
-p 8080:8080 \
-p 7373:7373 \
-v /mnt/pool/spacedrive:/data \
-v /mnt/pool/media:/media:ro \
-e SD_AUTH=admin:password \
-e TZ=UTC \
--restart unless-stopped \
spacedrive/server:latest
# Build server (RPC only)
cargo build --release -p sd-server
# Run server
./target/release/sd-server --data-dir /path/to/data
You can connect with:
sd-cli (CLI client)/rpc# Run server in dev mode
cargo run -p sd-server
# Server starts on http://localhost:8080
# Use sd-cli or custom client to interact with RPC endpoint
GET /healthHealth check endpoint.
Response: 200 OK with body "OK"
POST /rpcJSON-RPC proxy to daemon.
Request:
{
"jsonrpc": "2.0",
"id": 1,
"method": "query:libraries.list",
"params": { "include_stats": false }
}
Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": [...]
}
| Feature | Server | Tauri |
|---|---|---|
| Platform | Linux/Docker | macOS/Windows/Linux |
| UI | None (RPC only) | Native webview |
| Daemon | Embedded in process | Spawned as child process |
| Access | Remote over HTTP | Local only |
| Auth | HTTP Basic Auth | Not needed (local) |
| Use Case | NAS, headless servers, CLI | Desktop workstations |
Both use the same Spacedrive core!
DATA_DIR exists and is writablelsof -i :8080RUST_LOG=debug cargo run -p sd-serverdaemon.sock exists in $DATA_DIR/daemon/$DATA_DIR/logs/rm $DATA_DIR/daemon/daemon.sockSD_AUTH format: username:passwordcurl -u admin:password http://localhost:8080/health
docker build -f apps/server/Dockerfile .
The server app is part of the Spacedrive v2 monorepo.
Project structure:
apps/server/
├── src/
│ └── main.rs # Server implementation
├── Cargo.toml # Dependencies
├── Dockerfile # Container image
└── docker-compose.yml # Docker setup
Making changes:
apps/server/src/main.rscore/src/infra/daemon/AGPL-3.0 - See LICENSE file in repository root.