Skip to content

NeaByteLab/Jsonary

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jsonary

File-based JSON database for TypeScript, with a simple query builder.

Node Deno Bun

Module type: Deno/ESM npm version JSR CI License

Features

  • Simple file-backed storage - One JSON file, no database server needed.
  • Everyday data work - Insert, read, update, delete, clear, and reload.
  • Flexible filtering - Chain filters, then read or modify matching.
  • Structured records - Query and update nested object fields easily.

Installation

Note

Prerequisites: For Deno (install from deno.com). For npm use Node.js (e.g. nodejs.org).

Deno (JSR):

deno add jsr:@neabyte/jsonary

npm:

npm install @neabyte/jsonary

Quick Start

Create a database instance and start inserting/querying objects.

import Jsonary from '@neabyte/jsonary' // Initialize database file (auto-created on first write) const db = new Jsonary({ path: './data.json' }) // Insert one record db.insert({ name: 'John', age: 30 }) // Insert many records db.insertMany([ { name: 'Jane', age: 25 }, { name: 'Bob', age: 35 } ]) // Filter records with string condition const adults = db.where('age >= 18').get() // Get first matching record const firstJohn = db.where('name = John').first()
  • USAGE.md for more examples and query operator details.

Build

npm build (bundles to dist/):

npm run build

Testing

Type check — format, lint, and type-check:

deno task check

Unit tests — format/lint tests and run all tests:

deno task test
  • Tests live under tests/ (public API tests in tests/jsonary.test.ts).
  • The test task uses --allow-read, --allow-write, and --allow-env.

License

This project is licensed under the MIT license. See the LICENSE file for details.