{"id":22594701,"url":"https://github.com/nucleoidai/datastore","last_synced_at":"2026-04-09T16:50:07.484Z","repository":{"id":63589062,"uuid":"568529797","full_name":"NucleoidAI/datastore","owner":"NucleoidAI","description":"On-Chain Data Store for JavaScript Objects","archived":false,"fork":false,"pushed_at":"2023-07-20T01:57:34.000Z","size":872,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-11T04:39:42.240Z","etag":null,"topics":["database","javascript","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NucleoidAI.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}},"created_at":"2022-11-20T20:11:03.000Z","updated_at":"2024-02-26T20:06:21.000Z","dependencies_parsed_at":"2024-02-12T16:47:29.570Z","dependency_job_id":null,"html_url":"https://github.com/NucleoidAI/datastore","commit_stats":null,"previous_names":["nucleoidai/datastore","nucleoidjs/datastore"],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NucleoidAI%2Fdatastore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NucleoidAI%2Fdatastore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NucleoidAI%2Fdatastore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NucleoidAI%2Fdatastore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NucleoidAI","download_url":"https://codeload.github.com/NucleoidAI/datastore/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246085632,"owners_count":20721211,"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","nodejs"],"created_at":"2024-12-08T10:07:09.854Z","updated_at":"2025-10-18T16:11:59.892Z","avatar_url":"https://github.com/NucleoidAI.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eNucleoid Data Store\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.apache.org/licenses/LICENSE-2.0\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Apache-2.0-yellow?style=for-the-badge\u0026logo=apache\" alt=\"License\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@nucleoidjs/datastore\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/NPM-red?style=for-the-badge\u0026logo=npm\" alt=\"NPM\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://discord.com/invite/eWXFCCuU5y\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Discord-lightgrey?style=for-the-badge\u0026logo=discord\" alt=\"Discord\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n[![Banner](.github/media/banner.png)](http://nucleoid.com/)\n\n\u003cp align=\"center\"\u003e\n  On-Chain Data Store for JavaScript Objects\n\u003c/p\u003e\n\n\u003cbr/\u003e\n\nNucleoid Data Store persists sequent JavaScript objects with the blockchain style encryption. Each object is sequentially encrypted with each other and the data store saves those hashes in managed-files. Each transaction is completed in sub-millisecond and any changes in hashes throws an error so that the final state of objects is guaranteed, and objects cannot be visible without unchanged hashes and the key.\n\nIn event-driven architecture or CQRS, it is common to store event objects instead of storing actual state, but eventually the application has to run populate the state at boot up. This on-chain data store provides persistency in this structure with fast read and write at the same time, but requires state calculation as a trade-off.\n\n### How is hash generated?\n\nIt uses hard-coded genesis token as a first hash in the chain. As it receives more objects, the data store uses the previous hash as well as the key to generate next hash in the chain. It uses Node.js built-in `crypto` package with a configurable algorithm.\n\n## Hello World\n\nInstalling and initialize Nucleoid Data Store:\n\n```javascript\nconst datastore = require(\"@nucleoidjs/datastore\");\n\ndatastore.init({\n  id: \"datastore1\",\n  path: \"~/.nuc/data\",\n  key: \"0c3Yc2KDj0rQWq9aJEnOGNzsNb4IrHPq\",\n});\n```\n\nWriting:\n\n```javascript\ndatastore.write({ test: 123 });\ndatastore.write({ test: 456 });\n```\n\nReading:\n\n```javascript\nconst data = datastore.read();\nconsole.log(data);\n\n// [{ test: 123 }, { test: 456 }]\n```\n\nExample of on-chain data in managed-files:\n\n```\nff2024a65a339abd3c77bb069da38717:10812ca4ed497e3167684f9b0316b5cf72992adffd9ed8bd97e08f321e117daf367b012\na1a521479a43e1b16ce0ecc1671fbd8d:1ceb5211efadecc791c22a010752ecdf626764a71c4bc80c74f9d3ba6adb88d2e7cedcf\n20033f1556383ce5b911436aa76381a8:543a50ae5072aa64acb0ef7c307aa53f3aaea042023704362305bedfafd721c9f918740\nee8a894958d4bb372d1a9e63335ccee7:4834d1e04e6b234135ae896c0057186df4c820b9b25fa6ce153e03f89c63b905208ba07\ndc2d6d47071db41845fa8631b131bef5:0ec5427dd957ccb46fbd6884290eb0de9696102405fc606d2acf56e059ed3e827610e6a\n3ef42a5927c4e231f17323619d6a60d1:e793031d12c9e5b10708c62d49a56c77fd9ef463606609036d22af83490106c213224e5\n3a016c3e71238462f8b42ebb733e5856:cb1595d06424c7e1ec3c353f5eee2d6cf1b804306dcdadb09a6be9a066b89581270464d\n```\n\n## Benchmark\n\n![benchmark](.github/media/benchmark.png)\n\nUbuntu 22.04 on AWS EC2 t2.micro with [benchmark.js](benchmark.js)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnucleoidai%2Fdatastore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnucleoidai%2Fdatastore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnucleoidai%2Fdatastore/lists"}