{"id":18448620,"url":"https://github.com/tomyitav/graphql-server-typed","last_synced_at":"2025-07-15T09:05:46.429Z","repository":{"id":28779908,"uuid":"109181324","full_name":"tomyitav/graphql-server-typed","owner":"tomyitav","description":"Using typescript and gql-code-gen for easy graphql setup","archived":false,"fork":false,"pushed_at":"2024-03-26T14:48:44.000Z","size":984,"stargazers_count":34,"open_issues_count":49,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-04-15T01:11:03.856Z","etag":null,"topics":["apollo-server","dependency-injection","graphql","mvc-architecture","nodejs","typescript"],"latest_commit_sha":null,"homepage":"https://medium.com/@tomyitav/graphql-server-for-enterprise-development-675d2ff2d0ed","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/tomyitav.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}},"created_at":"2017-11-01T20:36:53.000Z","updated_at":"2024-04-16T22:49:37.535Z","dependencies_parsed_at":"2023-01-14T10:01:17.175Z","dependency_job_id":"f2c6520f-481a-4026-885f-a9f2bc5ccac7","html_url":"https://github.com/tomyitav/graphql-server-typed","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tomyitav/graphql-server-typed","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomyitav%2Fgraphql-server-typed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomyitav%2Fgraphql-server-typed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomyitav%2Fgraphql-server-typed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomyitav%2Fgraphql-server-typed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomyitav","download_url":"https://codeload.github.com/tomyitav/graphql-server-typed/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomyitav%2Fgraphql-server-typed/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265424342,"owners_count":23762880,"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":["apollo-server","dependency-injection","graphql","mvc-architecture","nodejs","typescript"],"created_at":"2024-11-06T07:16:33.859Z","updated_at":"2025-07-15T09:05:46.401Z","avatar_url":"https://github.com/tomyitav.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# graphql-server-typed\n\n[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n[![renovate-app badge][renovate-badge]][renovate-app]\n\n[renovate-badge]: https://img.shields.io/badge/renovate-app-blue.svg\n[renovate-app]: https://renovateapp.com/\n\nBoilerplate project for [create-graphql-app](https://github.com/tomyitav/create-graphql-app) cli.\n\nCreate a fully configured, production ready graphql server, using\n\n+ typescript\n+ [graphql-code-generator](https://github.com/dotansimha/graphql-code-generator)\n+ graphql-subscriptions\n+ merge-graphql-schemas\n+ Dependency injection with `injection-js`\n\nThis project demonstrates how to generate typescript types from graphql schema, using Graphql code generetor library.\n\n## Installation\n\nClone the repository and run `npm install`\n\n```\ngit clone https://github.com/tomyitav/graphql-server-typed.git\nnpm install\n```\n\n## Build and start server instance\n\n#### Build command\n\nRunning the command\n```\nnpm run build\n```\n\nOr on windows machine, run\n```\nnpm run build:win\n```\n\nwill generate typescript types, and transpile code to *dist* folder\n\n#### How to start server instance after building\n\n```\nnpm start\n```\n\n## Run server directly with ts-node\n\n```\nnpm start:dev\n```\n\n#### Watch for code changes\n\n```\nnpm run start:watch\n```\n\nThis will monitor your changes and will automatically restart the server.\n\nThe server will run on port 8080.\nYou can change this by editing the config file.\n\n## Code Formatting\n\nWe use Prettier and Tslint to format and enforce standards on our code. \u003c/br\u003e\nBoth will run on the project automatically before each commit. \u003c/br\u003e\n\nPrettier rewrites code according to the .prettierrc.json configuration file. \u003c/br\u003e\nIf you want to activate prettier manually (on all .ts files inside src folder) without committing, run: \u003c/br\u003e\n\n```\nnpm run prettier\n```\n\nTslint will check rules found in the tslint.json configuration file. \u003cbr/\u003e\nIf you want to check tslint manually (on all .ts files inside src folder) without committing, run: \u003c/br\u003e\n\n```\nnpm run tslint\n```\n\n\n## Type generation using gql codegen\n\n```\nnpm run generate\n```\n\nThis will automatically generate types in types.d.ts file!\ngenerate command is executed in every build\n\n## Project structure\n\nWe use the function `makeExecutableSchema()` from graphql-tools to to combine our\ntypes and resolvers. Instead of passing one large string for our schema, we\nsplit our types and resolvers to multiple files, located in graphql directory in\ntypes and resolvers directories. This way, we avoid schema complexity by using\nmerge-graphql-schemas:\n\n```js\n  import * as path from \"path\";\n  import {makeExecutableSchema} from \"graphql-tools\";\n  import {fileLoader, mergeTypes, mergeResolvers} from \"merge-graphql-schemas\";\n  import {GraphQLSchema} from \"graphql\";\n\n  const typesArray = fileLoader(path.join(__dirname, '../types'), { recursive: true });\n  const resolversArray = fileLoader(path.join(__dirname, '../resolvers'));\n  const allTypes = mergeTypes(typesArray);\n  const allResolvers = mergeResolvers(resolversArray);\n  let schema: GraphQLSchema;\n  schema= makeExecutableSchema({\n      typeDefs: allTypes,\n      resolvers: allResolvers\n  });\n\n  export default schema;\n```\n\nSo as your project grows - you can extend the schema by adding new type in types\ndirectory, and adding matching resolver file in resolvers directory. The schema\nis updated automatically.\n\n## Deploy server to production :rocket:\nFirst, make sure you have [now-cli](https://zeit.co/now) installed.\nThen, execute the following command:\n\n```\nnpm run deploy\n```\n\nThat's it! The server will be deployed on *now*\n\n## Run server as AWS lambda\n\nSee the following [project](https://github.com/tomyitav/apollo-typed-lambda) for setting up aws lambda integration\n\n## Connect to the server from client app\n\nSee the following [example](https://github.com/tomyitav/apollo-angular-client-starter) on how to connect to the server using apollo-angular.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomyitav%2Fgraphql-server-typed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomyitav%2Fgraphql-server-typed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomyitav%2Fgraphql-server-typed/lists"}