Background
To support the migration from Deno KV to SQLite in our tutorials (see #272 and #273), we need a SQLite-based implementation of the KvStore interface.
This implementation would enable users to use SQLite as their persistent storage backend while maintaining compatibility with Fedify's existing KvStore API.
Proposed Implementation
Create a SqliteKvStore class that implements the KvStore interface using SQLite as the underlying storage mechanism.
Key Requirements
- Cross-runtime compatibility: Support Node.js (
node:sqlite), Deno (node:sqlite compatible), and Bun (bun:sqlite)
- API compatibility: Full implementation of the existing
KvStore interface
- Performance: Efficient SQLite operations with proper indexing
- Reliability: Proper error handling and transaction support
- Type safety: Full TypeScript support with proper type definitions
Packaging Options
Two potential approaches for distribution:
-
Integrated approach: @fedify/fedify/x/sqlite
- Pros: Easier discovery, single dependency
- Cons: Increases main package size
-
Separate package: @fedify/sqlite
- Pros: Optional dependency, cleaner separation of concerns
- Cons: Additional package to maintain, potential version sync issues
Implementation Details
- Use native SQLite modules across all supported runtimes
- Implement proper schema migration handling
- Support for TTL (time-to-live) functionality if needed
- Comprehensive test coverage across all target runtimes
- Clear documentation and usage examples
Benefits
- Tutorial modernization: Enables migration away from Deno KV in tutorials
- Production readiness: Provides a solid SQLite option for production use
- Developer experience: Familiar SQLite database with KvStore convenience
- Cross-platform: Works consistently across Node.js, Deno, and Bun
Acceptance Criteria
Background
To support the migration from Deno KV to SQLite in our tutorials (see #272 and #273), we need a SQLite-based implementation of the
KvStoreinterface.This implementation would enable users to use SQLite as their persistent storage backend while maintaining compatibility with Fedify's existing
KvStoreAPI.Proposed Implementation
Create a
SqliteKvStoreclass that implements theKvStoreinterface using SQLite as the underlying storage mechanism.Key Requirements
node:sqlite), Deno (node:sqlitecompatible), and Bun (bun:sqlite)KvStoreinterfacePackaging Options
Two potential approaches for distribution:
Integrated approach:
@fedify/fedify/x/sqliteSeparate package:
@fedify/sqliteImplementation Details
Benefits
Acceptance Criteria
SqliteKvStoreclass implements fullKvStoreinterfacenode:sqlitenode:sqlitecompatible modulebun:sqlite@fedify/fedify/x/sqlitevs@fedify/sqlite)