{"repo":"MichalLytek/type-graphql","free":true,"listed":false,"github":"https://github.com/MichalLytek/type-graphql","clone":"git clone https://github.com/MichalLytek/type-graphql.git","description":"Create GraphQL schema and resolvers with TypeScript, using classes and decorators!","language":"TypeScript","stars":8092,"topics":["graphql","typescript","decorators","api","controllers","schema","gql","resolvers","graphql-js","graphql-schema"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"TypeGraphQL Create GraphQL schema and resolvers with TypeScript, using classes and decorators! Introduction TypeGraphQL makes developing GraphQL APIs an enjoyable process, i.e. by defining the schema using only classes and a bit of decorator magic. So, to create types like object type or input type, we use a kind of DTO class. For example, to declare Recipe type we simply create a class and annotate it with decorators: And we get the corresponding part of the schema in SDL: Then we can create queries, mutations and field resolvers. For this purpose, we use controller-like classes that are called \"resolvers\" by convention. We can also use awesome features like dependency injection and auth guards: And in this simple way, we get this part of the schema in SDL: Motivation We all know that GraphQL is great and solves many problems we have with REST APIs, like Over-Fetching and Under-Fetching. But developing a GraphQL API in Node.js with TypeScript is sometimes a bit of a pain. Why? Let's take a look at the steps we usually have to take. First, we create all the GraphQL types in schema.graphql using SDL. Then we create our data models using ORM classes, which represent our DB entities. Then we start to write resolvers for our queries, mutations and fields, but this forces us to first create TS interfaces for all arguments, inputs, and even object types. Only then can we implement the resolvers using weird generic signatures and manually performing common tasks, like validation, au","default_branch":null,"files":null,"tree":[],"storefront":"/r/MichalLytek","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/MichalLytek/type-graphql/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}