Unified SQLite database for Starpod's transactional data.
Consolidates sessions, cron scheduling, and authentication into a single
core.db file, replacing the previous session.db + cron.db + users.db
setup. A single shared connection pool (WAL mode, foreign keys enabled)
serves all three domains.
Architecture
┌──────────┐
│ CoreDb │ owns SqlitePool (max 10 conns, WAL, FK ON)
└────┬─────┘
│ pool.clone()
├──────────────► SessionManager::from_pool(pool)
├──────────────► CronStore::from_pool(pool)
└──────────────► AuthStore::from_pool(pool)
Databases kept separate
- memory.db — FTS5 + vector blobs, bulk reindex I/O, different access pattern
- vault.db — AES-256-GCM encrypted, optional (needs
.vault_key), isolated security boundary
Legacy migration
On first open, [CoreDb::new] detects old session.db / cron.db / users.db
in the same directory and migrates their data into core.db, then renames the
old files to *.db.migrated.
Usage
# async fn example() -> starpod_core::Result<()> {
use starpod_db::CoreDb;
let db = CoreDb::new(std::path::Path::new(".starpod/db")).await?;
// Pass db.pool().clone() to SessionManager, CronStore, AuthStore
# Ok(())
# }