{"id":20062755,"url":"https://github.com/TaqsBlaze/OrbDB","last_synced_at":"2025-05-05T17:31:45.896Z","repository":{"id":240383921,"uuid":"802407698","full_name":"TaqsBlaze/OrbDB","owner":"TaqsBlaze","description":"A highly flexible ORM suitable for quick prototyping, OrbDB aims to allow you to change or update your schema with ease to suit your database changes without installing any other packages speeding up your development process","archived":false,"fork":false,"pushed_at":"2024-12-09T07:20:34.000Z","size":1130,"stargazers_count":2,"open_issues_count":6,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-25T18:47:12.039Z","etag":null,"topics":["database","javascript","json","nodejs","npm","orb","orm","orm-library","schema"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/orbdb","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/TaqsBlaze.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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-05-18T07:56:20.000Z","updated_at":"2024-12-09T07:20:38.000Z","dependencies_parsed_at":"2024-05-18T13:43:40.000Z","dependency_job_id":"a4d2dd03-a166-41fe-8e6a-972eaa3ae3fa","html_url":"https://github.com/TaqsBlaze/OrbDB","commit_stats":null,"previous_names":["taqsblaze/blazedb","taqsblaze/orbdb"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TaqsBlaze%2FOrbDB","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TaqsBlaze%2FOrbDB/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TaqsBlaze%2FOrbDB/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TaqsBlaze%2FOrbDB/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TaqsBlaze","download_url":"https://codeload.github.com/TaqsBlaze/OrbDB/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252542252,"owners_count":21764934,"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":["database","javascript","json","nodejs","npm","orb","orm","orm-library","schema"],"created_at":"2024-11-13T13:38:45.060Z","updated_at":"2025-05-05T17:31:45.878Z","avatar_url":"https://github.com/TaqsBlaze.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# orbDB\r\n[![OrbDB Test CI](https://github.com/TaqsBlaze/OrbDB/actions/workflows/node.js.yml/badge.svg)](https://github.com/TaqsBlaze/OrbDB/actions/workflows/node.js.yml)\r\n\r\n![alt text](https://raw.githubusercontent.com/TaqsBlaze/BlazeDB/refs/heads/main/image/orb.webp)\r\n\r\n## Installation\r\n`npm i orbdb@latest`\r\n\r\n----\r\n## json Adapter\r\n\r\n### How to us\r\n\r\n\r\n```\r\nconst OrbDB = require('orb'); \r\nconst OrbDBSchema = require('orb/schema');\r\nconst fs = require('fs').promises;\r\nconst path = require('path');\r\n\r\n// Define JSON Adapter\r\nconst adapter = require('orb/adapters/jsonAdapter');\r\nconst dbPath = path.join(__dirname, './db.json');\r\n\r\nlet orbDB;\r\n\r\norbDB = new OrbDB.Json(new adapter(dbPath));\r\nconst schemaInstance = new OrbDBSchema(orbDB);\r\n\r\n// Define your model here\r\nconst userModel = {\r\n  name: 'User',\r\n  fields: {\r\n  id: { type: 'number', required: true },\r\n  name: { type: 'string', required: true },\r\n  age: { type: 'number', required: false }\r\n  }\r\n};\r\n\r\n\r\nlet init = ( async () =\u003e {\r\n    // initialize database\r\n    schemaInstance.addModel(userModel);\r\n    await schemaInstance.createSchema();\r\n})\r\n\r\ninit();\r\n \r\n\r\n// Example usage: Add a user\r\nconst newUser = { id: 1, name: 'John Doe', age: 30 };\r\norbDB.insert(userModel.name, newUser);\r\n\r\nconst dbData = await fs.readFile(dbPath, 'utf8');\r\nconst jsonData = JSON.parse(dbData);\r\n\r\n// Fetch all users from the database\r\nconst users = await orbDB.get(userModel.name);\r\nconsole.log('Users:', users);\r\n\r\n// Example usage: Update a user\r\nconst updatedUser = { name: 'Blaze' };\r\norbDB.update(userModel.name, 1, updatedUser);\r\n\r\nconst dbData = await orbDB.get(userModel.name);\r\nconst updatedUserData = dbData.find(user =\u003e user.id === 1);\r\n\r\n// Fetch updated users from the database\r\nconst updatedUsers = await orbDB.get(userModel.name);\r\nconsole.log('Updated Users:', updatedUsers);\r\n\r\n// Example usage: Delete a user\r\norbDB.delete(userModel.name, 1);\r\n\r\nconst dbData = await orbDB.get(userModel.name);\r\nconst deletedUserData = dbData.find(user =\u003e user.id === 1);\r\n\r\n\r\n```\r\n# Sqlite Adapter\r\n### How to use\r\n```\r\nconst OrbDB = require('orb');\r\nconst sqlite3 = require('sqlite3').verbose();\r\nconst fs = require('fs').promises;\r\nconst path = require('path');\r\nconst adapterModule = require('orb/adapters/sqliteAdapter'); // Import the adapter class\r\n\r\nlet orbDB;\r\nlet sqliteAdapterInstance;\r\nconst dbPath = path.join(__dirname, './db.sqlite3');\r\n\r\nsqliteAdapterInstance = new adapterModule(dbPath); // Create an instance of SQLiteAdapter\r\nawait sqliteAdapterInstance.init(); // Initialize SQLite connection\r\n\r\n// Create the schema for the test table\r\nawait sqliteAdapterInstance.createSchema('test_table', {\r\n   id: { type: 'integer' },\r\n   name: { type: 'string' },\r\n   isActive: { type: 'boolean' },\r\n});\r\n\r\n// Initialize OrbDB with the SQLite adapter instance\r\norbDB = new OrbDB.Sql(sqliteAdapterInstance);\r\n\r\n// Add record \r\nconst newUser = { id: 1, name: 'John Doe', isActive: false };\r\nawait orbDB.insert('test_table', newUser);\r\n\r\n// Update reord\r\nconst updatedUser = { name: 'Blaze' };\r\nawait orbDB.update('test_table', 1, updatedUser);\r\n\r\n// Delete record\r\nawait orbDB.delete('test_table', 1);\r\n```\r\n\r\n# Hashing data\r\n### how to use:\r\n```\r\nconst HashUtility = require(\"orbdb/utils/hash\");\r\n\r\nconst sampleData = \"Data to be hashed\";\r\nconst hash = HashUtility.hash(sampleData);\r\nconst isMatch = HashUtility.verify(sampleData, hash);\r\n\r\nif(isMatch){\r\n   console.log(\"Hash match\");\r\n\r\n}\r\n```\r\n\r\n# Sanitizing Data\r\n\r\n```\r\nAdded data sanitization. special characters from input data will now be striped and only clean data is stored in the database\r\nmaking sure your system is secure and data integrity is intact \r\n```\r\n### Adaptors:\r\n```\r\nNow json and sqlite adapters are fully functional and ready for use\r\n```\r\n# Why OrbDB?\r\n\r\nHere are the advantages of using **OrbDB**, based on its features and design principles:\r\n\r\n### 1. **JSON and SQLite Adapter Support**  \r\n   OrbDB allows developers to choose between lightweight JSON-based storage or robust SQLite databases, offering flexibility for various project requirements.\r\n\r\n### 2. **Dynamic Schema Management**  \r\n   - OrbDB provides dynamic schema creation, making it easier to define and manage models directly within your application.  \r\n   - Developers can work with multiple models simultaneously without additional setup.\r\n\r\n### 3. **Custom Session Management**  \r\n   - With its session class, OrbDB introduces commit and rollback functionality, making it easier to manage transactions and ensure data integrity.\r\n\r\n### 4. **Simplified Development**  \r\n   - By abstracting away database operations, OrbDB lets developers focus on writing application logic rather than low-level database queries.\r\n\r\n### 5. **Auto Incrementing IDs**  \r\n   - Automatically assigns and increments IDs for entries in tables, reducing the overhead of managing primary keys.\r\n\r\n### 6. **Error Handling and Validation**  \r\n   - Ensures schema compliance by validating data types and properties at runtime.  \r\n   - Provides meaningful error messages, helping developers debug effectively.\r\n\r\n### 7. **Cross Platform Compatibility**  \r\n   - Designed to work seamlessly across operating systems, including Linux, Windows, and MacOS.\r\n\r\n### 8. **Lightweight and Scalable**  \r\n   - OrbDB is ideal for small to medium-sized applications and can scale effectively by switching between adapters.\r\n\r\n### 9. **Easy Integration**  \r\n   - With a modular design, OrbDB can be integrated into existing applications with minimal effort.  \r\n   - Future-proofed for additional adapters or features, making it a long-term investment.\r\n\r\n### 10. **Developer Friendly APIs**  \r\n   - Intuitive and concise APIs make it easier for developers to perform operations like inserts, updates, and schema management without a steep learning curve.\r\n\r\n### 11. **Open Source and Community Driven**  \r\n   - The project being open source fosters community contributions, ensuring continuous improvement and access to a wider knowledge base.\r\n\r\nThese advantages position OrbDB as a versatile ORM that caters to both beginner and experienced developers, promoting productivity and efficiency. It is particularly appealing for projects requiring lightweight and flexible data management solutions.\r\n\r\n## Contributing\r\n\r\nWe welcome contributions to the project! Here’s how you can help:\r\n\r\n### How to Contribute\r\n\r\n1. **Fork the Repository**: Click on the fork button at the top-right corner of this page. This will create a copy of the repository under your GitHub account.\r\n\r\n2. **Clone Your Fork**: Clone your forked repository to your local machine:\r\n    ```bash\r\n    git clone https://github.com/taqsblaze/OrbDB\r\n    cd OrbDB\r\n    ```\r\n\r\n3. **Create a New Branch**: It’s important to create a new branch for your changes:\r\n    ```bash\r\n    git checkout -b feature-branch-name\r\n    ```\r\n    (Use a descriptive name for your branch to indicate the feature or fix you are working on.)\r\n\r\n4. **Make Your Changes**: Open the project in your favorite code editor and make your changes.\r\n\r\n5. **Write Tests**: If you are adding new features or making changes, please ensure that your code is tested. Place your tests in the `test` directory.\r\n\r\n6. **Run Tests**: Make sure all tests pass. (Adjust this command based on your testing framework.)\r\n    ```bash\r\n    npm test\r\n    ```\r\n\r\n7. **Commit Your Changes**: Once you are satisfied with your changes, commit them with a descriptive message:\r\n    ```bash\r\n    git add .\r\n    git commit -m \"Add a brief description of your changes\"\r\n    ```\r\n\r\n8. **Push Your Changes**: Push your changes to your forked repository:\r\n    ```bash\r\n    git push origin feature-branch-name\r\n    ```\r\n\r\n9. **Create a Pull Request**: Go to the original repository where you want to propose your changes. Click on the \"Pull Requests\" tab, and then click on \"New Pull Request\". Select your branch and submit your pull request.\r\n\r\n\r\nFor more detailed instructions, please see [CONTRIBUTING.md](CONTRIBUTING.md).\r\n\u003chr\u003e\r\n\r\n### Code of Conduct\r\n\r\nPlease adhere to this project's [Code of Conduct](CODE_OF_CONDUCT.md) in all interactions.\r\n\r\n### Issues\r\n\r\nIf you encounter any problems, feel free to open an issue in the issues tab. Please provide as much detail as possible.\r\n\r\n### Discussion\r\n\r\nFor any major changes, please create an issue first to discuss it. This helps maintainers and collaborators understand your intentions.\r\n---\r\nnew featers soon\r\nThank you for your interest in contributing!\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTaqsBlaze%2FOrbDB","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTaqsBlaze%2FOrbDB","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTaqsBlaze%2FOrbDB/lists"}