{"id":25070273,"url":"https://github.com/som3canadian/cloudflare-kv-manager","last_synced_at":"2025-05-08T00:48:51.925Z","repository":{"id":276075197,"uuid":"928072234","full_name":"som3canadian/Cloudflare-KV-Manager","owner":"som3canadian","description":"The missing tool for your Cloudflare KV. A more complete and simple solution for managing Cloudflare KV storage. Include a web interface and a small python lib.","archived":false,"fork":false,"pushed_at":"2025-04-14T03:53:01.000Z","size":1097,"stargazers_count":22,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-08T00:48:44.294Z","etag":null,"topics":["cloudflare","cloudflare-kv","cloudflare-pages","cloudflare-worker","kv"],"latest_commit_sha":null,"homepage":"https://kv-demo.somecanadian.com","language":"Vue","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/som3canadian.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,"zenodo":null}},"created_at":"2025-02-06T02:30:02.000Z","updated_at":"2025-05-02T17:14:08.000Z","dependencies_parsed_at":"2025-04-14T04:20:58.214Z","dependency_job_id":"ee397c1f-ce43-4b24-b98c-99abd713738e","html_url":"https://github.com/som3canadian/Cloudflare-KV-Manager","commit_stats":null,"previous_names":["som3canadian/cloudflare-kv-manager"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/som3canadian%2FCloudflare-KV-Manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/som3canadian%2FCloudflare-KV-Manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/som3canadian%2FCloudflare-KV-Manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/som3canadian%2FCloudflare-KV-Manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/som3canadian","download_url":"https://codeload.github.com/som3canadian/Cloudflare-KV-Manager/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252978685,"owners_count":21834913,"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":["cloudflare","cloudflare-kv","cloudflare-pages","cloudflare-worker","kv"],"created_at":"2025-02-06T21:19:32.706Z","updated_at":"2025-05-08T00:48:51.916Z","avatar_url":"https://github.com/som3canadian.png","language":"Vue","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cloudflare KV Management\n\n**Disclaimer:** This project is not affiliated with Cloudflare.\n\nA more complete and simple solution for managing Cloudflare KV storage. One stop shop for managing your KV namespaces 🔥.\n\n## Demo\n\nYou can see the demo of the UI [here](https://kv-demo.somecanadian.com/).\n\nThings to note about the demo (not present if you deploy your own):\n\n- Hardcoded expiration of 30 minutes for demo purposes.\n- [Rate limiting](https://developers.cloudflare.com/workers/runtime-apis/bindings/rate-limit/) is enabled for the demo.\n- Turnstile(captcha) is enabled for the `set` operation (adding or modifying a key).\n- Demo version is on the `demo` branch.\n\n## Features\n\n- Comes with a small python library for easy integration 🐍\n- Can be used without the UI\n- Use as many namespaces as you want 🔄\n- Search for keys in a namespace (search by key, value, or metadata) 🔍\n- Add, edit, and delete keys 📝\n- Supports view / edit metadata and expiration fields 👁️\n- Delete all keys in a namespace 🗑️\n- Delete a single key\n- Filter\n- Pagination\n\n**Note:**\n\n- No authentification is provided for the UI since you can use Cloudflare Zero Trust to protect it (see [customize-preview-deployments-access](https://developers.cloudflare.com/pages/configuration/preview-deployments/#customize-preview-deployments-access) and [enable-access-on-your-pagesdev-domain](https://developers.cloudflare.com/pages/platform/known-issues/#enable-access-on-your-pagesdev-domain)).\n- Don't forget to set custom header and custom secret for the middleware.\n- Supports Zero Trust for the middleware (you need to adjust config file to use custom domain and set workers_dev to false)\n\n**Optional**\n\n- Use custom domain for middleware and / or UI\n- Protect UI with Zero Trust\n- Restrict CORS policy\n\n![screenshot7](./img/screenshot7.jpg)\n![screenshot2](./img/screenshot2.jpg)\n![screenshot8](./img/screenshot8.jpg)\n![screenshot9](./img/screenshot9.jpg)\n\n## Prerequisites\n\n- wrangler cli (make sure it's logged in)\n- One or more Cloudflare KV namespaces\n- node and npm\n\n## Installation\n\n```bash\n# clone the repo\ngit clone https://github.com/som3canadian/Cloudflare-KV-Manager.git\ncd Cloudflare-KV-Manager\n\n# copy the config files\ncp templates/middleware_config.json workers/kv-management-middleware/wrangler.json\ncp templates/ui_config.env workers/kv-management-ui/.env\n\n# deploy the middleware\ncd workers/kv-management-middleware\n# modify the wrangler.json file\nnpm install\nwrangler deploy\n# set the WORKER_KV_SECRET\nwrangler secret put WORKER_KV_SECRET\n\n# deploy the ui\ncd ../kv-management-ui\n# modify the .env file\nnpm install\nnpm run deploy\n# run the ui locally\n# npm run preview\n\n# go back to the root directory\ncd ../../\n```\n\n## Configuration\n\n### Middleware\n\n- File: workers/kv-management-middleware/wrangler.json\n\n```json\n{\n  \"$schema\": \"node_modules/wrangler/config-schema.json\",\n  \"name\": \"kv-management-middleware\",\n  \"main\": \"src/index.js\",\n  \"account_id\": \"\u003cyour-account-id\u003e\",\n  \"compatibility_date\": \"2025-01-29\",\n  \"workers_dev\": true,\n  \"preview_urls\": false,\n  \"observability\": {\n    \"enabled\": true\n  },\n  \"vars\": {\n    \"DEFAULT_EXPIRATION_DAYS\": 7,\n    \"CUSTOM_HEADER\": \"\u003cyour-custom-header\u003e\"\n  },\n  \"kv_namespaces\": [\n    {\n      \"binding\": \"\u003cyour-kv-namespace-name\u003e\",\n      \"id\": \"\u003cyour-kv-namespace-id\u003e\"\n    },\n    {\n      \"binding\": \"\u003cyour-kv-namespace-name\u003e\",\n      \"id\": \"\u003cyour-kv-namespace-id\u003e\"\n    },\n    {\n      \"binding\": \"\u003cyour-kv-namespace-name\u003e\",\n      \"id\": \"\u003cyour-kv-namespace-id\u003e\"\n    }\n  ]\n}\n```\n\n### UI\n\n- File: workers/kv-management-ui/.env\n\n```bash\nVITE_APP_WORKER_URL=\u003cyour-worker-url\u003e\nVITE_APP_WORKER_KV_SECRET=\u003cyour-secret\u003e\nVITE_APP_CUSTOM_HEADER=\u003cyour-custom-header\u003e\nVITE_MIDDLEWARE_USE_ZERO_TRUST=false\nVITE_MIDDLEWARE_SERVICE_AUTH_CLIENT_ID=\"\u003cyour-service-auth-client-id\u003e\"\nVITE_MIDDLEWARE_SERVICE_AUTH_CLIENT_SECRET=\"\u003cyour-service-auth-client-secret\u003e\"\n```\n\n### Python Library\n\n- File: lib/cf_kv.py\n\n```python\nthis_kv_worker_url = \"\u003cyour-worker-url\u003e\"\nthis_kv_worker_secret = \"\u003cyour-secret\u003e\"\nthis_kv_worker_custom_header = \"\u003cyour-custom-header\u003e\"\nMIDDLEWARE_USE_ZERO_TRUST = False\nMIDDLEWARE_SERVICE_AUTH_CLIENT_ID = \"\u003cyour-service-auth-client-id\u003e\"\nMIDDLEWARE_SERVICE_AUTH_CLIENT_SECRET = \"\u003cyour-service-auth-client-secret\u003e\"\n```\n\n## Usage\n\n### Using with the middleware only\n\n```bash\n# List all namespaces\ncurl -X GET \"https://\u003cyour-worker-url\u003e/namespaces\" -H \"X-Custom-Auth: \u003cyour-secret\u003e\"\n\n# List all keys in a namespace\ncurl -X GET \"https://\u003cyour-worker-url\u003e/list?namespace=\u003cnamespace\u003e\" -H \"X-Custom-Auth: \u003cyour-secret\u003e\"\n\n# Get a key\ncurl -X GET \"https://\u003cyour-worker-url\u003e/get?key=\u003ckey\u003e\u0026namespace=\u003cnamespace\u003e\" -H \"X-Custom-Auth: \u003cyour-secret\u003e\"\n\n# Set a key with metadata and expiration\ncurl -X GET \"https://\u003cyour-worker-url\u003e/set?key=\u003ckey\u003e\u0026namespace=\u003cnamespace\u003e\u0026value=\u003cvalue\u003e\u0026metadata=\u003cmetadata\u003e\u0026expiration=\u003cexpiration\u003e\" -H \"X-Custom-Auth: \u003cyour-secret\u003e\"\n\n# Set a key without expiration and metadata\ncurl -X GET \"https://\u003cyour-worker-url\u003e/set?key=\u003ckey\u003e\u0026namespace=\u003cnamespace\u003e\u0026value=\u003cvalue\u003e\" -H \"X-Custom-Auth: \u003cyour-secret\u003e\"\n\n# Delete a key\ncurl -X GET \"https://\u003cyour-worker-url\u003e/delete?key=\u003ckey\u003e\u0026namespace=\u003cnamespace\u003e\" -H \"X-Custom-Auth: \u003cyour-secret\u003e\"\n\n# Delete all keys in a namespace\ncurl -X GET \"https://\u003cyour-worker-url\u003e/delete_all?namespace=\u003cnamespace\u003e\" -H \"X-Custom-Auth: \u003cyour-secret\u003e\"\n\n# List all namespaces with the middleware behind Zero Trust\ncurl -X GET \"https://\u003cyour-worker-url\u003e/namespaces\" -H \"X-Custom-Auth: \u003cyour-secret\u003e\" -H \"Cf-Access-Client-Id: \u003cyour-service-auth-client-id\u003e\" -H \"Cf-Access-Client-Secret: \u003cyour-service-auth-client-secret\u003e\"\n```\n\n### Using with the middleware and the UI\n\n- Navigate to the URL of your CF Page\n\n### Using the python library\n\n```python\nimport lib.cf_kv as cf_kv\n\nexpiration_days = 5\nmetadata = {'custom_metadata': 'some_custom_metadata'}\nnamespace = 'my_namespace'\n\n# List all namespaces\ncf_kv.list_namespaces()\n\n# List all keys in a namespace\ncf_kv.list_kv_keys(namespace)\n\n# Set a key with metadata and expiration\ncf_kv.set_key_value('some_key_name', 'some_value', metadata, namespace, expiration_days)\n\n# Get a key\ncf_kv.get_key_value('some_key_name', namespace)\n\n# Get a key with metadata\ncf_kv.get_key_metadata('some_key_name', namespace)\n\n# Delete a key\ncf_kv.delete_key('some_key_name', namespace)\n\n# Delete all keys in a namespace\ncf_kv.delete_all_keys(namespace)\n```\n\n## TODO\n\n- [ ] Add search endpoint to middleware (Only support with the UI for now)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsom3canadian%2Fcloudflare-kv-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsom3canadian%2Fcloudflare-kv-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsom3canadian%2Fcloudflare-kv-manager/lists"}