{"id":14976207,"url":"https://github.com/zaiste/next-graphql-server","last_synced_at":"2026-03-03T14:39:31.703Z","repository":{"id":40236767,"uuid":"466322094","full_name":"zaiste/next-graphql-server","owner":"zaiste","description":"next-graphql-server is a library for building production-grade GraphQL servers using Next.js with API Routes","archived":false,"fork":false,"pushed_at":"2023-10-25T03:44:02.000Z","size":141,"stargazers_count":87,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-08T11:12:10.741Z","etag":null,"topics":["graphql","graphql-js","graphql-server","graphql-tools","nextjs","nextjs-plugin","nextjs-serverless","nextjs-typescript","typescript"],"latest_commit_sha":null,"homepage":"https://demo-graphql.vercel.app/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zaiste.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,"publiccode":null,"codemeta":null}},"created_at":"2022-03-05T01:52:58.000Z","updated_at":"2025-03-01T17:05:22.000Z","dependencies_parsed_at":"2024-09-18T19:02:38.198Z","dependency_job_id":"c13ea876-1dc4-4de1-b2ae-ef1a24876cdb","html_url":"https://github.com/zaiste/next-graphql-server","commit_stats":{"total_commits":41,"total_committers":1,"mean_commits":41.0,"dds":0.0,"last_synced_commit":"96d24c6ab0b8362fd08d9bc19627d4f5af19015b"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/zaiste/next-graphql-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaiste%2Fnext-graphql-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaiste%2Fnext-graphql-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaiste%2Fnext-graphql-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaiste%2Fnext-graphql-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zaiste","download_url":"https://codeload.github.com/zaiste/next-graphql-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaiste%2Fnext-graphql-server/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259884437,"owners_count":22926443,"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":["graphql","graphql-js","graphql-server","graphql-tools","nextjs","nextjs-plugin","nextjs-serverless","nextjs-typescript","typescript"],"created_at":"2024-09-24T13:53:30.571Z","updated_at":"2026-03-03T14:39:26.666Z","avatar_url":"https://github.com/zaiste.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# next-graphql-server\n\n`next-graphql-server` is an easy to use Next.js library for creating performant GraphQL endpoints on top of [Next.js API Routes](https://nextjs.org/docs/api-routes/introduction).\n\nStart building GraphQL servers with Next.js.\n\n## Features\n\n* built using [Envelop](https://www.envelop.dev) and [Helix](https://graphql-helix.vercel.app) - stackable and easy to extend architecture\n* supports Vercel Edge functions \n\n## Getting Started \n\nCreate a Next.js project:\n\n```\npnpm create next-app --typescript\n```\n\nAdd `next-graphql-server` as a dependency to your Next.js project:\n\n```\npnpm add next-graphql-server\n```\n\n**Note**: `pnpm` is preferred, but you can also use `npm` or `yarn`\n\n```\nnpm install next-graphql-server\n```\n\n```\nyarn add next-graphql-server\n```\n\n## Usage\n\n`next-graphql-server` uses [Next.js API Routes](https://nextjs.org/docs/api-routes/introduction). Create the `pages/api/graphql.ts` with the following content:\n\n**Note**: The file in `pages/api` must be named `graphql`\n\n### with `graphql`\n\nAdd `graphql` \n\n```\npnpm add graphql\n```\n\n```ts\nimport { createGraphQLHandler } from \"next-graphql-server\";\nimport {\n  GraphQLObjectType,\n  GraphQLSchema,\n  GraphQLString,\n} from \"graphql\";\n\nconst schema = new GraphQLSchema({\n  query: new GraphQLObjectType({\n    name: \"Query\",\n    fields: () =\u003e ({\n      hello: {\n        type: GraphQLString,\n        resolve: () =\u003e \"world\",\n      },\n    }),\n  }),\n});\n\nconst handler = createGraphQLHandler(schema);\nexport default handler;\n```\n\n### with `@graphql-tools` \n\nAdd `@graphql-tools/schema`\n\n```\npnpm add @graphql-tools/schema\n```\n\nIn `pages/api/graphql.ts` define your handler as shown below:\n\n```ts\nimport { createGraphQLHandler } from \"next-graphql-server\";\nimport { makeExecutableSchema } from \"@graphql-tools/schema\";\n\nexport const schema = makeExecutableSchema({\n  typeDefs: /* GraphQL */ `\n    type Query {\n      hello: String!\n    }\n  `,\n  resolvers: {\n    Query: {\n      hello: () =\u003e 'World',\n    },\n  },\n});\n\nconst handler = createGraphQLHandler(schema);\nexport default handler;\n```\n\n### with Pothos","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzaiste%2Fnext-graphql-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzaiste%2Fnext-graphql-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzaiste%2Fnext-graphql-server/lists"}