TypeScript port of declarative_sqlite for PWA and Capacitor applications. Version 2.2.29 (stable) provides zero code generation via JavaScript Proxy, automatic schema migration, and built-in conflict resolution for offline-first apps. Key differentiators: tiny bundle (~15KB gzipped), RxJS reactive queries, multi-backend support (wa-sqlite, Capacitor, better-sqlite3), and HLC+LWW conflict resolution. Release cadence is frequent (multiple updates per month). Requires rxjs as a peer dependency.
npm install declarative-sqliteNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Defines a users schema with automatic migration and inserts/query records using DeclarativeDatabase.
Use AdapterFactory.create() instead of direct instantiation.
Use explicit type assertion with 'as' or cast the record to the desired type.
Always use lowercase table/column names in schema and queries.
Manually backup database before schema changes or disable autoMigrate for production.
Run 'npm install declarative-sqlite rxjs' (rxjs is a required peer dependency)
Ensure you await db.initialize() before any CRUD operations.
Remove duplicate table definitions from the schema builder chain.
Check environment compatibility; use StorageBackend.Auto for automatic detection.