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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@chcaa/json-db

v0.4.0

Published

The core module of **json-db** that can be used independently of the **[json-db Editor](https://json-db.chc.au.dk)**.

Downloads

12

Readme

json-db Core

The core module of json-db that can be used independently of the json-db Editor.

The module supports the following:

  • CLI tools for exporting data and renaming collections and collection properties.
  • Programmatically interaction with a json-db database, supporting the same features as the editor such as creating, editing and searching entries.

CLI Tools

The json-db core module includes a set of CLI tools for exporting data and altering the database schema. All CLI tools can be executed using npx.

Each CLI tool includes a -h / --help command that prints all required and optional arguments and options.

Example

npx @chcaa/json-db@latest json-db export -h

To get a list of all available commands and global options run:

npx @chcaa/json-db@latest json-db -h

Exporting Entries

Export entries from the database in ndjson format with the possibility of searching and populating relational entries.

Example - general usage

npx @chcaa/json-db@latest json-db export "/path/to/db/root-dir" "collectionName" "/dest/path/entries.ndjson" -q "query" -p "populateField1,populateField12"

Example - export "books" with "authors"

npx @chcaa/json-db@latest json-db export "/path/to/books-db books" "/desktop/books.ndjson" -p "authors"

Example - export "books" including files

npx @chcaa/json-db@latest json-db export "/path/to/books-db books" "/desktop/books" -f

Renaming a Collection

Rename a collection and all references to the collection in the database schema.

Example - general usage

npx @chcaa/json-db@latest json-db rename-collection "/path/to/db/root-dir" "currentPluralName" "newPluralName" "newSingularName"

Example - rename the collection "books" to "works"

npx @chcaa/json-db@latest json-db rename-collection "/path/to/books-db" "books" "works" "work"

Renaming a Collection Field

Rename a collection field and all references to the field both in the schema and in entries of the collection.

Example - general usage

npx @chcaa/json-db@latest json-db rename-collection-field "/path/to/db/root-dir" "collectionPluralName" "fieldPath" "newPropName" "newPropTitle"

Example - rename the "author" field in the "books" collection to "writers"

npx @chcaa/json-db@latest json-db rename-collection-field "/path/to/books-db" "books" "authors" "writers" "Writers"

Bulk Updating Entries

Currently, the CLI tools do not support bulk updates on entries such as updating the property of all entries where a specific condition is met.

But jq should is most cases be able to carry out the required task.

Install jq from https://jqlang.org/download/

E.g., to rename the genre of all books where the current genre is "classics" to "must-read" the following jq expression can be used.

jq '.entries |= map(if .genre == "classics" then .genre = "must-read" else . end)' books.json > books-new.json

Verify that the content of the books-new.json is correct and overwrite the current file (mv books-new.json books.json).

Experiment with jq at https://play.jqlang.org/.