npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

sqlite-tree-store

v1.1.7

Published

Simple document store over SQLite

Readme

SQLite Tree Store

A simple document store over SQLite

This module is suitable when you need:

  • a simple schema-less store for quick prototyping (like "minimal mongo")
  • to store config data in SQLite instead of .json files
  • combined store of document (object tree) & relational data

Example

const treeStore = require('sqlite-tree-store')
const build = treeStore('mydb.db', 'system')
const t = tree() // -- 't' is a root of tree, restored from db (or created empty one)

Explain treeStore params:

'mydb.db' - if not exisis, file will be created in current directory. NOTE: module uses better-sqlite3 under the hood, so you can pass opened BetterSqlite3.Database instance in place of file name

'system' - is a common name for table: 'system', and a view 'v_system'. theese entities created at startup (if not exists).

function tree([path], [depth]) : Proxy

[path] (optional) array of strings representing path to node

[depth] (optional) build to desired depth

so

tree() - build whole tree deep

tree([], 1) - build only 1st level nodes from root

tree(['config']) - build whole node '\config*'

tree(['config', 'mail']) - build whole node '\config\mail*'

Play with command line (continue example)

In module folder type

\> node cli mydb.db

and feel free to do some tests, shown below, manually copy&paste

All CRUD operations performed through JavaScript (objects & arrays):

\> t.config = { 
    mail: { host: 'exchange.myoffice.com', port: 25 }, 
    ssl: { certFile:'main.pfx' }
}

now press ctrl+D to exit program

next run you can use this config because it auto-saved in database

once again:

\> node cli mydb.db

and type

\> t

you will see saved config

{
  config: {
    mail: { host: 'exchange.myoffice.com', port: 25 },
    ssl: { certFile: 'main.pfx' }
  }
}

now you can add, modify, delete any node or value of t

in some cases you'll need to disable this auto-db-save feature:

type

\> t.config.mail._.port = 10025

sign ._ semantically means "break binding to the database"

check actual node value by typing t.config.mail.port

\> t.config.mail.port
10025

restart program (ctrl+D) and check actual saved value

if all done right, port = 10025 is not saved

\> t.config.mail.port
25

in some cases you need to know real db node id (rowid)

sign ._ - also opens acces to node meta-data:

\> config.mail._.port.id
4

Thanks

To all developers of better-sqlite3

License

MIT