nurdb
v1.0.5
Published
TR Database Module.
Maintainers
Readme
Here’s a clean, professional English README.md for your nurdb module — fully optimized for GitHub and npm.
# 📦 NurDB — Lightweight JSON File Database for Node.js
NurDB is a fast, dependency-free, file-based JSON database designed for small to medium Node.js applications. It offers a simple API for key–value storage, arrays, backups, numeric operations, and safe file handling.
✔ Zero dependencies ✔ Auto-file creation ✔ Push / Unpush support ✔ Array & number utilities ✔ Automatic JSON repair ✔ Smart error system (shows the caller file) ✔ Ideal for small apps, bots, and quick data storage
🚀 Installation
npm install nurdb📁 Getting Started
const Database = require("nurdb");
const db = new Database({
file: "data", // creates/uses data.json
autoFile: true, // create file if missing
jsonspaces: 2 // formatting
});# ⭐ Basic Usage
🔹 Set a value
db.set("username", "Eren");🔹 Get a value
db.get("username");
// "Eren"🔹 Delete a key
db.delete("username");🔹 Get all database content
db.all();# 📚 Array Operations
Add an item (push)
db.push("logs", "Server started.");Remove an item (unpush)
db.unpush("logs", "Server started.");Delete the entire array
db.unpush("logs", "delete");Get array safely (unique values)
db.getArray("tags"); # 🔢 Number Operations
Increase a number
db.add("coins", 5);Decrease a number
db.down("coins", 2);# 🔍 Find in Array
db.push("users", { id: 1, name: "Eren" });
const user = db.find("users", u => u.id === 1);
// { id: 1, name: "Eren" }# 🗄 Create a Backup
db.backup("backup_1");
// => backup_1.json# ⚠ Smart Error System
NurDB includes an enhanced error formatter. If you forget a value, the error will show the file that caused it:
Example:
/home/project/a.js: value is missing!This makes debugging faster and cleaner.
# 📘 Constructor Options
| Option | Description |
| ------------ | ----------------------------------- |
| file | JSON filename without extension |
| autoFile | Auto-create file if missing |
| jsonspaces | Pretty format indentation |
# 🧪 Full Example
const Database = require("nurdb");
const db = new Database({ file: "app", autoFile: true });
// strings
db.set("owner", "Eren");
// numbers
db.set("coins", 10);
db.add("coins", 5);
// arrays
db.push("messages", "Hello!");
db.push("messages", "World!");
// objects
db.set("settings", { theme: "dark" });
console.log(db.all());# 🧩 Features
- 🎯 Zero dependencies
- 🎯 File-based NoSQL structure
- 🎯 Automatic JSON validation & repair
- 🎯 Simple and intuitive API
- 🎯 Array & numeric helpers
- 🎯 Fast and lightweight
- 🎯 Backup support
- 🎯 Static file tracking (multiple instances)
- 🎯 Meaningful error messages
- 🎯 Perfect for Discord bots, small apps, prototypes
📜 License
This project is licensed under the ISC License.
You are free to use, modify, distribute, and sublicense this software, as long as the copyright notice and permission notice remain in all copies.
For more details, see the LICENSE file.
Made By Rexaly
