{"id":46782841,"url":"https://github.com/omermecitoglu/drizzle-zod-shared-refinements","last_synced_at":"2026-03-10T00:36:11.030Z","repository":{"id":333917067,"uuid":"1130800576","full_name":"omermecitoglu/drizzle-zod-shared-refinements","owner":"omermecitoglu","description":"Provides a helper function for drizzle-zod to create shared refinements","archived":false,"fork":false,"pushed_at":"2026-01-17T02:52:33.000Z","size":72,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-22T07:32:43.987Z","etag":null,"topics":["drizzle","drizzle-zod","refinements","typescript","zod"],"latest_commit_sha":null,"homepage":"https://orm.drizzle.team/docs/zod#refinements","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/omermecitoglu.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-09T03:12:06.000Z","updated_at":"2026-01-17T02:52:11.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/omermecitoglu/drizzle-zod-shared-refinements","commit_stats":null,"previous_names":["omermecitoglu/drizzle-zod-shared-refinements"],"tags_count":2,"template":false,"template_full_name":"omermecitoglu/node-module","purl":"pkg:github/omermecitoglu/drizzle-zod-shared-refinements","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omermecitoglu%2Fdrizzle-zod-shared-refinements","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omermecitoglu%2Fdrizzle-zod-shared-refinements/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omermecitoglu%2Fdrizzle-zod-shared-refinements/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omermecitoglu%2Fdrizzle-zod-shared-refinements/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/omermecitoglu","download_url":"https://codeload.github.com/omermecitoglu/drizzle-zod-shared-refinements/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omermecitoglu%2Fdrizzle-zod-shared-refinements/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30318584,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T20:05:46.299Z","status":"ssl_error","status_checked_at":"2026-03-09T19:57:04.425Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["drizzle","drizzle-zod","refinements","typescript","zod"],"created_at":"2026-03-10T00:36:10.288Z","updated_at":"2026-03-10T00:36:11.016Z","avatar_url":"https://github.com/omermecitoglu.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Drizzle Zod Shared Refinements\n\n[![npm version](https://img.shields.io/npm/v/drizzle-zod-shared-refinements?logo=npm\u0026logoColor=CB3837\u0026color=CB3837)](https://www.npmjs.com/package/drizzle-zod-shared-refinements)\n[![npm downloads](https://img.shields.io/npm/dm/drizzle-zod-shared-refinements?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MTIgNTEyIj48IS0tIUZvbnQgQXdlc29tZSBGcmVlIDYuNi4wIGJ5IEBmb250YXdlc29tZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tIExpY2Vuc2UgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbS9saWNlbnNlL2ZyZWUgQ29weXJpZ2h0IDIwMjQgRm9udGljb25zLCBJbmMuLS0+PHBhdGggZD0iTTI4OCAzMmMwLTE3LjctMTQuMy0zMi0zMi0zMnMtMzIgMTQuMy0zMiAzMmwwIDI0Mi43LTczLjQtNzMuNGMtMTIuNS0xMi41LTMyLjgtMTIuNS00NS4zIDBzLTEyLjUgMzIuOCAwIDQ1LjNsMTI4IDEyOGMxMi41IDEyLjUgMzIuOCAxMi41IDQ1LjMgMGwxMjgtMTI4YzEyLjUtMTIuNSAxMi41LTMyLjggMC00NS4zcy0zMi44LTEyLjUtNDUuMyAwTDI4OCAyNzQuNyAyODggMzJ6TTY0IDM1MmMtMzUuMyAwLTY0IDI4LjctNjQgNjRsMCAzMmMwIDM1LjMgMjguNyA2NCA2NCA2NGwzODQgMGMzNS4zIDAgNjQtMjguNyA2NC02NGwwLTMyYzAtMzUuMy0yOC43LTY0LTY0LTY0bC0xMDEuNSAwLTQ1LjMgNDUuM2MtMjUgMjUtNjUuNSAyNS05MC41IDBMMTY1LjUgMzUyIDY0IDM1MnptMzY4IDU2YTI0IDI0IDAgMSAxIDAgNDggMjQgMjQgMCAxIDEgMC00OHoiIGZpbGw9IiMwMDc4MjAiIC8+PC9zdmc+\u0026color=007820)](https://www.npmjs.com/package/drizzle-zod-shared-refinements)\n[![codecov](https://codecov.io/gh/omermecitoglu/drizzle-zod-shared-refinements/branch/main/graph/badge.svg)](https://codecov.io/gh/omermecitoglu/drizzle-zod-shared-refinements)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?logo=data:image/svg+xml;base64,PHN2ZyB4b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S45IDMzNy4xYy0yLjYtMTEgMS0yMi4zIDYuNy0zMi4xbDk1LjItMTYzLjJjNS04LjYgMTQuMi0xMy44IDI0LjEtMTMuOHMxOS4xIDUuMyAyNC4xIDEzLjhsOTUuMiAxNjMuMmM1LjcgOS44IDkuMyAyMS4xIDYuNyAzMi4xQzI0MiAzODIgMTg5LjcgNDE2IDEyNi44IDQxNlMxMS43IDM4MiAuOSAzMzcuMXoiIGZpbGw9IiNEMEE4MUMiIC8+PC9zdmc+)](https://opensource.org/licenses/MIT)\n[![GitHub last commit](https://img.shields.io/github/last-commit/omermecitoglu/drizzle-zod-shared-refinements?color=c977be\u0026logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NDAgNTEyIj48IS0tIUZvbnQgQXdlc29tZSBGcmVlIDYuNi4wIGJ5IEBmb250YXdlc29tZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tIExpY2Vuc2UgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbS9saWNlbnNlL2ZyZWUgQ29weXJpZ2h0IDIwMjQgRm9udGljb25zLCBJbmMuLS0+PHBhdGggZD0iTTMyMCAzMzZhODAgODAgMCAxIDAgMC0xNjAgODAgODAgMCAxIDAgMCAxNjB6bTE1Ni44LTQ4QzQ2MiAzNjEgMzk3LjQgNDE2IDMyMCA0MTZzLTE0Mi01NS0xNTYuOC0xMjhMMzIgMjg4Yy0xNy43IDAtMzItMTQuMy0zMi0zMnMxNC4zLTMyIDMyLTMybDEzMS4yIDBDMTc4IDE1MSAyNDIuNiA5NiAzMjAgOTZzMTQyIDU1IDE1Ni44IDEyOEw2MDggMjI0YzE3LjcgMCAzMiAxNC4zIDMyIDMycy0xNC4zIDMyLTMyIDMybC0xMzEuMiAweiIgZmlsbD0iI0M5NzdCRSIgLz48L3N2Zz4=)](https://github.com/omermecitoglu/drizzle-zod-shared-refinements/commits/main/)\n[![GitHub issues](https://img.shields.io/github/issues/omermecitoglu/drizzle-zod-shared-refinements?color=a38eed\u0026logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxNiIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2Ij4KICA8cGF0aCBkPSJNOCA5LjVhMS41IDEuNSAwIDEgMCAwLTMgMS41IDEuNSAwIDAgMCAwIDNaIiBmaWxsPSIjQTM4RUVEIj48L3BhdGg+CiAgPHBhdGggZD0iTTggMGE4IDggMCAxIDEgMCAxNkE4IDggMCAwIDEgOCAwWk0xLjUgOGE2LjUgNi41IDAgMSAwIDEzIDAgNi41IDYuNSAwIDAgMC0xMyAwWiIgZmlsbD0iI0EzOEVFRCI+PC9wYXRoPgo8L3N2Zz4=)](https://github.com/omermecitoglu/drizzle-zod-shared-refinements/issues)\n[![GitHub stars](https://img.shields.io/github/stars/omermecitoglu/drizzle-zod-shared-refinements?style=social)](https://github.com/omermecitoglu/drizzle-zod-shared-refinements)\n\n## Overview\n\nThis tiny module provides a helper function to define the refinements just once and share between `createSelectSchema`, `createInsertSchema` and `createUpdateSchema`\n\n[Read the official drizzle documentation for more information](https://orm.drizzle.team/docs/zod#refinements)\n\n## Installation\n\nTo install this package\n\n```sh\nnpm install drizzle-zod-shared-refinements\n```\n\n## Usage\n\nbefore you needed to write refinements for each schemas\n\n```typescript\nimport { pgTable, text, integer, json } from 'drizzle-orm/pg-core';\nimport { createInsertSchema, createSelectSchema, createUpdateSchema } from 'drizzle-zod';\nimport { z } from 'zod/v4';\n\nconst users = pgTable('users', {\n  id: integer().primaryKey(),\n  name: text().notNull(),\n  bio: text(),\n  preferences: json()\n});\n\nconst userSelectSchema = createSelectSchema(users, {\n  name: (schema) =\u003e schema.max(20), // Extends schema\n  bio: (schema) =\u003e schema.max(1000), // Extends schema before becoming nullable/optional\n  preferences: z.object({ theme: z.string() }) // Overwrites the field, including its nullability\n});\n\nconst userInsertSchema = createInsertSchema(users, {\n  name: (schema) =\u003e schema.max(20), // Extends schema\n  bio: (schema) =\u003e schema.max(1000), // Extends schema before becoming nullable/optional\n  preferences: z.object({ theme: z.string() }) // Overwrites the field, including its nullability\n});\n\nconst userUpdateSchema = createUpdateSchema(users, {\n  name: (schema) =\u003e schema.max(20), // Extends schema\n  bio: (schema) =\u003e schema.max(1000), // Extends schema before becoming nullable/optional\n  preferences: z.object({ theme: z.string() }) // Overwrites the field, including its nullability\n});\n```\n\nnow you can share the refinements\n\n```typescript\nimport { pgTable, text, integer, json } from 'drizzle-orm/pg-core';\nimport { createInsertSchema, createSelectSchema, createUpdateSchema } from 'drizzle-zod';\nimport { createSharedRefinements } from \"drizzle-zod-shared-refinements\";\nimport { z } from 'zod/v4';\n\nconst users = pgTable('users', {\n  id: integer().primaryKey(),\n  name: text().notNull(),\n  bio: text(),\n  preferences: json()\n});\n\nconst sharedRefinements = createSharedRefinements(users, {\n  name: (schema) =\u003e schema.max(20), // Extends schema\n  bio: (schema) =\u003e schema.max(1000), // Extends schema before becoming nullable/optional\n  preferences: z.object({ theme: z.string() }) // Overwrites the field, including its nullability\n});\n\nconst userSelectSchema = createSelectSchema(users, sharedRefinements);\n\nconst userInsertSchema = createInsertSchema(users, sharedRefinements);\n\nconst userUpdateSchema = createUpdateSchema(users, sharedRefinements);\n```\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomermecitoglu%2Fdrizzle-zod-shared-refinements","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fomermecitoglu%2Fdrizzle-zod-shared-refinements","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomermecitoglu%2Fdrizzle-zod-shared-refinements/lists"}