Gathering detailed insights and metrics for deepbase
Gathering detailed insights and metrics for deepbase
Gathering detailed insights and metrics for deepbase
Gathering detailed insights and metrics for deepbase
⚡ DeepBase is the fastest and simplest way to add persistence to your projects while allowing you to view information in a user-friendly format.
npm install deepbase
Typescript
Module System
Node Version
NPM Version
71.8
Supply Chain
98.9
Quality
88.7
Maintenance
100
Vulnerability
99.6
License
JavaScript (100%)
Total Downloads
3,498
Last Day
3
Last Week
12
Last Month
91
Last Year
2,374
MIT License
3 Stars
32 Commits
2 Watchers
1 Branches
1 Contributors
Updated on Jun 04, 2025
Minified
Minified + Gzipped
Latest Version
2.0.4
Package Id
deepbase@2.0.4
Unpacked Size
24.78 kB
Size
7.21 kB
File Count
19
NPM Version
10.9.2
Node Version
22.15.0
Published on
Jun 04, 2025
Cumulative downloads
Total Downloads
DeepBase is the fastest and simplest way to add persistence to your projects while allowing you to view information in a user-friendly format.
A powerful JSON-based storage library that allows you to store, retrieve, and modify nested objects with ease.
1npm install deepbase
1import DeepBase from "deepbase"; // or... const DeepBase = require("deepbase"); 2const mem = new DeepBase({ name: "db" }); // db.json
1await mem.set("config", "lang", "en"); 2 3const configLang = await mem.get("config", "lang"); 4console.log(configLang); // "en"
1const path = await mem.add("user", { name: "martin" }); 2 3// add() will create a secure key (ie. "iKidAOCKds") 4console.log(path) // [ 'user', 'iKidAOCKds' ] 5 6const userName = await mem.get(...path, "name"); 7console.log(userName); // "martin"
1await mem.inc(...path, "balance", 160); 2await mem.inc(...path, "balance", 420); 3 4const userBalance = await mem.get(...path, "balance"); 5console.log(userBalance); // 580
1await mem.upd("config", "lang", v => v.toUpperCase()); 2const lang = await mem.get("config", "lang"); // EN
1await mem.add("user", { name: "anya" }); 2 3const userIds = await mem.keys("user") 4console.log(userIds) // [ 'iKidAOCKds', 'FEwORvJjs' ] 5 6console.log(await mem.get()) // db.json 7// { 8// config: { lang: 'EN' }, 9// user: { 10// iKidAOCKds: { name: 'martin', balance: 580 }, 11// FEwORvJjs: { name: 'anya' } 12// } 13// }
DeepBase supports custom JSON serialization, allowing for circular references in complex data structures.
CircularJSON
:1const CircularJSON = require('circular-json'); 2const db = new DeepBase({ 3 stringify: (obj) => CircularJSON.stringify(obj, null, 4), 4 parse: CircularJSON.parse 5}); 6 7await db.set("a", "b", { circular: {} }); 8await db.set("a", "b", "circular", "self", await db.get("a", "b"));
flatted
:1const { parse, stringify } = require('flatted'); 2const db = new DeepBase({ stringify, parse });
1const CryptoJS = require('crypto-js'); 2 3class DeepbaseSecure extends DeepBase { 4 constructor(opts) { 5 opts.stringify = (obj) => { 6 const iv = CryptoJS.lib.WordArray.random(128 / 8); 7 const encrypted = CryptoJS.AES.encrypt(JSON.stringify(obj), opts.encryptionKey, { iv }); 8 return iv.toString(CryptoJS.enc.Hex) + ':' + encrypted.toString(); 9 }; 10 11 opts.parse = (encryptedData) => { 12 const [ivHex, encrypted] = encryptedData.split(':'); 13 const iv = CryptoJS.enc.Hex.parse(ivHex); 14 const bytes = CryptoJS.AES.decrypt(encrypted, opts.encryptionKey, { iv }); 15 return JSON.parse(bytes.toString(CryptoJS.enc.Utf8)); 16 }; 17 18 super(opts); 19 } 20} 21 22// Create an encrypted database 23const secureDB = new DeepbaseSecure({ 24 name: "secure_db", 25 encryptionKey: 'your-secret-key' 26}); 27 28// Use it like a regular DeepBase instance 29await secureDB.set("users", "admin", { password: "secret123" });
Contributions to DeepBase are welcome! If you have an idea or a bug to report, please open an issue. If you would like to contribute to the code, please open a pull request.
DeepBase is a powerful and flexible solution for managing complex JSON structures.
🚀 Try it out and simplify your code today!
The MIT License (MIT)
Copyright (c) Martin Clasen
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
No vulnerabilities found.
No security vulnerabilities found.
Last Day
0%
3
Compared to previous day
Last Week
-20%
12
Compared to previous week
Last Month
-71%
91
Compared to previous month
Last Year
407.3%
2,374
Compared to previous year