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

tinydbjson

v1.0.1

Published

Um banco de dados não relacional simples, projetado para pequenos projetos, testes e provas de conceito (POC). Fácil de usar, com foco em operações CRUD diretamente em arquivos JSON, utilizando a biblioteca nativa fs do Node.js.

Readme

TinyDBJson

A simple and lightweight NoSQL database for Node.js based on JSON files and the native fs module. Perfect for small projects, prototypes, testing, local storage, or proof of concept (POC) applications.

It provides basic CRUD operations (Create, Read, Update, Delete) by reading and writing JSON files directly from your file system.


🚀 Features

  • ⚡ Zero dependencies (uses only Node.js fs and path modules).
  • 🧠 Simple and easy-to-use API.
  • 🗂️ Stores data in local JSON files.
  • 🔧 Automatic file creation if it doesn't exist.
  • ✅ Fully asynchronous (Promise-based).
  • 🏗️ Perfect for small projects, quick demos, and local development.

📦 Installation

npm install tinydbjson

📄 How It Works

TinyDBJson uses Node.js's native fs module to manage a JSON file as a simple NoSQL database. Every record is stored as an object inside an array within the JSON file. Each object has an auto-incremented id field to uniquely identify it.


🛠️ Usage

1. Import the library

const Database = require('tinydbjson');

2. Create or connect to a database file

const db = new Database('./data.json');

⚠️ If the file doesn't exist, it will be created automatically.


3. API Methods


➕ Create

const user = await db.create({ name: "John Doe", age: 30 });
console.log(user);
// Output: { id: 1, name: 'John Doe', age: 30 }

📥 Get All

const users = await db.getAll();
console.log(users);

🔍 Get By ID

const user = await db.getById(1);
console.log(user);
// Output: { id: 1, name: 'John Doe', age: 30 }

✏️ Update

const updatedUser = await db.update(1, { age: 31 });
console.log(updatedUser);
// Output: { id: 1, name: 'John Doe', age: 31 }

❌ Remove

const removedUser = await db.remove(1);
console.log(removedUser);
// Output: { id: 1, name: 'John Doe', age: 31 }

🔥 Error Handling

  • If the JSON file has invalid content, an error will be thrown.
  • If you try to update, fetch, or remove a non-existent ID, an error will be thrown.
  • Only accepts objects with valid keys and values for creation and updates.

📁 Example File Structure

After adding a few items, your JSON file (data.json) will look like this:

[
  {
    "id": 1,
    "name": "John Doe",
    "age": 30
  },
  {
    "id": 2,
    "name": "Jane Doe",
    "age": 28
  }
]

⚙️ Requirements

  • Node.js >= 14

🚫 Limitations

  • Not designed for high-concurrency production systems.
  • No query system (searches are based on IDs only).
  • All data is stored in memory while processing and written back entirely to the file.

⭐ When to Use

✅ Ideal for:

  • Small CLI tools
  • Prototypes
  • Local storage
  • Proof of concept (POC)
  • Learning or educational purposes

❌ Not recommended for:

  • Large-scale production systems
  • Applications requiring complex queries or relationships

📜 License

ISC License


💻 Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.


📫 Contact