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 🙏

© 2024 – Pkg Stats / Ryan Hefner

pocdb

v1.0.14

Published

A lightweight eventually consistent key-value / json db.

Downloads

6

Readme

pocdb

pocdb

Lightweight eventually consistent key/value database.

LIB

Installation

$ npm install pocdb

Usage

Start pocdb engine

const pocdb = require("pocdb")
const configuration = { path: "./data", address: "127.0.0.1, port: 8000 }
pocdb.start(configuration)

Query pocdb engine

pocdb.put("key", "value")
pocdb.get("key")
pocdb.destroy("key")

Create db backup

A backup is named after the data path, suffixed with a current timestamp generated during the call.

pocdb.backup()

Stop pocdb engine

pocdb.stop()

CLI

Installation

$ npm install -g pocdb

Usage

Start pocdb engine and http server

pocdb --path=./data.json --address=127.0.0.1 --port=2222

Configuration

Configuration of pocdb is made up of the following properties :

path

The path of the pocdb persisted data.

address

The listening address of pocdb http server ( default 127.0.0.1 )

port

The listening port of pocdb http server ( default 2222 )

HTTP

At pocdb start an http server is also started at the configured address and port to provide CRUD access to pocdb data.

Data explorer access

Data explorer web interface is available under reserved path "/_explorer"

The web interface is a fork of project "react-json-editor". Original project page at https://github.com/sujinleeme/react-json-editor

Database access

Database HTTP access is available under reserved path "/_database"

Path convention

For any database access HTTP request, the request subpath will be translated into a specific db key, starting after "/_database/" root path. Any "/" will be converted as an internal key separator in the data tree structure. For example an HTTP request ( GET / PUT / DELETE ) sent at "/_database/users/1" path will be internally processed as an equivalent CRUD operation on "users.1" key in the database.

Note : Root path "/_database" PUT and DELETE requests won't update the database whereas GET request will fetch the whole database.

Create / Update

Put a value at a specific key

Method

PUT / POST

Body

{ "value": <ANY_VALUE> }

Response

{ "statusCode": 200, "message": "key updated" }

Read

Read a value at a specific key

Method

GET

Response

{ "statusCode": 200, "value": <ANY_VALUE> }

Delete

Delete a value at a specific key

Method

DELETE

Response

{ "statusCode": 200, "message": "key destroyed" }

Eventual consistency

Data synchronisation is supported accross several instances of pocdb referencing the same persisted data file. A .pocdb log file is saved under the same location than the persisted data file. Real-time updates to .pocdb log file are performed to achieve synchronization accross any number of pocdb instances referencing the data file. Synchronization time is of 1 second, meaning eventual consistency for pocdb is reached after 1 second at most.

License

MIT