A simple Promise-based SQLite layer for TypeScript and JavaScript, supporting both native C++ (sqlite3) and pure JavaScript (sql.js) backends. Version 2.0.5 is the latest stable release. Key differentiators include automatic type casting between JS and SQLite types, swappable backends without code changes, lifecycle hooks, and first-class TypeScript support. It is not an ORM; instead it provides a Mongoose-inspired API for schema-defined models with query building via knex. Suitable for Node.js and Electron environments.
npm install trilogyNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates connecting to a SQLite file, defining a model with automatic type casting, syncing schema, creating a document, querying with conditions, and closing the database.
Install one of: npm install sqlite3 or npm install sql.js
Use import { connect, Model, Types } from 'trilogy'Use async/await or .then() instead of callbacks.
Install sqlite3 or sql.js as a peer dependency.
Use import { connect } from 'trilogy'No dependency data recorded yet.