{"id":21342513,"url":"https://github.com/skorotkiewicz/denokvclient","last_synced_at":"2026-02-25T22:04:44.341Z","repository":{"id":263079763,"uuid":"886882250","full_name":"skorotkiewicz/DenoKvClient","owner":"skorotkiewicz","description":"DenoKvClient - Wrapper for Deno KV","archived":false,"fork":false,"pushed_at":"2024-12-02T16:59:00.000Z","size":93,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-09T04:33:32.299Z","etag":null,"topics":["deno","javascript","prisma"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/denokvclient","language":"JavaScript","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/skorotkiewicz.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-11T19:22:23.000Z","updated_at":"2024-12-02T17:09:51.000Z","dependencies_parsed_at":"2024-11-16T03:16:30.730Z","dependency_job_id":"5cd7f5f4-bb78-413c-9808-951af0422ade","html_url":"https://github.com/skorotkiewicz/DenoKvClient","commit_stats":null,"previous_names":["skorotkiewicz/denokvclient"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/skorotkiewicz/DenoKvClient","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skorotkiewicz%2FDenoKvClient","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skorotkiewicz%2FDenoKvClient/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skorotkiewicz%2FDenoKvClient/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skorotkiewicz%2FDenoKvClient/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skorotkiewicz","download_url":"https://codeload.github.com/skorotkiewicz/DenoKvClient/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skorotkiewicz%2FDenoKvClient/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272150896,"owners_count":24882248,"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-08-25T02:00:12.092Z","response_time":1107,"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":["deno","javascript","prisma"],"created_at":"2024-11-22T01:08:52.948Z","updated_at":"2026-02-25T22:04:44.314Z","avatar_url":"https://github.com/skorotkiewicz.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DenoKvClient - Wrapper for Deno KV\n\nA simple client wrapper for the Deno KV (Key-Value) store, written in JavaScript. This library provides a convenient way to interact with the Deno KV service, with support for creating, reading, updating, and deleting data.\n\n## Installation\n\nTo use the DenoKvClient, you need install a dependency in your project:\n\n```\nyarn add denokvclient\n```\n\nI'm use this on my own [Deno KV](https://github.com/denoland/denokv) server.\n\n## Usage\n\n1. Import the `DenoKvClient` class:\n\n```js\nimport { DenoKvClient, createSchema } from \"denokvclient\";\n\nimport { z } from \"zod\";\nimport \"dotenv/config\";\nimport { v4 as uuidv4 } from \"uuid\";\n```\n\n2. Initialize the client with the Deno KV service URL and an access token:\n\n```js\n// Define your schemas\nexport const User = z.object({\n  id: z.optional(z.string().uuid()).describe(\"primary\"),\n  createdAt: z.optional(z.date()),\n  name: z.string(),\n  email: z.string().email(),\n});\n\nexport const Order = z.object({\n  id: z.optional(z.string().uuid()).describe(\"primary\"),\n  createdAt: z.optional(z.date()),\n  name: z.string(),\n  userId: z.string().uuid(),\n});\n\n// Define schemas with relations\nconst schema = createSchema().model({\n  users: {\n    schema: User,\n    relations: {\n      orders: [\"orders\", [Order], \"id\", \"userId\"],\n    },\n  },\n  orders: {\n    schema: Order,\n    relations: {\n      user: [\"users\", User, \"userId\", \"id\"],\n    },\n  },\n});\n\nconst client = new DenoKvClient(schema);\nawait client.init(\"http://0.0.0.0:4512\", \"your_access_token_here\");\n```\n\n3. Use the client to interact with the Deno KV store:\n\n```js\n// Create a new entry\nconst newUser = await client.users.create({\n  data: {\n    username: \"ola\",\n    name: \"Ola\",\n    age: 31,\n  },\n  select: {\n    age: true,\n    name: true,\n  },\n});\nconsole.log(newUser);\n\n// Find a unique entry\nconst user = await client.users.findUnique({\n  where: {\n    username: \"ola\",\n  },\n  select: {\n    age: true,\n    username: true,\n    tags: true,\n  },\n});\nconsole.log(user);\n\n// Update an entry\nconst updatedUser = await client.users.update({\n  where: {\n    username: \"ola\",\n  },\n  data: {\n    name: \"Ola Updated\",\n    age: 32,\n    tags: [\n      { id: 1, tag: \"hello\" },\n      { id: 2, tag: \"world\" },\n      { id: 3, tag: \"example\" },\n    ],\n  },\n  select: {\n    name: true,\n    age: true,\n  },\n});\nconsole.log(updatedUser);\n\n////////////// matchesWhere //////////////\n\n// Find users with email starting with \"john\"\nconst usersStartingWithJohn = await client.users.findMany({\n  where: {\n    email: {\n      startsWith: \"john\",\n    },\n  },\n});\nconsole.log(\"Users with email starting with 'john':\", usersStartingWithJohn);\n\n// Filtered users\nconst filteredUsers = await client.users.findMany({\n  where: {\n    name: {\n      contains: \"John\", // name contains \"John\"\n    },\n    email: {\n      endsWith: \"@example.com\", // email ends with \"@example.com\"\n    },\n  },\n});\nconsole.log(\"Filtered users:\", filteredUsers);\n```\n\n## Features\n\n- Namespace Support: The client uses a proxy to dynamically create namespaces (e.g., `client.users`, `client.bans`) for managing data.\n\n- CRUD Operations: Supports creating, reading, updating, and deleting data in the Deno KV store.\n\n- Selective Data Fetching: The `select` option allows you to specify which fields should be returned in the response.\n\n- Error Handling: The client provides basic error handling and can be extended to handle more complex error scenarios.\n\n## Contributing\n\nIf you find any issues or would like to contribute to the project, feel free to open a pull request or submit an issue on the GitHub repository.\n\n## License\n\nThis project is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskorotkiewicz%2Fdenokvclient","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskorotkiewicz%2Fdenokvclient","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskorotkiewicz%2Fdenokvclient/lists"}