{"id":46488,"library":"sqlite-tree-store","title":"SQLite Tree Store","description":"A lightweight, schema-less document store built on SQLite, designed for quick prototyping and storing config data. Current stable version is 1.1.7. It uses better-sqlite3 under the hood and exposes a JavaScript Proxy-based tree interface for CRUD operations. Unlike full MongoDB, it leverages SQLite for persistence without a separate server. Key differentiators: auto-save to DB, ability to break binding (._) for transient changes, and meta-data access. Release cadence is low; version 1.x is stable. Not actively maintained; last release was in 2020.","status":"maintenance","version":"1.1.7","language":"javascript","source_language":"en","source_url":"https://github.com/yenesey/sqlite-tree-store","tags":["javascript","sqlite","tree","store","document","json","object"],"install":[{"cmd":"npm install sqlite-tree-store","lang":"bash","label":"npm"},{"cmd":"yarn add sqlite-tree-store","lang":"bash","label":"yarn"},{"cmd":"pnpm add sqlite-tree-store","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Underlying SQLite engine; required at runtime","package":"better-sqlite3","optional":false}],"imports":[{"note":"Package is CJS-only; ESM import will fail with ERR_REQUIRE_ESM","wrong":"import treeStore from 'sqlite-tree-store'","symbol":"default","correct":"const treeStore = require('sqlite-tree-store')"},{"note":"treeStore returns a builder function; invoke it with no args to get root proxy. tree() is not exported directly.","wrong":"const t = treeStore('mydb.db', 'system').tree()","symbol":"tree()","correct":"const t = treeStore('mydb.db', 'system')()"},{"note":"No TypeScript types; use @ts-ignore or create .d.ts. Default import is CJS default.","wrong":"import { treeStore } from 'sqlite-tree-store'","symbol":"Default (typed)","correct":"import treeStore from 'sqlite-tree-store' // @ts-ignore"}],"quickstart":{"code":"const treeStore = require('sqlite-tree-store');\nconst build = treeStore('test.db', 'system');\nconst t = build();\nt.config = { mail: { host: 'example.com', port: 25 } };\nt.config.ssl = { certFile: 'main.pfx' };\nconsole.log(t); // shows { config: { mail: ..., ssl: ... } }","lang":"javascript","description":"Demonstrates initializing store, creating root proxy, and setting nested properties with auto-save."},"warnings":[{"fix":"Use as: const treeStore = require('sqlite-tree-store'); const build = treeStore('path.db', 'tableName'); const t = build();","message":"require('sqlite-tree-store') returns a function (factory), not an object with methods.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Use the `._` binding break for transient changes: t.config.mail._.port = 10025; changes won't persist.","message":"Assigning a value directly to a proxy property triggers auto-save, which may cause performance issues on large writes.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure build tools (node-gyp, python) are present; for CI, use prebuilt binaries via better-sqlite3's prebuildify.","message":"The package depends on better-sqlite3 which requires native compilation; may fail in browser or certain CI environments.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"If using depth, pass as second argument: tree([], 1). For full tree, omit both arguments: tree().","message":"In version 1.1.0, the tree() function signature changed: depth parameter added. Old code calling tree() with depth argument may behave differently.","severity":"breaking","affected_versions":">=1.1.0"}],"env_vars":null,"search_vec":"'1':83 '1.1.7':26 '2020':94 'abil':66 'access':77 'activ':88 'auto':62 'auto-sav':61 'base':41 'better':30 'better-sqlite3':29 'bind':69 'break':68 'built':11 'cadenc':79 'chang':72 'config':20 'crud':45 'current':22 'data':21,76 'db':65 'design':14 'differenti':60 'document':9,99 'expos':36 'full':48 'hood':34 'interfac':43 'javascript':38,95 'json':100 'key':59 'last':90 'less':8 'leverag':51 'lightweight':5 'low':81 'maintain':89 'meta':75 'meta-data':74 'mongodb':49 'object':101 'oper':46 'persist':54 'prototyp':17 'proxi':40 'proxy-bas':39 'quick':16 'releas':78,91 'save':63 'schema':7 'schema-less':6 'separ':57 'server':58 'sqlite':1,13,52,96 'sqlite3':31 'stabl':23,86 'store':3,10,19,98 'transient':71 'tree':2,42,97 'unlik':47 'use':28 'version':24,82 'without':55 'x':84","created_at":"2026-06-07T13:00:10.156803+00:00","updated_at":"2026-06-07T13:00:10.156803+00:00","problems":[{"fix":"npm install better-sqlite3","cause":"Peer dependency better-sqlite3 not installed.","error":"Error: Cannot find module 'better-sqlite3'"},{"fix":"Use const treeStore = require('sqlite-tree-store')","cause":"Importing via ES6 import syntax instead of require.","error":"TypeError: treeStore is not a function"},{"fix":"Ensure consistent table name: const build = treeStore('mydb.db', 'mytable'); then build() creates table 'mytable' and view 'v_mytable'.","cause":"Table name in call does not match existing table; or store not initialized.","error":"Error: SQLITE_ERROR: no such table: system"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/yenesey/sqlite-tree-store#readme","github":"https://github.com/yenesey/sqlite-tree-store","docs":null,"changelog":null,"pypi":null,"npm":"sqlite-tree-store","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}