{"id":19062405,"url":"https://github.com/jkulton/gistkv","last_synced_at":"2025-04-25T08:58:32.535Z","repository":{"id":58105934,"uuid":"530028911","full_name":"jkulton/gistkv","owner":"jkulton","description":"Use GitHub gists as simple key-value databases","archived":false,"fork":false,"pushed_at":"2022-08-29T03:18:45.000Z","size":112,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-30T08:11:27.049Z","etag":null,"topics":["gist","key-value-store","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jkulton.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-29T01:41:04.000Z","updated_at":"2022-09-04T15:33:32.000Z","dependencies_parsed_at":"2022-08-29T09:30:36.826Z","dependency_job_id":null,"html_url":"https://github.com/jkulton/gistkv","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkulton%2Fgistkv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkulton%2Fgistkv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkulton%2Fgistkv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkulton%2Fgistkv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jkulton","download_url":"https://codeload.github.com/jkulton/gistkv/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249818854,"owners_count":21329647,"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":["gist","key-value-store","ruby"],"created_at":"2024-11-09T00:25:50.022Z","updated_at":"2025-04-24T08:28:06.038Z","avatar_url":"https://github.com/jkulton.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"gistkv.png\" width=100 height=100 /\u003e\n\n# GistKV\n\n[![Gem Version](https://badge.fury.io/rb/gistkv.svg)](https://badge.fury.io/rb/gistkv)\n\nUse GitHub gists as simple key-value databases\n\n## What is this for?\n\n- Simple **non-sensitive**[^1] datastore for scripts, crons, or CLI tools\n- MVP database for prototyping\n\n## Installation\n\n```\ngem install gistkv\n```\n\n## Create a database\n\nUse `GistKV::Client.create_database` to create a new GistKV database. The method requires passing a valid GitHub token with access to the `gist` scope.\n\n```rb\nrequire 'gistkv'\n\n# returns id of created gist\nGistKV::Client.create_database(ENV['GITHUB_TOKEN'])\n# =\u003e f9ba626808266b93b7631aeb8321dbcf\n```\n\nTake note of the id returned from `create_database` when called, it should be saved for future use. This is the id of your database.\n\n## Use a database\n\nUse `GistKV::Client.new` to create a GistKV client. This method requires passing the id of a GistKV gist and a valid GitHub token with access to the `gist` scope.\n\n```rb\nrequire 'gistkv'\n\ng = GistKV::Client.new(ENV['GIST_ID'], ENV['GITHUB_TOKEN'])\n\n# set a value\ng.set(\"score\", 10)\n\n# get a value\ng.get(\"score\")\n# =\u003e 10\n\n# alias for .get\ng[\"score\"]\n# =\u003e 10\n\n# alias for .set\ng[\"days\"] = [\"Friday\", \"Saturday\", \"Sunday\"]\n\ng.get(\"days\")\n# =\u003e [\"Friday\", \"Saturday\", \"Sunday\"]\n\n# get list of keys\ng.keys\n# =\u003e [\"score\", \"days\"]\n\n# update multiple keys at once\ng.update(score: 11, days: [\"Saturday\"])\n```\nThe above example code resulted in [this gist](https://gist.github.com/jkulton/67df2395daa634c6f4c3a783847324be).\n\nIt's also possible to create a read-only `GistKV::Client` by omitting the GitHub access token on creation. Please note this client will be subject to the GitHub API's public rate limits. [See docs for more info](https://docs.github.com/en/rest).\n\n## How it works\n\n- GistKV creates a single `__gistkv.json` file in a gist.\n- On each `.get` or `.set` the gist's JSON is retrieved from the GitHub API, manipulated, and then written back to the gist.\n  - As a result, you may experience unexpected results if multiple client instances are reading/writing the same gist at once.\n\n## Footnotes\n\n[^1]: ⚠️ **Don't use GistKV to store sensitive data. Gists, even when set to secret, are not private.** ⚠️\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjkulton%2Fgistkv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjkulton%2Fgistkv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjkulton%2Fgistkv/lists"}