{"id":13394410,"url":"https://github.com/mapbox/hubdb","last_synced_at":"2025-07-07T05:34:26.280Z","repository":{"id":26933073,"uuid":"30395470","full_name":"mapbox/hubdb","owner":"mapbox","description":"a github-powered database","archived":false,"fork":false,"pushed_at":"2023-03-24T09:29:41.000Z","size":25,"stargazers_count":268,"open_issues_count":0,"forks_count":24,"subscribers_count":128,"default_branch":"master","last_synced_at":"2025-06-25T20:04:59.481Z","etag":null,"topics":["banished"],"latest_commit_sha":null,"homepage":"https://github.com/mapbox/hubdb/tree/db","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mapbox.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}},"created_at":"2015-02-06T04:42:35.000Z","updated_at":"2025-06-19T15:51:58.000Z","dependencies_parsed_at":"2024-01-13T17:30:14.331Z","dependency_job_id":null,"html_url":"https://github.com/mapbox/hubdb","commit_stats":{"total_commits":21,"total_committers":4,"mean_commits":5.25,"dds":"0.38095238095238093","last_synced_commit":"2cf6ff4327f3d68c3f539d86a5361f0143b3a91c"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/mapbox/hubdb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fhubdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fhubdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fhubdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fhubdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mapbox","download_url":"https://codeload.github.com/mapbox/hubdb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fhubdb/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261960520,"owners_count":23236584,"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":["banished"],"created_at":"2024-07-30T17:01:18.459Z","updated_at":"2025-06-29T16:02:04.934Z","avatar_url":"https://github.com/mapbox.png","language":"JavaScript","readme":"# hubdb\n\n[![build status](https://secure.travis-ci.org/mapbox/hubdb.png)](http://travis-ci.org/mapbox/hubdb)\n\na github-powered database\n\n\n### `Hubdb(options)`\n\nCreate a new Hubdb instance. This is a database-like wrapper for a\nbranch of a GitHub repository that treats JSON objects in that branch\nas documents.\n\nHubdb shines where GitHub itself makes sense: you can take\nadvantage of GitHub's well-architected APIs and user permissions. A\ngood example of hubdb in practice is in [stickshift](https://github.com/mapbox/stickshift),\nwhere it powers a lightweight query storage for an analytics app.\n\nTakes a configuration object with options:\n\n* `username` the user's name of the repository.\n  this is not necessary the user that's logged in.\n* `repo` the repository name\n* `branch` the branch of the repository to use as a\n  database.\n* `token` a GitHub token. You'll need to get this\n  by OAuth'ing into GitHub or use an applicaton token.\n\n\n### Parameters\n\n| parameter | type   | description |\n| --------- | ------ | ----------- |\n| `options` | Object |             |\n\n\n### Example\n\n```js\nvar db = Hubdb({\n token: 'MY_TOKEN',\n username: 'mapbox',\n repo: 'hubdb',\n branch: 'db'\n});\ndb.add({ grass: 'green' }, function() {\n  db.list(function(err, res) {\n    // [{\n    //   path: '2e959f35c6022428943b9c96d974498d.json'\n    //   data: { grass: 'green' }\n    // }]\n  });\n});\n```\n\n\n### `list(callback)`\n\nList documents within this database. If successful, the given\ncallback is called with an array of documents as\n`{ path: string, data: object }` objects.\n\n### Parameters\n\n| parameter  | type     | description                                                                           |\n| ---------- | -------- | ------------------------------------------------------------------------------------- |\n| `callback` | Function | called with (err, contents): contents is an array of `{ path: string, data: object }` |\n\n\n\n### `add(data, callback)`\n\nAdd a new object to the database. If successful, the callback is called\nwith (err, res) in which `res` reveals the id internally chosen\nfor this new item.\n\n\n### Parameters\n\n| parameter  | type     | description                   |\n| ---------- | -------- | ----------------------------- |\n| `data`     | Object   |                               |\n| `callback` | Function | called with (err, result, id) |\n\n\n\n### `remove(id, callback)`\n\nRemove an item from the database given its id  and a callback.\n\n\n### Parameters\n\n| parameter  | type     | description                   |\n| ---------- | -------- | ----------------------------- |\n| `id`       | String   |                               |\n| `callback` | Function | called with (err, result, id) |\n\n\n\n### `get(id, callback)`\n\nGet an item from the database given its id and a callback.\n\n\n### Parameters\n\n| parameter  | type     | description                                                    |\n| ---------- | -------- | -------------------------------------------------------------- |\n| `id`       | String   |                                                                |\n| `callback` | Function | called with (err, contents): contents are given as parsed JSON |\n\n\n\n### `update(id, data, callback)`\n\nUpdate an object in the database, given its id, new data, and a callback.\n\n\n### Parameters\n\n| parameter  | type     | description                     |\n| ---------- | -------- | ------------------------------- |\n| `id`       | String   |                                 |\n| `data`     | Object   | as any JSON-serializable object |\n| `callback` | Function | called with (err, result, id)   |\n\n\n## Installation\n\nRequires [nodejs](http://nodejs.org/).\n\n```sh\n$ npm install hubdb\n```\n\n## Tests\n\n```sh\n$ npm test\n```\n\n\n","funding_links":[],"categories":["JavaScript","others"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapbox%2Fhubdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmapbox%2Fhubdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapbox%2Fhubdb/lists"}