{"id":16176003,"url":"https://github.com/chadian/ember-graphql-examples","last_synced_at":"2025-08-13T18:44:50.934Z","repository":{"id":70423367,"uuid":"147002872","full_name":"chadian/ember-graphql-examples","owner":"chadian","description":"Examples of using GraphQL in an Ember App","archived":false,"fork":false,"pushed_at":"2018-10-12T07:34:23.000Z","size":219,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-03T12:51:59.618Z","etag":null,"topics":["ember","ember-graphql","graphql","graphql-client","schema"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/chadian.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-09-01T13:58:25.000Z","updated_at":"2023-03-10T08:36:54.000Z","dependencies_parsed_at":"2023-03-13T20:24:02.042Z","dependency_job_id":null,"html_url":"https://github.com/chadian/ember-graphql-examples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/chadian/ember-graphql-examples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chadian%2Fember-graphql-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chadian%2Fember-graphql-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chadian%2Fember-graphql-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chadian%2Fember-graphql-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chadian","download_url":"https://codeload.github.com/chadian/ember-graphql-examples/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chadian%2Fember-graphql-examples/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270293662,"owners_count":24560057,"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","status":"online","status_checked_at":"2025-08-13T02:00:09.904Z","response_time":66,"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":["ember","ember-graphql","graphql","graphql-client","schema"],"created_at":"2024-10-10T04:47:07.328Z","updated_at":"2025-08-13T18:44:50.893Z","avatar_url":"https://github.com/chadian.png","language":"JavaScript","readme":"# ember-graphql-examples\n\n## Contributing\n\nAny contributions are grealty appreciated, feel free to open a pull request! 🎉\n\n## Clients\n\nThis app provides of the examples of:\n* Setting up GraphQL Clients\n* Different ember acceptance test techniques for GraphQL\n* Linting queries against a schema\n\nThe application also includes a built-in GraphQL query client available at [http://localhost:4200/api/graph](http://localhost:4200/api/graph).\n\nBehind the scenes it is using [ember-cli http-mocks](https://ember-cli.com/ember-data#mocks) with the\n[`json-graphql-server` express middleware](https://github.com/marmelab/json-graphql-server) to provide\na sample GraphQL api. The API is generated automatically from [json data](https://github.com/chadian/ember-graphql-examples/tree/master/server/data).\n\nThe http mock server is made available during tests by [`ember-cli-testem-http-mocks`](https://github.com/jasonmit/ember-cli-testem-http-mocks).\n\n### Querying\n| client                                                                          | .graphql file | string | generated by ember-data-adapter |\n|:--------------------------------------------------------------------------------|:--------------|:-------|:--------------------------------|\n| [`ember-apollo-client`](https://github.com/bgentry/ember-apollo-client)         | ✅             |        |                                 |\n| [`ember-graphql-adapter`](https://github.com/alphasights/ember-graphql-adapter) |               |        | ✅                               |\n| [`graphql-request`](https://github.com/prisma/graphql-request)                  |               | ✅      |                                 |\n| [`lokka`](https://github.com/kadirahq/lokka)                                    |               | ✅      |                                 |\n\n### Relationships\n\n\"Relationships\" in GraphQL are represented as a field with a list type.\n\n| client                                                                          | relationships |\n|:--------------------------------------------------------------------------------|:--------------|\n| [`ember-apollo-client`](https://github.com/bgentry/ember-apollo-client)         | ✅             |\n| [`ember-graphql-adapter`](https://github.com/alphasights/ember-graphql-adapter) | ✅ *           |\n| [`graphql-request`](https://github.com/prisma/graphql-request)                  | ✅             |\n| [`lokka`](https://github.com/kadirahq/lokka)                                    | ✅             |\n\n#### * `ember-graphql-adapter`\nThe way the `ember-graphql-adapter` generates its query for relationships, based on the model definition,\nis not compatible with the github api's use of [relay-style pagination](https://facebook.github.io/relay/graphql/connections.htm). Relay pagination wraps results in the `nodes` field, allows arguments for pagination, and more. There is likely manual work needed to map conventions between what the adapter expects and the queries it generates.\n\nThe `ember-graphql-adapter` is more closely coupled with the example in its [documentation](https://github.com/alphasights/ember-graphql-adapter#rails-example) using the [graphql gem](https://github.com/rmosolgo/graphql-ruby).\nIf your relationships aren't coupled in a strong relational way where your graphql types *are* entities, you might run into some problems.\n\n## Integration with `ember-simple-auth`\n\nLogin with a github access token at `/login`, if it is a valid token then it is set on the session\nand `ember-simple-auth` session is set to be \"authenticated\".\n\n| client                                                                          | `ember-simple-auth` integration |\n|:--------------------------------------------------------------------------------|:--------------------------------|\n| [`ember-apollo-client`](https://github.com/bgentry/ember-apollo-client)         | ✅ †                             |\n| [`ember-graphql-adapter`](https://github.com/alphasights/ember-graphql-adapter) | ✅                               |\n| [`graphql-request`](https://github.com/prisma/graphql-request)                  | ✅ *                             |\n| [`lokka`](https://github.com/kadirahq/lokka)                                    | ✅ *                             |\n\n#### † `ember-apollo-client` authentication links\nThe ember apollo client supports the [apollo links](https://github.com/apollographql/apollo-link), a way of chaining\nmodifications together. In this case we use the [`http-link`](https://www.apollographql.com/docs/link/links/http.html#context) to\nset the necessary `Authorization` header.\n\n#### * Re-generating client instances (`lokka`, `graphql-request`)\nThere are outstanding issues for lokka ([issue](https://github.com/kadirahq/lokka-transport-http/issues/24)) and graphql-request ([issue](https://github.com/prisma/graphql-request/pull/91)) that prevent dynamically changing/setting the authorization header. A wrapper service\nis setup in the same way for both `lokka` and `graphql-request` in which the `client` computed property depends on the `session.data.token`. Lingering `client` references that were saved in scope could fail to be used if they were setup with an old access token.\n\n## Linting queries against a schema with `eslint-plugin-graphql`\n\n* `.eslintrc.js` - Setup the `eslint-plugin-graphql` configuration with \n* `ember-cli-build.js`  - include an entry if you need a `.graphql` files linted\n* `.graphqlconfig` not required but if setup can be used by `eslint-plugin-graphql` for finding the schema\n\n## Testing\n\nThis example ember application also shows testing methods with [polly.js](https://netflix.github.io/pollyjs/), [`graphl-tools`](https://github.com/apollographql/graphql-tools) mock resolvers with [pretender.js](https://github.com/pretenderjs/pretender), and [`ember-cli-mirage-graphql`](https://github.com/kloeckner-i/ember-cli-mirage-graphql).\n\n## General Tooling\nThere is some standardization in the GraphQL community to use `.graphqlconfig` files.\nThis makes it easier to use with `graphql-cli` to generate a schema that is discoverable\nby the other tools.\n\n## Prerequisites\n\nYou will need the following things properly installed on your computer.\n\n* [Git](https://git-scm.com/)\n* [Node.js](https://nodejs.org/) (with npm)\n* [Ember CLI](https://ember-cli.com/)\n* [Google Chrome](https://google.com/chrome/)\n\n## Installation\n\n* `git clone \u003crepository-url\u003e` this repository\n* `cd ember-graphql-examples`\n* `npm install`\n\n## Running / Development\n\n* `ember serve`\n* Visit your app at [http://localhost:4200](http://localhost:4200).\n* Visit your tests at [http://localhost:4200/tests](http://localhost:4200/tests).\n\n### Code Generators\n\nMake use of the many generators for code, try `ember help generate` for more details\n\n### Running Tests\n\n* `ember test`\n* `ember test --server`\n\n### Linting\n\n* `npm run lint:js`\n* `npm run lint:js -- --fix`\n\n### Building\n\n* `ember build` (development)\n* `ember build --environment production` (production)\n\n### Deploying\n\nSpecify what it takes to deploy your app.\n\n## Further Reading / Useful Links\n\n* [ember.js](https://emberjs.com/)\n* [ember-cli](https://ember-cli.com/)\n* Development Browser Extensions\n  * [ember inspector for chrome](https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi)\n  * [ember inspector for firefox](https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/)\n","funding_links":[],"categories":["Packages"],"sub_categories":["Examples"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchadian%2Fember-graphql-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchadian%2Fember-graphql-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchadian%2Fember-graphql-examples/lists"}