{"id":19011597,"url":"https://github.com/graphql-editor/i-graphql","last_synced_at":"2026-03-03T01:39:18.695Z","repository":{"id":57270285,"uuid":"435494696","full_name":"graphql-editor/i-graphql","owner":"graphql-editor","description":"GraphQL Friendly ORM for MongoDB and GraphQL Zeus - right now in alpha stage","archived":false,"fork":false,"pushed_at":"2025-07-14T18:23:23.000Z","size":283,"stargazers_count":2,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-11-24T06:11:13.815Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/graphql-editor.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":"2021-12-06T12:49:33.000Z","updated_at":"2025-07-14T18:23:26.000Z","dependencies_parsed_at":"2024-04-12T13:54:51.235Z","dependency_job_id":"b3893c91-5bcf-4c1e-9345-3f7c9cb97968","html_url":"https://github.com/graphql-editor/i-graphql","commit_stats":null,"previous_names":["graphql-editor/igraphql"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/graphql-editor/i-graphql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-editor%2Fi-graphql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-editor%2Fi-graphql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-editor%2Fi-graphql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-editor%2Fi-graphql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/graphql-editor","download_url":"https://codeload.github.com/graphql-editor/i-graphql/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-editor%2Fi-graphql/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30029705,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-03T00:31:48.536Z","status":"ssl_error","status_checked_at":"2026-03-03T00:30:56.176Z","response_time":60,"last_error":"SSL_read: 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":[],"created_at":"2024-11-08T19:14:57.901Z","updated_at":"2026-03-03T01:39:18.665Z","avatar_url":"https://github.com/graphql-editor.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# iGraphQL\n\nORM for dbs and GraphQL. The mission is to make [graphql zeus](https://github.com/graphql-editor/graphql-zeus) typings database friendly. This is an **alpha version** and supports mongodb only.\n\n## Installation\n\n```sh\nnpm i -D graphql-zeus\n```\n\n```sh\nnpm i i-graphql mongodb\n```\n\n## Generation\n\n```\n$ npx zeus https://example.com/graphql ./src\n```\n\nNow when you generated your types you can use them inside project\n\n## Example\n\n`src/orm.ts`\n\n```ts\nimport { ModelTypes } from \"./zeus\";\nimport { iGraphQL } from \"i-graphql\";\n\nexport const orm = async () =\u003e {\n  return iGraphQL\u003c\n    Pick\u003cModelTypes, \"Operation\" | \"Invoice\" | \"Source\"\u003e,\n    {\n      _id: () =\u003e string;\n      createdAt: () =\u003e string;\n      updatedAt: () =\u003e string;\n    }\n  \u003e({\n    Operation: '_id',\n    Invoice: '_id',\n    Source: '_id'\n  },{\n    autoFields:{\n      _id: () =\u003e new ObjectId().toHexString(),\n      createdAt: () =\u003e new Date().toISOString(),\n      updatedAt: () =\u003e new Date().toISOString(),\n    }\n  });\n};\n\nexport const MongOrb = await orm();\n```\n\nFirst we declared that we will use 3 types that are keys from ModelTypes type. Then We specified the type of autoFields generation functions that all of our models will use. \nThen our first function argument is a dictionary holding primary keys of our models, second parameter is options that hold `autoFields` generators that are used by the function `createWithAutoFields`\n\n### How to use your orm\n\n```ts\nconst resolver = () =\u003e\n  MongOrb(\"Source\").createWithAutoFields(\n    \"_id\",\n    \"createdAt\"\n  )({\n    name: \"My Source\",\n  });\n```\n\n## Experimental data loader\n\nYou can use experimental data loader for requests that can cause n+1 problem. It is still in experimental phase.\nConsider the following schema\n```graphql\ntype Person{\n  id: String!\n  username:String!\n  friends: [Person!]!\n}\n\ntype Query{\n  person(_id:String!): Person!\n}\n```\n\nAnd the following query:\n\n```gql\nquery GetPersonWithFriends{\n  person(id:\"38u198rh89h\"){\n    username\n    id\n    friends{\n      username\n      id\n      friends{\n        username\n        id\n      }\n    }\n  }\n}\n```\n\nHere is how you can implement to limit db calls and avoid n+1 problem\n\n```ts\nconst peopleLoader = dataLoader\u003c{[id:string]: PersonModel}\u003e({})\n\nexport const QueryPeople = async (_,args) =\u003e {\n  const person = await MongoOrb(\"Person\").collection.findOne({_id:args._id})\n  const friends = await MongoOrb(\"Person\").collection.find({\n    _id:{\n      $in: person.friends\n    }\n  }).toArray()\n  const friendsOfFriends = await MongoOrb(\"Person\").collection.find({\n    _id:{\n      $in: friends.flatMap(f =\u003e f.friends)\n    }\n  })\n  const allPeople = Object.fromEntries([person,...friends,friendsOfFriends].map(p =\u003e ([p.id,p])))\n  return peopleLoader.withData(person,allPeople) \n}\n\nexport const PersonFriends = (src,args) =\u003e{\n  const source = peopleLoader.fromSrc(src)\n  return {\n    ...src,\n    friends: src.friends.map(f =\u003e source.__dataLoader[f])\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphql-editor%2Fi-graphql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgraphql-editor%2Fi-graphql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphql-editor%2Fi-graphql/lists"}