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

node-json-db-manager

v1.0.0

Published

A lightweight, file-based JSON database with optional encryption, supporting basic CRUD operations and password protection.

Readme

node-json-db-manager

A lightweight, file-based JSON database with optional encryption, supporting basic CRUD operations and password protection.

Features

  • Lightweight & Simple: No external dependencies, just a JSON file as your database.
  • Encryption Support: Secure your data with AES-256-GCM encryption.
  • CRUD Operations: Insert, find, update, and delete documents easily.
  • File-Based Storage: Data is stored in a JSON file, making it easy to manage.
  • Password Protection: Optionally lock/unlock your database with a password.

Installation

npm install node-json-db-manager

Usage

Importing the Library

import JsonDB from "node-json-db-manager"

Creating a Database Instance

const db = new JsonDB("database.json");

With encryption:

const db = new JsonDB("database.json", { password: "securepassword" });

Insert Data

db.insert({ name: "Alice", age: 25 });

Find Data

const results = db.find({ name: "Alice" });
console.log(results);

Update Data

const updatedUser = db.update(1701234567890, { age: 26 });
console.log(updatedUser);

Delete Data

const success = db.delete(1701234567890);
console.log(success ? "Deleted successfully" : "No record found");

Change Password

db.changePassword({ oldPassword: "securepassword", newPassword: "newpassword123" });

API Reference

new JsonDB(dbFile: string, options?: JsonDBOptions)

Creates a new database instance.

  • dbFile: Path to the database file.
  • options: Optional settings:
    • password (string): Encrypts the database with a password.
    • iterations (number): PBKDF2 iterations (default: 100000).
    • digest (string): PBKDF2 digest algorithm (default: sha256).
    • algorithm (string): Encryption algorithm (default: aes-256-gcm).

insert(document: object): object

Inserts a new document and returns it with an auto-generated id.

find(query?: object): object[]

Finds documents that match the query.

update(id: number, updates: object): object | undefined

Updates a document by id and returns the updated document.

delete(id: number): boolean

Deletes a document by id and returns true if deleted, false otherwise.

changePassword(payload: { oldPassword: string, newPassword: string })

Changes the encryption password.

License

MIT License © 2024 node-json-db-manager