{"id":20905617,"url":"https://github.com/chaudinh/typegraphql","last_synced_at":"2026-04-14T03:32:14.600Z","repository":{"id":36510373,"uuid":"213723251","full_name":"ChauDinh/typegraphql","owner":"ChauDinh","description":"Build a server side with typescript, express, graphql and other cool stuffs","archived":false,"fork":false,"pushed_at":"2023-01-11T22:21:28.000Z","size":989,"stargazers_count":1,"open_issues_count":26,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-19T14:19:11.540Z","etag":null,"topics":["bcryptjs","class-validator","connect-redis","expressjs","graphql","javascript","postgresql","redis-client","typegraphql","typeorm","typescript"],"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/ChauDinh.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}},"created_at":"2019-10-08T18:39:19.000Z","updated_at":"2019-12-15T06:59:18.000Z","dependencies_parsed_at":"2023-01-17T02:16:22.174Z","dependency_job_id":null,"html_url":"https://github.com/ChauDinh/typegraphql","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChauDinh%2Ftypegraphql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChauDinh%2Ftypegraphql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChauDinh%2Ftypegraphql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChauDinh%2Ftypegraphql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ChauDinh","download_url":"https://codeload.github.com/ChauDinh/typegraphql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243296651,"owners_count":20268625,"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":["bcryptjs","class-validator","connect-redis","expressjs","graphql","javascript","postgresql","redis-client","typegraphql","typeorm","typescript"],"created_at":"2024-11-18T13:25:57.688Z","updated_at":"2025-12-29T03:57:44.453Z","avatar_url":"https://github.com/ChauDinh.png","language":"TypeScript","readme":"# TypeGraphQL series\n\nThis repo is my practice typescript and graphql along with other stuffs.\n\n## What we will cover?\n\n- setup type-graphql: how we can setup a type-graphql server\n\n- register resolver: how we can create register and validate user input, throw errors back to user.\n\n- login resolver: how we can know whether user login\n\n- authorization/middleware: protect a row/query for just login user\n\n- confirm email: sending an email to user to confirm account.\n\n- forgot/change password: reset password in database (I use PostgreSQL)\n\n- higher order resolvers: writing programmatically typegraphql resolvers as functions basically (for resuse)\n\n### Setup type-graphql server\n\nThis project I use `yarn` as a package management. You can use `npm` if you like. Then I install a few things for Apollo Server Express.\n\n```\nyarn add apollo-server-express express graphql reflect-metadata type-graphql\n```\n\nWe need `reflec-metadata` since it is a library that we need for type-graphql. We also need the type versions (as we use Typescript) for those libraries\n\n```\nyarn add -D @types/express @types/graphql @types/node typescript nodemon ts-node\n```\n\nHere are what we need, if you have any trouble, please check the official site of `type-graphql` first: [Installation](https://typegraphql.ml/docs/installation.html)\n\nThen, we need create a `tsconfig.json` file for typescript know how to compile our code. I use this config: [tsconfig.json (Ben Awad)](https://github.com/benawad/monorepo-boilerplate/blob/9257937fa169d8cb2ee036d94b08ae9aee8072d1/packages/server/tsconfig.json) and change a little bit, you can check the `tsconfig.json` in my github for this project as well.\n\n```typescript\nimport { ApolloServer } from \"apollo-server-express\";\nimport * as Express from \"express\";\nimport { buildSchema, Resolver, Query } from \"type-graphql\";\n\n@Resolver()\nclass HelloResolver {\n  @Query(() =\u003e String)\n  async hello() {\n    return \"hello, world\";\n  }\n}\n\nconst main = async () =\u003e {\n  const schema = await buildSchema({\n    resolvers: [HelloResolver]\n  });\n  const apolloServer = new ApolloServer({ schema });\n\n  const app = Express();\n\n  apolloServer.applyMiddleware({ app });\n\n  app.listen(4000, () =\u003e\n    console.log(\"server started on http://localhost:4000\")\n  );\n};\n\nmain();\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchaudinh%2Ftypegraphql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchaudinh%2Ftypegraphql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchaudinh%2Ftypegraphql/lists"}