{"id":41604,"library":"node-json-database","title":"node-json-database","description":"A simple JSON-based database management system for Node.js that stores data in flat JSON files. Version 0.0.34 is the latest stable release, with infrequent updates. It provides SQL-like operations (create, insert, where) but lacks advanced features like indexing, transactions, or concurrency control. Differentiates from full DBMS by being lightweight and file-based, suitable for prototyping or small projects. Not intended for production use.","status":"active","version":"0.0.34","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","database","db","sql","json"],"install":[{"cmd":"npm install node-json-database","lang":"bash","label":"npm"},{"cmd":"yarn add node-json-database","lang":"bash","label":"yarn"},{"cmd":"pnpm add node-json-database","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only since outset; CommonJS require will return undefined.","wrong":"const db = require('node-json-database')","symbol":"db","correct":"import { db } from 'node-json-database'"},{"note":"The package exports a function `db`, not a class. No named export 'Database'.","wrong":"import { Database } from 'node-json-database'","symbol":"Database","correct":"import { db } from 'node-json-database'"},{"note":"Use `myDB.table('name')` to get a table reference, then call `.create()`.","wrong":"myDB.createTable('name')","symbol":"myDB.table()","correct":"const table = myDB.table('name'); table.create()"}],"quickstart":{"code":"import { db } from 'node-json-database';\n\n// Create database\nconst myDB = db('myDB');\nmyDB.create();\n\n// Create table\nconst friendsTable = myDB.table('friends');\nfriendsTable.create();\n\n// Add columns\nfriendsTable.columns.add([\n  { name: 'firstName', dataType: 'String' },\n  { name: 'lastName', dataType: 'String' },\n  { name: 'birthday', dataType: 'DateTime' },\n  { name: 'favouriteNumber', dataType: 'Int' }\n]);\n\n// Insert values\nfriendsTable.insert([\n  { firstName: 'John', lastName: 'Doe', birthday: new Date('01 Jan 1970').getTime(), favouriteNumber: 42 },\n  { firstName: 'Johnny', lastName: 'Doe', birthday: new Date('01 Jan 2000').getTime(), favouriteNumber: 69 }\n]);\n\n// Query\nconst search = friendsTable.get().where(row => row.firstName == 'Johnny');\nconsole.log(search.rows);","lang":"typescript","description":"Creates a database, table with columns, inserts records, and queries with where filter."},"warnings":[{"fix":"Use only in single-process, non-concurrent environments.","message":"Database files are stored in a local directory; no server or concurrent access support.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Ensure correct working directory or provide absolute path.","message":"The `db()` function creates database directories relative to process.cwd().","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Always call `table.create()` before using it.","message":"Table must be created before adding columns or inserting data; no schema migration.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Ensure inserted data matches column types exactly.","message":"Data types are enforced at insert time; invalid types may cause silent failures.","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"search_vec":"'0.0.34':23 'advanc':43 'base':9,61 'concurr':49 'control':50 'creat':38 'data':17 'databas':4,10,74 'db':75 'dbms':54 'differenti':51 'featur':44 'file':21,60 'file-bas':59 'flat':19 'full':53 'index':46 'infrequ':30 'insert':39 'intend':69 'javascript':73 'json':3,8,20,77 'json-bas':7 'lack':42 'latest':26 'lightweight':57 'like':36,45 'manag':11 'node':2 'node-json-databas':1 'node.js':14 'oper':37 'product':71 'project':67 'prototyp':64 'provid':33 'releas':28 'simpl':6 'small':66 'sql':35,76 'sql-like':34 'stabl':27 'store':16 'suitabl':62 'system':12 'transact':47 'updat':31 'use':72 'version':22","created_at":"2026-06-04T18:53:13.099230+00:00","updated_at":"2026-06-04T18:53:13.099230+00:00","problems":[{"fix":"Use `import { db } from 'node-json-database'`","cause":"Using CommonJS require instead of ESM import","error":"TypeError: db is not a function"},{"fix":"Run `npm install node-json-database` and verify import string","cause":"Package not installed or import path typo","error":"Cannot find module 'node-json-database'"},{"fix":"Ensure `myDB = db('myDB'); myDB.create();` before using table()","cause":"Calling table() on undefined (db not created)","error":"TypeError: myDB.table is not a function"}],"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":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"node-json-database","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-04","next_check":"2026-09-02","install_tag":null}}