Keyvify
A simple key-value database supporting various dialects

📦 Installation
$ npm install keyvify
and also a Dialect
$ npm i pg pg-hstore
$ npm i mysql2
$ npm i mariadb
$ npm i sqlite3
$ npm i better-sqlite3
$ npm i mongoose
$ npm i tedious
âť” But why Keyvify?
- Simple as this
- Easy for beginners
- Persistent
- Promise-based
- Supports multiple databases
- Support for dot notation
- Import and Export the data to a simple JSON file
- Store almost anything (Refer all the types here)
- Quick setup (When using better-sqlite3 or sqlite)
- In-built caching using NodeJS
Map
- Support for custom Dialects and Cache store
- Typescript support
- Works from NodeJS v8 (might vary)
🤔 How does it work?
- Keyvify internally uses Better SQLite for SQLite, Sequelize for other SQL related-databases, Mongoose for MongoDB
- Serializes all the data into
string to store in database. Uses sequelize-javascript by default due to limitation in JSON.stringify
- Keyvify caches the data when something is
set, get, delete and fetch
đź“„ Documentation
Refer here
đź“™ Guides
Refer here
✏️ Basic Example
const { Keyvify } = require("keyvify");
const database = Keyvify("my_super_awesome_database", {
dialect: "better-sqlite",
storage: __dirname + "/../database.sqlite",
});
const init = async () => {
await database.connect();
await database.set("hello", "world");
await database.get("hello");
await database.all();
database.entries();
await database.delete("hello");
await database.truncate();
await database.disconnect();
};
database.on("connect", () => console.log("Connected!"));
database.on("disconnect", () => console.log("Disconnected!"));
database.on("valueSet", (pair) => console.log("Some data was set:", pair));
database.on("valueGet", (pair) => console.log("Some data was got:", pair));
database.on("valueDelete", (key) => console.log("Some key was deleted:", key));
database.on("valueUpdate", (pair) =>
console.log("Some data was changed:", pair)
);
database.on("valueFetch", (pairs) =>
console.log("All data were fetched:", pairs)
);
database.on("truncate", (amount) =>
console.log("Database was emptied:", amount)
);
Click here for more examples
đźš© Resources