{"id":16556283,"url":"https://github.com/edenwareapps/jexidb","last_synced_at":"2025-04-12T08:32:52.669Z","repository":{"id":257820761,"uuid":"864300443","full_name":"EdenwareApps/jexidb","owner":"EdenwareApps","description":"JexiDB is a pure JS NPM library for managing data on disk efficiently, without the need for a server.","archived":false,"fork":false,"pushed_at":"2025-03-14T13:58:44.000Z","size":157,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T03:33:22.719Z","etag":null,"topics":["couchdb","data-management","database","db","dexie","dexiejs","embedded-database","fast-database","jexidb","local-storage","lowdb","nedb","nosql","offline-database","persistent-storage","pouchdb","simple-database"],"latest_commit_sha":null,"homepage":"https://edenware.app","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EdenwareApps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2024-09-27T22:16:34.000Z","updated_at":"2025-03-14T13:58:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"bf26961b-8dda-4694-ad36-5295fcf223b5","html_url":"https://github.com/EdenwareApps/jexidb","commit_stats":null,"previous_names":["edenwareapps/jexidb"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EdenwareApps%2Fjexidb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EdenwareApps%2Fjexidb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EdenwareApps%2Fjexidb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EdenwareApps%2Fjexidb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EdenwareApps","download_url":"https://codeload.github.com/EdenwareApps/jexidb/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248540354,"owners_count":21121344,"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":["couchdb","data-management","database","db","dexie","dexiejs","embedded-database","fast-database","jexidb","local-storage","lowdb","nedb","nosql","offline-database","persistent-storage","pouchdb","simple-database"],"created_at":"2024-10-11T20:04:04.628Z","updated_at":"2025-04-12T08:32:52.657Z","avatar_url":"https://github.com/EdenwareApps.png","language":"JavaScript","funding_links":["https://www.paypal.com/donate/?item_name=megacubo.tv\u0026cmd=_donations\u0026business=efox.web%40gmail.com"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg width=\"270\" src=\"https://edenware.app/jexidb/images/jexidb-logo-icon.jpg\" alt=\"JexiDB logo\" title=\"JexiDB logo\" /\u003e\n\u003c/p\u003e\n\n## Overview\n\nJexiDB is a lightweight, standalone JavaScript database manager that stores data on disk using either JSON format or V8 serialization. It supports indexing and querying capabilities for efficient data operations. Ideal for local Node.js projects as well as apps built with Electron or NW.js. Written in pure JavaScript, it requires no compilation and is compatible with both CommonJS and ESM modules.\n\n## Installation\n\nTo install JexiDB, you can use npm:\n\n```bash\nnpm install EdenwareApps/jexidb\n```\n\n## Usage\n\n### Creating a Database Instance\n\nTo create a new instance of the database, you need to provide a file path where the database will be stored and an optional configuration object for indexes.\n\n```javascript\n// const { Database } = require('jexidb'); // commonjs\n\nimport { Database } from 'jexidb'; // ESM\n\nconst db = new Database('path/to/database.jdb', { // file will be created if it does not already exist\n  v8: false, //\n  create: true, // create the file if it does not exist (default is true)\n  compress: false, // set to true to compress each entry\n  compressIndex: false, // set to true to compress the index only\n  indexes: { // keys to use in queries, only those key values ​​are kept in memory, so fewer specified keys lead to improved performance\n    id: 'number',\n    name: 'string'\n  }\n});\n```\nYou can [learn a bit more about these options at this link](https://github.com/EdenwareApps/jexidb/tree/main/test#readme).\n\n\n### Initializing the Database\n\nBefore using the database, you need to initialize it. This will load the existing data and indexes from the file.\n\n```javascript\nawait db.init();\n```\nOnly the values ​​specified as indexes are kept in memory for faster queries. JexiDB will never load the entire file into memory.\n\n\n### Inserting Data\n\nYou can insert data into the database by using the `insert` method. The data should be an object that contains the defined indexes. All object values will be saved into database.\n\n```javascript\nawait db.insert({ id: 1, name: 'John Doe' });\nawait db.insert({ id: 2, name: 'Jane Doe', anyArbitraryField: '1' });\n```\n\n### Querying Data\n\nThe `query` method allows you to retrieve data based on specific criteria. You can specify criteria for multiple fields.\n\n```javascript\nconst results = await db.query({ name: 'John Doe' }, { caseInsensitive: true });\nconsole.log(results); // [{ id: 1, name: 'John Doe' }]\n```\n\nNote: For now the query should be limited to using the fields specified as 'indexes' when instantiating the class.\n\n#### Querying with Conditions\n\nYou can use conditions to perform more complex queries:\n\n```javascript\nconst results = await db.query({ id: { '\u003e': 1 } });\nconsole.log(results); // [{ id: 2, name: 'Jane Doe' }]\n```\n\n### Updating Data\n\nTo update existing records, use the `update` method with the criteria to find the records and the new data.\n\n```javascript\nawait db.update({ id: 1 }, { name: 'John Smith' });\n```\n\n### Deleting Data\n\nYou can delete records that match certain criteria using the `delete` method.\n\n```javascript\nconst deletedCount = await db.delete({ name: 'Jane Doe' });\nconsole.log(`Deleted ${deletedCount} record(s).`);\n```\n\n### Iterating Through Records\n\nYou can iterate through records in the database using the `walk` method, which returns an async generator.\n\n```javascript\nfor await (const record of db.walk()) {\n  console.log(record);\n}\n```\n\n### Saving Changes\n\nAfter making any changes to the database, you need to save them using the `save` method. This will persist the changes to disk.\n\n```javascript\nawait db.save();\n```\n\n## Conclusion\n\nJexiDB provides a simple yet powerful way to store and manage data in JavaScript applications. With its indexing and querying features, you can build efficient data-driven applications.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"380\" src=\"https://edenware.app/jexidb/images/jexidb-mascot3.jpg\" alt=\"JexiDB mascot\" title=\"JexiDB mascot\" /\u003e\n\u003c/p\u003e\n\n# Contributing\n\nPlease, feel free to contribute to the project by opening a discussion under Issues section or sending your PR.\n\nIf you find this library useful, please consider making a donation of any amount via [PayPal by clicking here](https://www.paypal.com/donate/?item_name=megacubo.tv\u0026cmd=_donations\u0026business=efox.web%40gmail.com) to help the developer continue to dedicate himself to the project. ❤\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedenwareapps%2Fjexidb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedenwareapps%2Fjexidb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedenwareapps%2Fjexidb/lists"}