{"id":13499525,"url":"https://github.com/graphql-elixir/plug_graphql","last_synced_at":"2025-10-21T17:52:07.738Z","repository":{"id":55117890,"uuid":"46525290","full_name":"graphql-elixir/plug_graphql","owner":"graphql-elixir","description":"Plug (Phoenix) integration for GraphQL Elixir ","archived":true,"fork":false,"pushed_at":"2021-01-08T19:53:42.000Z","size":106,"stargazers_count":126,"open_issues_count":5,"forks_count":7,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-10-01T06:24:32.002Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/graphql-elixir.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-19T22:51:09.000Z","updated_at":"2024-07-25T05:02:40.000Z","dependencies_parsed_at":"2022-08-14T12:31:08.570Z","dependency_job_id":null,"html_url":"https://github.com/graphql-elixir/plug_graphql","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-elixir%2Fplug_graphql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-elixir%2Fplug_graphql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-elixir%2Fplug_graphql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-elixir%2Fplug_graphql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/graphql-elixir","download_url":"https://codeload.github.com/graphql-elixir/plug_graphql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222465393,"owners_count":16989005,"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:34.150Z","updated_at":"2025-10-21T17:52:07.407Z","avatar_url":"https://github.com/graphql-elixir.png","language":"Elixir","readme":"# GraphQL Plug\n\n[![Build Status](https://travis-ci.org/graphql-elixir/plug_graphql.svg)](https://travis-ci.org/graphql-elixir/plug_graphql)\n[![Public Slack Discussion](https://graphql-slack.herokuapp.com/badge.svg)](https://graphql-slack.herokuapp.com/)\n\n`plug_graphql` is a [Plug](https://github.com/elixir-lang/plug) integration for the [GraphQL Elixir](https://github.com/graphql-elixir/graphql) implementation of Facebook's GraphQL.\n\nThis [Plug](https://github.com/elixir-lang/plug) allows you to easily mount a GraphQL endpoint in Phoenix. This example project shows you how:\n\n* [Phoenix GraphQL example project](https://github.com/graphql-elixir/hello_graphql_phoenix)\n\n\n## Installation\n\n  1. Make a new Phoenix app, or add it to your existing app.\n\n    ```sh\n    mix phoenix.new hello_graphql\n    cd hello_graphql\n    ```\n\n    ```sh\n    git clone https://github.com/graphql-elixir/hello_graphql_phoenix\n    ```\n\n  2. Add `plug_graphql` to your list of dependencies and applications in `mix.exs` and install the package with `mix deps.get`.\n\n    ```elixir\n    def application do\n      # Add the application to your list of applications.\n      # This will ensure that it will be included in a release.\n      [applications: [:logger, :plug_graphql]]\n    end\n\n    def deps do\n      [{:plug_graphql, \"~\u003e 0.3.1\"}]\n    end\n    ```\n\n## Usage\n\n  1. Define a simple schema in `web/graphql/test_schema.ex`:\n\n    ```elixir\n    defmodule TestSchema do\n      def schema do\n        %GraphQL.Schema{\n          query: %GraphQL.Type.ObjectType{\n            name: \"Hello\",\n            fields: %{\n              greeting: %{\n                type: %GraphQL.Type.String{},\n                args: %{\n                  name: %{\n                    type: %GraphQL.Type.String{}\n                  }\n                },\n                resolve: {TestSchema, :greeting}\n              }\n            }\n          }\n        }\n      end\n\n      def greeting(_, %{name: name}, _), do: \"Hello, #{name}!\"\n      def greeting(_, _, _), do: \"Hello, world!\"\n    end\n    ```\n\n  2. Your `api` pipeline should have this as a minimum:\n\n    ```elixir\n    pipeline :api do\n      plug :accepts, [\"json\"]\n    end\n    ```\n\n  3. Mount the GraphQL endpoint as follows:\n\n    ```elixir\n    scope \"/api\" do\n      pipe_through :api\n\n      forward \"/\", GraphQL.Plug, schema: {TestSchema, :schema}\n    end\n    ```\n\n  4. Start Phoenix\n\n    ```sh\n    mix phoenix.server\n    ```\n\n  5. Open your browser to `http://localhost:4000/api?query={greeting}` and you should see something like this:\n\n    ```json\n    {\n      \"data\": {\n        \"greeting\": \"Hello, world!\"\n      }\n    }\n    ```\n\n## Contributions\n\nThis is pretty early days, the GraphQL Elixir ecosystem needs a lot more work to be useful.\n\nHowever we can't get there without your help, so any questions, bug reports, feedback,\nfeature requests and/or PRs are most welcome!\n\n## Acknowledgements\n\nThanks and appreciation goes to the following contributors for PRs, discussions, answering many questions and providing helpful feedback:\n\n* Daniel Neighman (https://github.com/hassox)\n* Chris McCord (https://github.com/chrismccord)\n* Aaron Weiker (https://github.com/aweiker)\n* James Hiscock (https://github.com/bockit)\n\nThanks also to everyone who has submitted PRs, logged issues, given feedback or asked questions.\n","funding_links":[],"categories":["Libraries","Framework Components","Implementations"],"sub_categories":["Elixir Libraries","Elixir"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphql-elixir%2Fplug_graphql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgraphql-elixir%2Fplug_graphql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphql-elixir%2Fplug_graphql/lists"}