SQLite
SQLite is the local dev/embedded default. Single-file database with zero configuration, perfect for development and testing.
Why SQLite
Section titled “Why SQLite”| Strength | Benefit |
|---|---|
| Zero setup | No server, no network |
| Single file | Easy backup, copy, share |
| ACID compliant | Full transaction support |
| Fastest for local | No network round-trips |
| Testing | Perfect for unit/integration tests |
Limitations
Section titled “Limitations”| Limitation | Impact |
|---|---|
| Single writer | No concurrent write scaling |
| Local only | Can’t share across machines |
| File locking | Potential issues on network filesystems |
Configuration
Section titled “Configuration”[storage]backend = "sqlite"
[storage.sqlite]path = "./angzarr.db"# Or in-memory for testing# path = ":memory:"Environment Variables
Section titled “Environment Variables”export SQLITE_PATH="./angzarr.db"export STORAGE_BACKEND="sqlite"File Locations
Section titled “File Locations”./angzarr.db # Default location:memory: # In-memory (lost on exit)/var/lib/angzarr/data.db # Production pathWAL Mode
Section titled “WAL Mode”Angzarr enables WAL (Write-Ahead Logging) by default for better concurrency:
PRAGMA journal_mode = WAL;PRAGMA synchronous = NORMAL;Benefits:
- Readers don’t block writers
- Writers don’t block readers
- Better crash recovery
Testing
Section titled “Testing”SQLite is the default for test suites:
# Run interface tests against SQLitecargo test --test interfaces
# Fast, no containers neededcargo test --libBackup
Section titled “Backup”Simple file copy when database is quiet:
# Safe backup (uses SQLite backup API)sqlite3 angzarr.db ".backup backup.db"
# Or just copy during low activitycp angzarr.db angzarr.db.backupFor hot backups, use the SQLite backup API or filesystem snapshots.
When to Use SQLite
Section titled “When to Use SQLite”- Development — Fast iteration, no setup
- Testing — Isolated, deterministic
- Embedded — Single-process applications
- Prototyping — Get started immediately
- Edge — Limited resources, no network
Next Steps
Section titled “Next Steps”- PostgreSQL — Production scaling
- Testing — SQLite in test suites