{"id":15289027,"url":"https://github.com/sosuisen/git-documentdb","last_synced_at":"2025-10-03T13:31:23.706Z","repository":{"id":46240151,"uuid":"337468601","full_name":"sosuisen/git-documentdb","owner":"sosuisen","description":"Offline-first Database that Syncs with Git","archived":false,"fork":false,"pushed_at":"2023-05-07T09:45:52.000Z","size":3931,"stargazers_count":48,"open_issues_count":13,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-09-16T15:36:25.048Z","etag":null,"topics":["documentdb","electron","git","github","isomorphic-git","nodegit","offline-first","sync","typescript"],"latest_commit_sha":null,"homepage":"https://gitddb.com/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sosuisen.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}},"created_at":"2021-02-09T16:36:59.000Z","updated_at":"2025-07-03T17:27:13.000Z","dependencies_parsed_at":"2024-06-21T13:02:16.069Z","dependency_job_id":"a806a0c3-c2a1-4ef7-a35e-9f1ef8051df4","html_url":"https://github.com/sosuisen/git-documentdb","commit_stats":{"total_commits":1674,"total_committers":1,"mean_commits":1674.0,"dds":0.0,"last_synced_commit":"814442b00da0e0180142ea727c74f8a6ba5a62c8"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"purl":"pkg:github/sosuisen/git-documentdb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sosuisen%2Fgit-documentdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sosuisen%2Fgit-documentdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sosuisen%2Fgit-documentdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sosuisen%2Fgit-documentdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sosuisen","download_url":"https://codeload.github.com/sosuisen/git-documentdb/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sosuisen%2Fgit-documentdb/sbom","scorecard":{"id":838775,"data":{"date":"2025-08-11","repo":{"name":"github.com/sosuisen/git-documentdb","commit":"814442b00da0e0180142ea727c74f8a6ba5a62c8"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Mozilla Public License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"39 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-h5c3-5r3r-rr8q","Warn: Project is vulnerable to: GHSA-rmvr-2pp2-xj38","Warn: Project is vulnerable to: GHSA-xx4v-prfh-6cgc","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97","Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-qrpm-p2h7-hrv2","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g","Warn: Project is vulnerable to: GHSA-8g77-54rh-46hx","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-wpg7-2c88-r8xv","Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-pq67-2wwv-3xjx","Warn: Project is vulnerable to: GHSA-8cj5-5rvv-wf4v","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-w5p7-h5w8-2hfq","Warn: Project is vulnerable to: GHSA-qgmg-gppg-76g5","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T19:53:49.768Z","repository_id":46240151,"created_at":"2025-08-23T19:53:49.768Z","updated_at":"2025-08-23T19:53:49.768Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275989255,"owners_count":25565645,"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","status":"online","status_checked_at":"2025-09-19T02:00:09.700Z","response_time":108,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["documentdb","electron","git","github","isomorphic-git","nodegit","offline-first","sync","typescript"],"created_at":"2024-09-30T15:56:39.186Z","updated_at":"2025-10-03T13:31:23.670Z","avatar_url":"https://github.com/sosuisen.png","language":"TypeScript","readme":"\u003cimg alt=\"GitDocumentDB\" src=\"https://github.com/sosuisen/git-documentdb/blob/main/assets/git-documentdb_icon-128x128.png\" width=60 height=60 align=\"left\"\u003e \n\n# [GitDocumentDB](https://gitddb.com)\n [![npm version](https://img.shields.io/npm/v/git-documentdb)](https://www.npmjs.com/package/git-documentdb)\n [![License: MPL 2.0](https://img.shields.io/github/license/sosuisen/git-documentdb)](LICENSE)\n [![Coverage Status](https://img.shields.io/coveralls/github/sosuisen/git-documentdb)](https://coveralls.io/github/sosuisen/git-documentdb?branch=main)\n\nTypeScript Ready Offline-first Database that Syncs with Git\n\nUse GitDocumentDB to ...\n\n:nut_and_bolt: Develop offline-capable applications using Git.\n\n:green_book: Manage JSON documents in Git repository by CRUD and collection APIs. \n\n:rocket: Synchronize automatically with remote repositories.\n\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;*(No need to resolve conflicts manually!)*\n\n:arrows_counterclockwise: Integrate CI/CD pipelines through GitHub.\n\n:dromedary_camel: Get the revision history of a document.\n\n[(More...)](https://gitddb.com/)\n\n# API\nhttps://gitddb.com/docs/api/git-documentdb.gitdocumentdb\n\n# Usage\n## Getting started\n### **Prerequisite**\nNode.js v12 - v16\n### **Installation**\n```\nnpm i git-documentdb\n```\n\n## Import\n```typescript\nimport { GitDocumentDB } from 'git-documentdb';\n\nconst gitDDB = new GitDocumentDB({\n  db_name: 'db01', // Git working directory\n});\n```\n\n## Basic CRUD\n```typescript\n  /**\n   * Open a database\n   */\n  await gitDDB.open(); \n\n\n  /**\n   * Create a document\n   */ \n  await gitDDB.put({ _id: 'nara', flower: 'cherry blossoms', season: 'spring' });\n\n  console.log(`$ gitDDB.put({ flower: 'cherry blossoms' ... }) # Create`);\n  console.log(await gitDDB.get('nara')); \n  // log: { _id: 'nara', flower: 'cherry blossoms', season: 'spring' }\n\n  /**\n   * Update a document if it exists.\n   */\n  await gitDDB.put({ _id: 'nara', flower: 'double cherry blossoms', season: 'spring' }); \n\n  /**\n   * Read a document\n   */\n  const doc = await gitDDB.get('nara');\n\n  console.log(`\\n$ gitDDB.put({ flower: 'double cherry blossoms' ... }) # Update`);\n  console.log(doc);\n  // log: { flower: 'double cherry blossoms', season: 'spring', _id: 'nara' }\n\n  /**\n   * Delete a document\n   */\n  await gitDDB.delete('nara');\n\n  console.log(`\\n$ gitDDB.delete('nara') # Delete`);\n  console.log(await gitDDB.get('nara'));\n  // log: undefined\n  \n  /**\n   * Use an auto-generated _id\n   */\n   const appleResult = await gitDDB.put({ name: 'apple' }); // _id does not exist.\n   const apple = await gitDDB.get(appleResult._id);\n   console.log(`\\n_id of the JSON document is automatically generated`);\n   console.log(apple);\n   // log: { name: 'apple', _id: 'XXXXXXXXXXXXXXXXXXXXXXXXXX' }\n```\n\n## Revisions\n```typescript\n  /**\n   * Revisions \n   * \n   * getOldRevision(id, 2) returns a document two revisions older than the latest.\n   * \n   * #0 (latest): undefined (deleted)\n   * #1: 'double cherry blossoms'\n   * #2: 'cherry blossoms'\n   */\n  const oldDoc = await gitDDB.getOldRevision('nara', 2); \n\n  console.log(`\\n$ gitDDB.get('nara', 2) # Get a document two revisions older than the latest.`);\n  console.log(oldDoc);\n  // log: { _id: 'nara', flower: 'cherry blossoms', season: 'spring' }\n```\n\n## Synchronization\n```typescript\n  await gitDDB.sync({\n    live: true,\n    remote_url: 'https://github.com/enter_your_accunt_name/git-documentdb-example.git',\n    connection: { type: 'github', personal_access_token: 'Enter your personal access token with checked [repo]' },\n  });\n```\n(You can find more examples in [examples/src/sync.ts](https://github.com/sosuisen/git-documentdb/blob/main/examples/src/sync.ts))\n\n## Prefix search\n```typescript\n /**\n    Create documents under sub-directories\n\n    git-documentdb\n    └── db01\n        ├── nara\n        │   ├── nara_park.json\n        │   └── tsukigase.json\n        └── yoshino\n            └── mt_yoshino.json\n\n  */\n  await gitDDB.put({ _id: 'nara/nara_park', flower: 'double cherry blossoms' });\n  await gitDDB.put({ _id: 'nara/tsukigase', flower: 'Japanese apricot' });\n  await gitDDB.put({ _id: 'yoshino/mt_yoshino', flower: 'cherry blossoms' });\n\n  // Read\n  const flowerInYoshino = await gitDDB.get('yoshino/mt_yoshino');\n  console.log(flowerInYoshino);\n  // log:: { flower: 'cherry blossoms', _id: 'yoshino/mt_yoshino' }\n\n  /**\n   * Prefix search\n   * \n   * Read all the documents whose IDs start with the prefix.\n   */ \n  const flowersInNara = await gitDDB.find({ prefix: 'nara/' });\n  console.log(flowersInNara);\n  /* log:\n    [\n      { flower: 'double cherry blossoms', _id: 'nara/nara_park' },\n      { flower: 'Japanese apricot', _id: 'nara/tsukigase' }\n    ]\n  */\n \n  // destroy() closes DB and removes\n  // both the Git repository and the working directory.\n  await gitDDB.destroy();\n```\n\n## Collections\n```typescript\n  // Try sub-directories again by another way.\n  await gitDDB.open();\n  // Use Collection Class to make them easier.\n  const nara = gitDDB.collection('nara');\n  const yoshino = gitDDB.collection('yoshino');\n  await nara.put({ _id: 'nara_park', flower: 'double cherry blossoms' });\n  await nara.put({ _id: 'tsukigase', flower: 'Japanese apricot' });\n  await yoshino.put({ _id: 'mt_yoshino', flower: 'cherry blossoms' });\n\n  // Read\n  const flowerInYoshinoCollection = await yoshino.get('mt_yoshino');\n  console.log(flowerInYoshinoCollection);\n  // { flower: 'cherry blossoms', _id: 'mt_yoshino' }\n\n  // Read all the documents in nara collection\n  const flowersInNaraCollection = await nara.find();\n  console.log(flowersInNaraCollection);\n  /* log: \n    [\n      { flower: 'double cherry blossoms', _id: 'nara_park' },\n      { flower: 'Japanese apricot', _id: 'tsukigase' }\n    ]\n  */  \n  await gitDDB.close();\n```\n(You can find more examples in [examples/src/collection.ts](https://github.com/sosuisen/git-documentdb/blob/main/examples/src/collection.ts))\n\n# Examples:\nSee [examples]((https://github.com/sosuisen/git-documentdb/blob/main/examples/)) directory.\n```\n$ npm run build\n$ cd examples\n$ npm i\n$ npm start\n$ npm run sync\n$ npm run collection\n```\n\n# Continuous Deployment (CD) using GitDocumentDB\n\nhttps://github.com/sosuisen/sosuisen-my-inventory-gatsby\n\n# App using GitDocumentDB\n\nhttps://github.com/sosuisen/inventory-manager\n\n\n# Roadmap\n\n- v0.1 Basic CRUD :feet:\n- v0.2 Group and Search :feet:\n  - Collections :feet:\n  - Prefix search :feet:\n- v0.3 Synchronization :feet:\n  - Synchronization with GitHub :feet:\n  - Revisions :feet:\n  - Automated conflict resolution :feet:\n  - Automated JSON diff and patch :feet:\n  - Automated combining of inconsistent repositories :feet:\n- v0.4 Many data types and connection methods\n  - API renewal to manage any data types :feet:\n  - Remove native module (NodeGit) from default install :feet:\n  - Add plugin system for remote connection (isomorphic-git or NodeGit) :feet:\n  - Connect with SSH key pair :feet:\n  - Add Front-Matter-Markdown format :feet:\n- v0.5 Search\n  - Indexed Search :dog2:(Next)\n- Until v1.0\n  - Connect to GitHub with OAuth\n  - Work on browser\n  - Sync any data types\n  - Replication\n  - Transaction (bulk)\n  \n  - GitLab and Bitbucket\n  - Push server\n  - Migration\n\n(https://github.com/sosuisen/git-documentdb/projects/2)\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsosuisen%2Fgit-documentdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsosuisen%2Fgit-documentdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsosuisen%2Fgit-documentdb/lists"}