{"id":27535683,"url":"https://github.com/joris-gallot/zorm","last_synced_at":"2025-04-18T19:10:19.542Z","repository":{"id":285252123,"uuid":"957513131","full_name":"joris-gallot/zorm","owner":"joris-gallot","description":"zorm - A minimalist, type-safe ORM powered by Zod","archived":false,"fork":false,"pushed_at":"2025-04-13T15:09:36.000Z","size":582,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-13T15:38:40.250Z","etag":null,"topics":["orm","runtime-validation","schema-validation","type-inference","typescript","vue","zod"],"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/joris-gallot.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}},"created_at":"2025-03-30T15:01:43.000Z","updated_at":"2025-04-13T15:07:39.000Z","dependencies_parsed_at":"2025-04-06T13:36:21.838Z","dependency_job_id":null,"html_url":"https://github.com/joris-gallot/zorm","commit_stats":null,"previous_names":["joris-gallot/zorm","joris-gallot/zodorm"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joris-gallot%2Fzorm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joris-gallot%2Fzorm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joris-gallot%2Fzorm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joris-gallot%2Fzorm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joris-gallot","download_url":"https://codeload.github.com/joris-gallot/zorm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249535844,"owners_count":21287496,"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":["orm","runtime-validation","schema-validation","type-inference","typescript","vue","zod"],"created_at":"2025-04-18T19:10:18.953Z","updated_at":"2025-04-18T19:10:19.522Z","avatar_url":"https://github.com/joris-gallot.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# zorm\n\nzorm is a minimalist ORM powered by [Zod](https://zod.dev/). It allows you to define and manipulate entities in a simple and type-safe way, with intuitive relation management.\n\n## Features\n- ✅ Type-safe schema definition and validation powered by Zod\n- 🔍 Fully typed query builder with:\n  - Type-safe field names and operators in where clauses\n  - Autocomplete for relation names in eager loading\n  - Inferred return types including nested relations\n- 🤝 Support for one-to-one and one-to-many relationships\n- 🚀 Eager loading of related entities\n- 🛡️ Runtime validation through Zod schemas\n- ⚡️ Reactivity support for Vue (other frameworks planned)\n\n## Installation\n```sh\nnpm install @zorm-ts/core\n```\n## Usage\n\n### Define Entities\n```ts\nimport { defineEntity } from '@zorm-ts/core'\nimport { z } from 'zod'\n\nexport const User = defineEntity(\n  'user',\n  z.object({\n    id: z.number(),\n    email: z.string().email(),\n    age: z.number(),\n    username: z.string().optional(),\n    isAdmin: z.boolean()\n  })\n)\n\nexport const Post = defineEntity(\n  'post',\n  z.object({\n    id: z.number(),\n    title: z.string(),\n    userId: z.number(),\n  })\n)\n```\n\n### Create a Query Builder from relations\n```ts\nimport { defineQueryBuilder } from '@zorm-ts/core'\nimport { Post, User } from './entities'\n\nexport const userQuery = defineQueryBuilder(User, ({ many }) =\u003e ({\n  posts: many(Post, {\n    reference: Post.fields.userId,\n    field: User.fields.id,\n  }),\n}))\n\nconst users = userQuery.query()\n  .where(user =\u003e user.age \u003e 18)\n  .orWhere(user =\u003e user.isAdmin)\n  .get()\n/*\n[{\n  id: number\n  email: string\n  age: number\n  username?: string\n  isAdmin: boolean\n}]\n*/\n\nconst usersWithPosts = userQuery.query()\n  .where(user =\u003e user.age \u003e 18)\n  .orWhere(user =\u003e user.isAdmin)\n  .with('posts')\n  .get()\n/*\n[{\n  id: number\n  email: string\n  age: number\n  username?: string\n  isAdmin: boolean\n  posts: Array\u003c{\n    id: number\n    title: string\n    userId: number\n  }\u003e\n}]\n*/\n```\n\n## Reactivity\n\nCurrently it only handles reactivity through Vue integration (see [Vue integration example](packages/vue/src/index.ts)), but support for other frameworks will be added.\n\n### Vue\n\nzorm provides first-class support for Vue through the `@zorm-ts/vue` package. This integration enables reactive queries that automatically update your components when the data changes.\n\n```sh\nnpm install @zorm-ts/vue\n```\n\nFor detailed Vue integration instructions, check out the [@zorm-ts/vue documentation](packages/vue/README.md).\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoris-gallot%2Fzorm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoris-gallot%2Fzorm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoris-gallot%2Fzorm/lists"}