Trilogy 1.0, no-hassle SQLite that's great for Electron


#1

Hey all, I pushed the first official 1.0 release candidate of my library Trilogy yesterday and I think a lot of you might find it useful. This is a complete rewrite from the first time I posted Trilogy here something like 4 months ago, and it has a much better, lighter code base now ( I’ve uh… learned a lot ).

It’s a Promise-based wrapper for using sqlite and killer feature #1 is that you can configure and use it with no native module compilation. While it’s now been updated to support the usual sqlite3 module, it can also still use sql.js as a pure JS backend. This helps a lot when you’re building a cross-platform Electron app since you don’t have to rebuild the native sqlite module.

You can think of it like nedb, pouch DB, or similar databases - and it actually has a similar API to those kind of document store style databases. Check out the usage example on the GitHub repo to see what it looks like.

In that example you’ll see killer feature #2 - you define models for your tables and Trilogy will automatically type-cast them on input & return so you always get the data type you’re expecting. Strings, numbers, booleans, dates, even arrays & objects.

And if you want or need to use more complicated SQLite queries, Trilogy uses knex internally and also exposes that instance to you for query building.

I’d appreciate your feedback on the latest release - code, presentation, etc. So here’s where you can find Trilogy:

Heads up, if the docs site seems down within the next day or so please check back as I’m requesting a JS.org domain. Until then the docs are also available as raw markdown in the repo’s docs folder.