{"id":20980488,"url":"https://github.com/hyperjumptech/ztorage","last_synced_at":"2025-09-05T18:35:56.999Z","repository":{"id":65970528,"uuid":"603720495","full_name":"hyperjumptech/ztorage","owner":"hyperjumptech","description":"A type-safe wrapper for key-value storage in JavaScript","archived":false,"fork":false,"pushed_at":"2023-09-05T03:37:02.000Z","size":290,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-21T15:49:53.133Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/hyperjumptech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2023-02-19T11:35:40.000Z","updated_at":"2023-11-10T02:29:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"ac62f09d-47df-410d-8ed9-3906e051927c","html_url":"https://github.com/hyperjumptech/ztorage","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"fb166abdcf36b324d1a6adf347f6169427a06de4"},"previous_names":["kevinhermawan/ztorage"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperjumptech%2Fztorage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperjumptech%2Fztorage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperjumptech%2Fztorage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperjumptech%2Fztorage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hyperjumptech","download_url":"https://codeload.github.com/hyperjumptech/ztorage/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243382935,"owners_count":20282051,"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":[],"created_at":"2024-11-19T05:28:46.965Z","updated_at":"2025-03-13T10:17:14.077Z","avatar_url":"https://github.com/hyperjumptech.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ztorage\n\n![Minified size](https://img.shields.io/bundlephobia/min/@hyperjumptech/ztorage) ![Test coverage](https://img.shields.io/codecov/c/github/hyperjumptech/ztorage) ![Monthly download](https://img.shields.io/npm/dm/@hyperjumptech/ztorage)\n\nZtorage is a flexible and type-safe wrapper for key-value storage that is designed to work with various storage mediums, including [Web Storage API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API) and other storage backends. It takes advantage of [Zod](https://github.com/colinhacks/zod), a powerful TypeScript schema validation library, to provide automatic parsing and validation of data.\n\n## Articles\n\n- [Open-sourcing Ztorage: A Type-Safe Wrapper for Key-Value Storage in JavaScript](https://medium.com/hyperjump-tech/open-sourcing-ztorage-a-type-safe-wrapper-for-key-value-storage-in-javascript-2cfe9879ea1a?source=rss----fabfd42372dc---4)\n\n## Features\n\n- Works with various storage mediums\n- Provides type safety for key-value storage\n- Enables automatic parsing and validation of data\n- Zero dependencies\n\n## Installation\n\nTo use Ztorage, you must have Zod installed. You can install `@hyperjumptech/ztorage` and `zod`, by running the following command:\n\n**NPM**\n\n```\nnpm install @hyperjumptech/ztorage zod\n```\n\n**Yarn**\n\n```\nyarn add @hyperjumptech/ztorage zod\n```\n\n**pnpm**\n\n```\npnpm add @hyperjumptech/ztorage zod\n```\n\n## Usage\n\n```ts\nimport { z } from \"zod\";\nimport Ztorage from \"@hyperjumptech/ztorage\";\n\n// Define a schema for the data you want to store\nconst schema = z.object({\n  isDarkModeEnabled: z.boolean(),\n});\n\n// Instantiate a Ztorage object with a schema and storage functions\nconst storage = new Ztorage({\n  schema,\n  onGetItem: async (key) =\u003e {\n    return localStorage.getItem(key);\n  },\n  onSetItem: async (key, value) =\u003e {\n    localStorage.setItem(key, value);\n  },\n  onRemoveItem: async (key) =\u003e {\n    localStorage.removeItem(key);\n  },\n});\n\n// Set item to storage\nawait storage.setItem(\"isDarkModeEnabled\", true);\n\n// Get item from storage\nconst isDarkModeEnabled = await storage.getItem(\"isDarkModeEnabled\");\nconsole.log(isDarkModeEnabled); // true\n\n// Remove item from storage\nawait storage.removeItem(\"isDarkModeEnabled\");\n```\n\n## License\n\n[MIT License](/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperjumptech%2Fztorage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyperjumptech%2Fztorage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperjumptech%2Fztorage/lists"}