{"id":37580652,"url":"https://github.com/nicolasgere/graphql-ts","last_synced_at":"2026-01-16T09:38:53.757Z","repository":{"id":57253706,"uuid":"80089883","full_name":"nicolasgere/graphql-ts","owner":"nicolasgere","description":"Graphql implementation in Typescript using decorator ","archived":false,"fork":false,"pushed_at":"2022-12-07T00:49:42.000Z","size":69,"stargazers_count":64,"open_issues_count":4,"forks_count":6,"subscribers_count":4,"default_branch":"dev","last_synced_at":"2025-09-28T08:22:49.147Z","etag":null,"topics":["decorators","graphql","metadata","typescript"],"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/nicolasgere.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}},"created_at":"2017-01-26T05:55:27.000Z","updated_at":"2023-07-08T19:34:18.000Z","dependencies_parsed_at":"2023-01-24T11:02:35.811Z","dependency_job_id":null,"html_url":"https://github.com/nicolasgere/graphql-ts","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/nicolasgere/graphql-ts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolasgere%2Fgraphql-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolasgere%2Fgraphql-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolasgere%2Fgraphql-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolasgere%2Fgraphql-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nicolasgere","download_url":"https://codeload.github.com/nicolasgere/graphql-ts/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolasgere%2Fgraphql-ts/sbom","scorecard":{"id":686087,"data":{"date":"2025-08-11","repo":{"name":"github.com/nicolasgere/graphql-ts","commit":"2ec28ff582a7e23522cd74df754e508d53ac6bb8"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.1,"checks":[{"name":"Code-Review","score":1,"reason":"Found 4/23 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 12 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"21 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-9vvw-cc9w-f27h","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-h6ch-v84p-w6p9","Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc","Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-mpcf-4gmh-23w8","Warn: Project is vulnerable to: GHSA-9qj9-36jm-prpv","Warn: Project is vulnerable to: GHSA-qh2h-chj9-jffq","Warn: Project is vulnerable to: GHSA-wrvr-8mpx-r7pp","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-w9mr-4mfr-499f","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg","Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-22T00:52:03.497Z","repository_id":57253706,"created_at":"2025-08-22T00:52:03.497Z","updated_at":"2025-08-22T00:52:03.497Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28478049,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T06:30:42.265Z","status":"ssl_error","status_checked_at":"2026-01-16T06:30:16.248Z","response_time":107,"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":["decorators","graphql","metadata","typescript"],"created_at":"2026-01-16T09:38:53.623Z","updated_at":"2026-01-16T09:38:53.736Z","avatar_url":"https://github.com/nicolasgere.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# This project is not maintained anymore\nDue to the lack of time. Sorry for that\n\nIf you are looking for alternatives, check out the [awesome-graphql list](https://github.com/chentsulin/awesome-graphql#lib-ts), where you can find similar libraries like [typegql](https://github.com/prismake/typegql), [TypeGraphQL](https://19majkel94.github.io/type-graphql) or [graphql-schema-decorator](https://github.com/indigotech/graphql-schema-decorator)\n.\n\n# GraphQL.ts\n[![Build Status](https://travis-ci.org/nicolasgere/graphql-ts.svg?branch=dev)](https://travis-ci.org/nicolasgere/graphql-ts?branch=dev)\n[![npm version](https://badge.fury.io/js/graphql-ts.svg)](https://badge.fury.io/js/graphql-ts)\n\n\nThe Typescrit implementation for GraphQL, a query language for APIs created by Facebook.\nSee specification here http://graphql.org/\n\n\n\n\n## Getting Started\n\nThat package is currently in development and not ready for PRODUCTION. Graphql.ts use decorator and metadata for generate a graphql.js model. The why of this package is to provide a suger syntax for Typescript and use the power of the typings.\nFeel free to contribute, any issues, pull request or stars are welcome.\n\n### Using GraphQL.ts\n\nInstall GraphQL.ts from npm\n\n```sh\nnpm install --save graphql-ts\n```\n\nWe use reflect-metadata for have type at the runtime, so we need to pass some parameters to the compilator\n\n```js\n\"compilerOptions\": {\n       \"module\": \"commonjs\",\n       \"target\": \"es6\",\n       \"emitDecoratorMetadata\": true,\n       \"experimentalDecorators\": true,\n   }\n```\n\n\n\nGraphQL.ts provides the capabilities to build the schema. This schema will be interprated by GraphQL.js\n\nFirst, build a GraphQL type schema which maps to your code base.\n\n```ts\nimport {field, objectType} from 'graphql-ts'\n\n@objectType\nclass root{\n  @field\n  hello():string{\n    return \"world\"\n  }\n}\n\n//That is the entry point of the schema\ngraphqlTs.init(new root());\n```\nThis code will generate at the runtime the equivalent  model\n\n```js\nimport {\n  GraphQLSchema,\n  GraphQLObjectType,\n  GraphQLString\n} from 'graphql';\n\nvar schema = new GraphQLSchema({\n  query: new GraphQLObjectType({\n    name: 'RootQueryType',\n    fields: {\n      hello: {\n        type: GraphQLString,\n        resolve() {\n          return 'world';\n        }\n      }\n    }\n  })\n});\n```\n\n\nThen, serve the result of a query against that schema.\n\n```ts\nimport {graphqlTs, field, objectType} from 'graphql-ts'\n\n\n@objectType\nclass root{\n  @field\n  hello():string{\n   return \"world\"\n  }\n}\ngraphqlTs.init(new root());\n\nvar queryString = '{ hello }';\ngraphqlTs.query(queryString).then(result =\u003e {\n\n  // Prints\n  // {\n  //   data: { hello: \"world\" }\n  // }\n  console.log(result);\n\n});\n```\n### Decorator\nGraphql-ts work with decorator for annotate the code and then generate the model\n+ \u003ccode\u003e\u003cstrong\u003e@objectType\u003c/strong\u003e\u003c/code\u003e create an object type with the class name as name\n```ts\n@objectType\nclass user{\n  @field\n  name:string\n}\n```\n\n+ \u003ccode\u003e\u003cstrong\u003e@inputType\u003c/strong\u003e\u003c/code\u003e create an input object type with the class name as name\n```ts\n@inputType\nclass userInput{\n    @field\n    name:string\n}\n```\n+ \u003ccode\u003e\u003cstrong\u003e@scalarType\u003c/strong\u003e\u003c/code\u003e create a scalar type, for more information about the scalar in graphql check [here](http://graphql.org/graphql-js/type/#graphqlscalartype)\n\n```ts\n@scalarType\nexport class DateQl {\n    @field\n    serialize(value: any) {\n        //you're code here\n    };\n    @field\n    parseValue(value: any) {\n        //you're code here\n    }\n    @field\n    parseLiteral(valueNode: any): any {\n        //you're code here\n    }\n```\n+ \u003ccode\u003e\u003cstrong\u003e@field\u003c/strong\u003e\u003c/code\u003e add the field in the model, if it's a function, it will be use as resolve.\nIn the resolve, 'this' will be the equivalent of _ in graphql, and the context will be in this.contextQl\n```ts\n@objectType\nclass user{\n  @field\n  name:string\n\n  @field\n  name:string\n\n  @field\n  fullName():string{\n    console.log(this.contextQl) //value of the context, by default req\n    return this.firstName + ' ' + this.lastName\n  }\n}\n```\n\n+ \u003ccode\u003e\u003cstrong\u003e@description(name:string)\u003c/strong\u003e\u003c/code\u003e add a description to the field or the object\n```ts\n@objectType\nclass user{\n  @field  @description('The name of the user')\n  name:string\n}\n```\n+ \u003ccode\u003e\u003cstrong\u003e@list\u003c/strong\u003e\u003c/code\u003e same as field but return a list, for more information about the list in graphql check [here](http://graphql.org/graphql-js/type/#graphqllist)\n+  \u003ccode\u003e\u003cstrong\u003e@returnType(Type)\u003c/strong\u003e\u003c/code\u003e Cause of lack in typescript about emit decorator for complexe object, when we returne an object\u003cT\u003e, Array\u003cT\u003e for exemple, we are not able to have the T type, so that's why we need to specify that T using the @returnType\n```ts\n@objectType\nclass user{\n  @field  @description('The name of the user')\n  name:string\n\n  @list @returnType(Number)\n  notes:number[]\n\n  @list @returnType(user)\n  friends():user[]{\n    return dataUsers({friends:this.name});\n   }\n}\n```\n\n+ \u003ccode\u003e\u003cstrong\u003e@required(['paramName'])\u003c/strong\u003e\u003c/code\u003e set a params as required\n```ts\n@objectType @description('voila enfin le root')\nexport class root {\n    @field @returnType(user) @required(['firstName'])\n    user(firstName:string):user{\n        return dataUsers({name:firstName}).firstOrDefault();\n    }\n}\n```\n+ \u003ccode\u003e\u003cstrong\u003e@nullable(boolean)\u003c/strong\u003e\u003c/code\u003e set a field or input nullable or not, by default is true\n```ts\n@inputType\nexport class userInput{\n  @field //nullable is true by default\n  firstName:string\n\n  @field @nullable(false)\n  lastName:string\n\n  @list @returnType(String) @nullable(false)\n  friends:string[]\n}\n```\n+ \u003ccode\u003e\u003cstrong\u003e@mutation\u003c/strong\u003e\u003c/code\u003e create a mutation, see [here](http://graphql.org/graphql-js/mutations-and-input-types/) for more information\n```ts\n   @mutation\n    addUser(userInput:userInput):user{\n      let newUser = new user();\n      dataUsers().push(\u003cany\u003enewUser);\n      return  newUser;\n    }\n```\n\n###More complex exemple\n\nFor more complexe case, check the [exemple](exemple/) folder.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicolasgere%2Fgraphql-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnicolasgere%2Fgraphql-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicolasgere%2Fgraphql-ts/lists"}