verse.db
verse.db isn't just a database, it's your universal data bridge. Designed for unmatched flexibility, security, and performance, verse.db empowers you to manage your data with ease.

Introduction
The verse.db package is a powerful utility designed to simplify the management of data files within a designated folder. It offers methods for adding, editing, deleting, and retrieving data from JSON, YAML, SQL & more files. This wiki provides detailed examples and usage scenarios to help you effectively implement the verse.db package in your projects.
Installation
To begin using the verse.db package, you'll need to install it via npm. Open your terminal and run the following command:
npm install verse.db
yarn add verse.db
pnpm add verse.db
bun add verse.db
Usage
Import and Initialization
- to get started setup the database connection uding .connect method
const versedb = require("verse.db");
import versedb from "verse.db";
const adapterOptions = {
adapter: "json" | "yaml" | "sql",
dataPath: "./Data",
devLogs: { enable: true, path: "./Logs" },
encryption: { enable: false, secret: "" },
backup: { enable: false, path: "", retention: 0 },
};
const db = new versedb.connect(adapterOptions);
Note*: You can make a multiple database files in the same time with/without the same intializer
Load a data file
- You can load any data file using .load method
const dataname = "data";
const result = await db.load(dataname);
console.log(result);
Add Data
- To add data, use the .add method, for example:
const data = [
{ _id: "1234", name: "John" },
{ _id: "5678", name: "Jane" },
];
const dataname = "users";
const result = await db.add(dataname, data);
result:
{
"acknowledged": true,
"message": "Data added successfully.",
}
find data
- Find the data you want with the query you want using .find method:
const data = [
{ _id: "1234", name: "John" },
{ _id: "5678", name: "Jane" },
];
const query = { name: "John" };
const dataname = "users";
const result = await db.find(dataname, query);
expect(result).toEqual({
acknowledged: true,
message: "Found data matching your query.",
results: { _id: "1234", name: "John" },
});
Remove data
- Remove the data you want with the query you want using .remove method:
const data = [
{ _id: "1234", name: "John" },
{ _id: "5678", name: "Jane" },
];
const query = { _id: "1234" };
const dataname = "users";
const result = await db.remove(dataname, query);
expect(result).toEqual({
acknowledged: true,
message: "1 document(s) removed successfully.",
results: null,
});
Update
- Update the data you want with the query you want using .update method:
const data = [
{ _id: "1234", name: "John" },
{ _id: "5678", name: "Jane" },
];
const updateQuery = { $set: { name: "Mike" } };
const dataname = "users";
const result = await db.update(dataname, { name: "John" }, updateQuery);
expect(result).toEqual({
acknowledged: true,
message: "1 document(s) updated successfully.",
results: {
_id: "1234",
name: "Mike",
},
});
For Further Usages (Other Adapters And Functions)
Conclusion
Verse.db stands as a cutting-edge database management platform engineered to effortlessly handle JSON, YAML, and SQL data formats. While presently we don't provide server hosting for user data, rest assured, it's on our roadmap and will soon become a reality. Furthermore, we're dedicated to broadening our support for diverse data formats, ensuring we meet and exceed your evolving needs and expectations. Stay tuned for an even more feature-rich experience!