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

smallbase

v1.5.0

Published

Local database in a node.js project with json files

Downloads

28

Readme

Smallbase

Local JSON database for consistents Node.js projects. Execute your CRUD operations synchronously without external dependencies.

Usage

When you create your first entry, it will create a new folder for your database (you choose the path). Then it will create a new json file per collection (col) to improve performance and organization.

For every operation, as the first string argument, you need to specify the name of he collection (eg 'users'). The majority of operations need a second object argument to create or find an element. In this case, you only need one parameter (eg {name: 'Bob'}). For update, pass an object with multiple parameters, the first to find the element and the others to change it.

The functions should return the object or an array if they succeed. If they dont find the request, they will return undefined. If there is a bug, an error will be raised and the program wont crash if you use try catch.
Create gives back an object with a random id and the current timestamp.

Installation

npm install smallbase

To import this library, you need to set your project as ESM. Add this line in your package.json : "type": "module"

Code

import sb from 'smallbase'  

// Optional: Change storage location (default: './db/')
sb.setPath('./data/') 

// Create
sb.create('users' {name: 'Bob', age: 42})

// Find
sb.find('users', {name: 'Bob'})

// Find all 
sb.findAll('users', {age: 42})

// Fetch all items
const users = sb.fetch('users')

// Fetch 10 items from second  
const someUsers = sb.fetch('users', 2, 10)

// Update 
sb.update('users', {name: 'Bob', age: 52})

// Delete 
sb.delete('users', {name: 'Bob'})

// Erase one collection
sb.erase('users')

// Erase all collections
sb.erase()

Test

import sb from 'smallbase'  

// Create, update and check if it works 
try {
    sb.create('users', { name: 'Bob', age: 42 })
    const newAge = 52
    sb.update('users', {name: 'Bob', age: newAge})
    const user = sb.find('users', {name: 'Bob'})
    // should display true 
    console.log(user.age == newAge)
}catch(e){
    console.error(e)
}