{"id":19003426,"url":"https://github.com/i3raby/json-database","last_synced_at":"2025-06-17T07:39:35.617Z","repository":{"id":244918465,"uuid":"816686430","full_name":"i3raby/JSON-Database","owner":"i3raby","description":"Simple JSON Database using Node.js with fs module. This repository provides a lightweight database solution using JSON files, ideal for small-scale applications where a full-scale database might be overkill. Built for simplicity and ease of integration with Node.js projects.","archived":false,"fork":false,"pushed_at":"2024-06-18T08:12:44.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-01T19:12:58.389Z","etag":null,"topics":["fs","json-database"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/i3raby.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-18T08:04:26.000Z","updated_at":"2024-08-10T11:11:19.000Z","dependencies_parsed_at":"2024-06-18T09:44:21.745Z","dependency_job_id":null,"html_url":"https://github.com/i3raby/JSON-Database","commit_stats":null,"previous_names":["i3raby/json-database"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i3raby%2FJSON-Database","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i3raby%2FJSON-Database/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i3raby%2FJSON-Database/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i3raby%2FJSON-Database/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/i3raby","download_url":"https://codeload.github.com/i3raby/JSON-Database/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240027412,"owners_count":19736209,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fs","json-database"],"created_at":"2024-11-08T18:19:02.188Z","updated_at":"2025-02-21T13:44:10.545Z","avatar_url":"https://github.com/i3raby.png","language":"JavaScript","readme":"# Simple JSON Database\nA lightweight and easy-to-use JSON-based database management system implemented in Node.js. This project provides a simple way to manage key-value pairs, including nested objects and arrays, in a JSON file. Ideal for small projects, prototyping, and learning purposes.\n\n## Features\n\n- **CRUD Operations →** Create, read, update, and delete data effortlessly.\n- **Data Types →** Supports various data types including strings, numbers, arrays, and objects.\n- **Backup Functionality →** Backup the entire database to a separate JSON file.\n- **Filtering →** Retrieve data based on key patterns (startsWith, endsWith, includes).\n- **Array Operations →** Push and unpush elements from arrays stored in the database.\n- **Data Type Checking →** Get the type of stored data (typeof).\n- **Clearing Data →** Clear the entire database with a single command.\n- **Initialization →** Automatically initializes the database file if it does not exist.\n\n## Installation\n\n1. Ensure you have [Node.js](https://nodejs.org/en/download/package-manager) installed.\n2. Clone the repository\n\n```\ngit clone https://github.com/i3raby/JSON-Database.git\n```\n\n3. Navigate to the project directory:\n\n```\ncd JSON-Database\n```\n\n4. Run the project (For save a data)\n\n```\nnode index.js\n```\n\n## Usage\n\n```js\nconst db = require('./Database');\n\n// Setting a value\ndb.set('username', 'i3raby');\n\n// Getting a value\nconsole.log(db.get('username')); // Output: i3raby\n\n// Adding to a value\ndb.add('userBalance', 100);\n\n// Subtracting from a value\ndb.subtract('userBalance', 50);\n\n// Checking if a key exists\nconsole.log(db.has('username')); // Output: true\n\n// Deleting a key\ndb.delete('username');\n\n// Backing up the database\ndb.backup('backup.json');\n\n// Fetching a value\nconsole.log(db.fetch('userBalance')); // Output: 50\n\n// Filtering keys that start with a specific string\nconsole.log(db.startsWith('user')); // Output: [ { userBalance: 50 } ]\n\n// Converting the database to JSON\nconsole.log(db.toJSON()); // Output: { userBalance: 50 }\n\n// Clearing the database\ndb.clear();\n\n// Converting the database to Array\nconsole.log(db.toArray()); // Output: [ { userBalance: 50 } ]\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fi3raby%2Fjson-database","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fi3raby%2Fjson-database","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fi3raby%2Fjson-database/lists"}