{"id":39456199,"url":"https://github.com/zakodium/adonis-apollo","last_synced_at":"2026-01-18T04:36:15.783Z","repository":{"id":46780391,"uuid":"205339434","full_name":"zakodium/adonis-apollo","owner":"zakodium","description":"Apollo GraphQL server for AdonisJS 5","archived":false,"fork":false,"pushed_at":"2024-08-27T14:11:41.000Z","size":124,"stargazers_count":52,"open_issues_count":11,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-10-19T21:28:30.638Z","etag":null,"topics":["adonisjs","apollo","graphql","provider"],"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/zakodium.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-08-30T08:29:29.000Z","updated_at":"2025-08-14T08:10:06.000Z","dependencies_parsed_at":"2023-12-19T16:04:46.369Z","dependency_job_id":"19ef76b1-f32f-4c95-97fa-2c0d24829fa3","html_url":"https://github.com/zakodium/adonis-apollo","commit_stats":{"total_commits":88,"total_committers":5,"mean_commits":17.6,"dds":"0.20454545454545459","last_synced_commit":"bab5f10d482b7418ebc93cd79dfdca4330c608df"},"previous_names":[],"tags_count":46,"template":false,"template_full_name":null,"purl":"pkg:github/zakodium/adonis-apollo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zakodium%2Fadonis-apollo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zakodium%2Fadonis-apollo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zakodium%2Fadonis-apollo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zakodium%2Fadonis-apollo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zakodium","download_url":"https://codeload.github.com/zakodium/adonis-apollo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zakodium%2Fadonis-apollo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28529859,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["adonisjs","apollo","graphql","provider"],"created_at":"2026-01-18T04:36:15.721Z","updated_at":"2026-01-18T04:36:15.775Z","avatar_url":"https://github.com/zakodium.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# adonis-apollo\n\nApollo GraphQL server for AdonisJS 5.\n\n\u003ch3 align=\"center\"\u003e\n\n  \u003ca href=\"https://www.zakodium.com\"\u003e\n    \u003cimg src=\"https://www.zakodium.com/brand/zakodium-logo-white.svg\" width=\"50\" alt=\"Zakodium logo\" /\u003e\n  \u003c/a\u003e\n\n  \u003cp\u003e\n    Maintained by \u003ca href=\"https://www.zakodium.com\"\u003eZakodium\u003c/a\u003e\n  \u003c/p\u003e\n\n[![NPM version][npm-image]][npm-url]\n[![build status][ci-image]][ci-url]\n[![Test coverage][codecov-image]][codecov-url]\n[![npm download][download-image]][download-url]\n\n\u003c/h3\u003e\n\n\u003e [!WARNING]\n\u003e This module is unstable and in active development. Use at your own risk.\n\n## Installation\n\n```console\nnpm i adonis-apollo\nnode ace configure adonis-apollo\n```\n\nThen add the following to the `\"metaFiles\"` array in `.adonisrc.json`:\n\n```json\n{\n  \"pattern\": \"app/Schemas/*\",\n  \"reloadServer\": true\n}\n```\n\n## Usage\n\nBind the apollo server to your AdonisJs application.  \nIn `start/routes.ts`:\n\n```ts\nimport ApolloServer from '@ioc:Zakodium/Apollo/Server';\n\nApolloServer.applyMiddleware();\n\n// You can also call `applyMiddleware` inside a route group:\nRoute.group(() =\u003e {\n  ApolloServer.applyMiddleware();\n}).middleware('auth');\n```\n\n### Schema\n\nThe GraphQL schema should be defined in `.graphql` files (by default located in `app/Schemas`).\nThe schema folders are scanned recursively.\n\n```graphql\ntype Query {\n  hello: String!\n  rectangle: Rectangle!\n}\n\ntype Rectangle {\n  width: Int!\n  height: Int!\n  area: Int!\n}\n```\n\n### Resolvers\n\nResolvers should be exported from `.ts` files (by default located in `app/Resolvers`).\nOnly the first level of resolver folders is scanned, so you can use sub-folders put additional code.\n\nAll resolvers are merged into a single object, so you can define them in multiple files.\n\nThere are two supported ways of defining resolvers:\n\n#### Exporting classes\n\nMultiple classes can be exported from a single file.\nThe name of the exported binding will be used as the name of the GraphQL type.\n\n```ts\nexport class Query {\n  hello() {\n    return 'world';\n  }\n\n  rectangle() {\n    return { width: 10, height: 20 };\n  }\n}\n\nexport class Rectangle {\n  area(rectangle) {\n    return rectangle.width * rectangle.height;\n  }\n}\n```\n\nIt is also possible to add the suffix `Resolvers` to the exported name to avoid potential conflicts:\n\n```ts\ninterface Rectangle {\n  width: number;\n  height: number;\n}\n\nexport class RectangleResolvers {\n  area(rectangle: Rectangle) {\n    return rectangle.width * rectangle.height;\n  }\n}\n```\n\n#### Exporting a single object\n\nWhen a single object is exported as default, it is assumed to be a map of resolvers.\n\n```ts\ninterface Rectangle {\n  width: number;\n  height: number;\n}\n\nexport default {\n  Query: {\n    hello: () =\u003e 'world',\n    rectangle() {\n      return { width: 10, height: 20 };\n    },\n  },\n  Rectangle: {\n    area: (rectangle: Rectangle) =\u003e rectangle.width * rectangle.height,\n  },\n};\n```\n\n### Troubleshooting\n\n#### Error: Query root type must be provided\n\nApollo requires a query root type to be defined in your schema.\nTo fix this error, create a file `app/Schemas/SomeSchema.graphql` with at least\na `Query` type.\n\nFor example:\n\n```graphql\ntype Query {\n  hello: String!\n}\n```\n\n#### BadRequestError: This operation has been blocked as a potential Cross-Site Request Forgery (CSRF)\n\nThis error may happen if you try to access the GraphQL endpoint from a browser.\nMake sure `forceContentNegotiationTo` is not unconditionally set to `'application/json'` in `config/app.ts`.\nYou can either disable this option or set it to a function that ignores the GraphQL route.\n\n## Configuration\n\n### Landing page\n\nTo configure the default landing page, you can pass `apolloProductionLandingPageOptions`\nor `apolloLocalLandingPageOptions` to the config. Another possibility is to\noverride the `plugins` config in `config/apollo.ts`.\n\nThe default configuration is:\n\n```ts\nimport {\n  ApolloServerPluginLandingPageLocalDefault,\n  ApolloServerPluginLandingPageProductionDefault,\n} from '@apollo/server/plugin/landingPage/default';\n\nconst plugins = [\n  Env.get('NODE_ENV') === 'production'\n    ? ApolloServerPluginLandingPageProductionDefault({\n        footer: false,\n        ...apolloProductionLandingPageOptions,\n      })\n    : ApolloServerPluginLandingPageLocalDefault({\n        footer: false,\n        ...apolloLocalLandingPageOptions,\n      }),\n];\n```\n\nSee the [Apollo Graphql documentation](https://www.apollographql.com/docs/apollo-server/api/plugin/landing-pages/) to\nlearn how to customize or disable the landing page.\n\n### Scalars\n\nAll the resolvers from `graphql-scalars` are installed automatically.\n\nTo enable any of the scalar types documented in [`graphql-scalars`](https://www.graphql-scalars.dev/docs/scalars/big-int/),\nfor example `DateTime`, just add a scalar line to your schema:\n\n```graphql\nscalar DateTime\n```\n\n### Uploads\n\nTo enable support for inline multipart/form-data uploads using [graphql-upload](https://github.com/jaydenseric/graphql-upload):\n\n- Set `enableUploads: true` in `config/apollo.ts`.\n- Update the config of the body parser in `config/bodyparser.ts` by adding your GraphQL route (by default: `/graphql`) to the `multipart.processManually` array.\n- Add the Upload scalar to your schema: `scalar Upload`.\n- Make sure your GraphQL upload client sends the `'Apollo-Require-Preflight'` header, otherwise Apollo will reject multipart requests\n  to prevent [CSRF attacks](https://www.apollographql.com/docs/apollo-server/security/cors/#graphql-upload).\n\n## License\n\n[MIT](./LICENSE)\n\n[npm-image]: https://img.shields.io/npm/v/adonis-apollo.svg\n[npm-url]: https://www.npmjs.com/package/adonis-apollo\n[ci-image]: https://github.com/zakodium/adonis-apollo/workflows/Node.js%20CI/badge.svg?branch=main\n[ci-url]: https://github.com/zakodium/adonis-apollo/actions?query=workflow%3A%22Node.js+CI%22\n[codecov-image]: https://img.shields.io/codecov/c/github/zakodium/adonis-apollo.svg\n[codecov-url]: https://codecov.io/gh/zakodium/adonis-apollo\n[download-image]: https://img.shields.io/npm/dm/adonis-apollo.svg\n[download-url]: https://www.npmjs.com/package/adonis-apollo\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzakodium%2Fadonis-apollo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzakodium%2Fadonis-apollo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzakodium%2Fadonis-apollo/lists"}