{"id":13499663,"url":"https://github.com/github/github-graphql-rails-example","last_synced_at":"2025-10-04T07:31:20.805Z","repository":{"id":65284115,"uuid":"64329252","full_name":"github/github-graphql-rails-example","owner":"github","description":"Example Rails app using GitHub's GraphQL API","archived":true,"fork":false,"pushed_at":"2019-01-23T23:00:38.000Z","size":236,"stargazers_count":279,"open_issues_count":1,"forks_count":51,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-09-30T00:06:08.247Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/github.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}},"created_at":"2016-07-27T17:41:41.000Z","updated_at":"2024-09-13T14:56:26.000Z","dependencies_parsed_at":"2023-01-16T15:00:37.275Z","dependency_job_id":null,"html_url":"https://github.com/github/github-graphql-rails-example","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/github%2Fgithub-graphql-rails-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fgithub-graphql-rails-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fgithub-graphql-rails-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fgithub-graphql-rails-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/github","download_url":"https://codeload.github.com/github/github-graphql-rails-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235227462,"owners_count":18956137,"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":[],"created_at":"2024-07-31T22:00:37.851Z","updated_at":"2025-10-04T07:31:15.472Z","avatar_url":"https://github.com/github.png","language":"Ruby","readme":"# GitHub GraphQL Rails example application\n\nDemonstrates how to use the [`graphql-client`](http://github.com/github/graphql-client) gem to build a simple repository listing web view against the [GitHub GraphQL API](https://developer.github.com/v4/guides/intro-to-graphql/).\n\n\u003cimg width=\"365\" src=\"https://cloud.githubusercontent.com/assets/137/18425026/a9929d7a-78f0-11e6-9fd4-f478470ad10b.png\"\u003e\n\nThe application structure is setup like a typical Rails app using controllers, views and routes with one key difference, no models. This app doesn't connect directly to any database. All the data is being fetched remotely from the GitHub GraphQL API. Instead of declaring resource models, data queries are declared right along side their usage in controllers and views. This allows an efficient single request to be constructed rather than making numerous REST requests to render a single view.\n\n## Table of Contents\n\nJump right into the code and read the inline documentation. The following is a suggested reading order:\n\n1. [app/controller/repositories_controller.rb](https://github.com/github/github-graphql-rails-example/blob/master/app/controllers/repositories_controller.rb) defines the top level GraphQL queries to fetch repository list and show pages.\n2. [app/views/repositories/index.html.erb](https://github.com/github/github-graphql-rails-example/blob/master/app/views/repositories/index.html.erb) shows the root template's listing query and composition over subviews.\n3. [app/views/repositories/_repositories.html.erb]( https://github.com/github/github-graphql-rails-example/blob/master/app/views/repositories/_repositories.html.erb) makes use of GraphQL connections to show the first couple items and a \"load more\" button.\n4. [app/views/repositories/show.html.erb](https://github.com/github/github-graphql-rails-example/blob/master/app/views/repositories/show.html.erb) shows the root template for the repository show page.\n5.  [app/controller/application_controller.rb](https://github.com/github/github-graphql-rails-example/blob/master/app/controllers/application_controller.rb) defines controller helpers for executing GraphQL query requests.\n6. [config/application.rb](https://github.com/github/github-graphql-rails-example/blob/master/config/application.rb) configures `GraphQL::Client` to point to the GitHub GraphQL endpoint.\n\n## Running locally\n\nFirst, you'll need a [GitHub API access token](https://help.github.com/articles/creating-an-access-token-for-command-line-use) to make GraphQL API requests. This should be set as a `GITHUB_ACCESS_TOKEN` environment variable as configured in [config/secrets.yml](https://github.com/github/github-graphql-rails-example/blob/master/config/secrets.yml).\n\n``` sh\n$ git clone https://github.com/github/github-graphql-rails-example\n$ cd github-graphql-rails-example/\n$ bundle install\n$ GITHUB_ACCESS_TOKEN=abc123 bin/rails server\n```\n\nAnd visit [http://localhost:3000/](http://localhost:3000/).\n\n## See Also\n\n* [Facebook's GraphQL homepage](http://graphql.org/)\n* [GitHub's GraphQL API Early Access program](https://developer.github.com/early-access/graphql)\n* [Ruby GraphQL Client library](https://github.com/github/graphql-client)\n* [Relay Modern example](https://github.com/github/github-graphql-relay-example)\n","funding_links":[],"categories":["Examples","Ruby","Implementations"],"sub_categories":["Ruby Examples","Ruby"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub%2Fgithub-graphql-rails-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgithub%2Fgithub-graphql-rails-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub%2Fgithub-graphql-rails-example/lists"}