Need help with plug_graphql?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

127 Stars 8 Forks Other 122 Commits 5 Opened issues


Plug (Phoenix) integration for GraphQL Elixir

Services available


Need anything else?

Contributors list

GraphQL Plug

Build Status Public Slack Discussion

is a Plug integration for the GraphQL Elixir implementation of Facebook's GraphQL.

This Plug allows you to easily mount a GraphQL endpoint in Phoenix. This example project shows you how:


  1. Make a new Phoenix app, or add it to your existing app.

    mix hello_graphql
    cd hello_graphql
    git clone
  2. Add

    to your list of dependencies and applications in
    and install the package with
    mix deps.get
    def application do
      # Add the application to your list of applications.
      # This will ensure that it will be included in a release.
      [applications: [:logger, :plug_graphql]]

    def deps do [{:plug_graphql, "~> 0.3.1"}] end


  1. Define a simple schema in

    defmodule TestSchema do
      def schema do
          query: %GraphQL.Type.ObjectType{
            name: "Hello",
            fields: %{
              greeting: %{
                type: %GraphQL.Type.String{},
                args: %{
                  name: %{
                    type: %GraphQL.Type.String{}
                resolve: {TestSchema, :greeting}

    def greeting(_, %{name: name}, ), do: "Hello, #{name}!" def greeting(, _, _), do: "Hello, world!" end

  2. Your

    pipeline should have this as a minimum:
    pipeline :api do
      plug :accepts, ["json"]
  3. Mount the GraphQL endpoint as follows:

    scope "/api" do
      pipe_through :api

    forward "/", GraphQL.Plug, schema: {TestSchema, :schema} end

  4. Start Phoenix

    mix phoenix.server
  5. Open your browser to

    and you should see something like this:
      "data": {
        "greeting": "Hello, world!"


This is pretty early days, the GraphQL Elixir ecosystem needs a lot more work to be useful.

However we can't get there without your help, so any questions, bug reports, feedback, feature requests and/or PRs are most welcome!


Thanks and appreciation goes to the following contributors for PRs, discussions, answering many questions and providing helpful feedback:

  • Daniel Neighman (
  • Chris McCord (
  • Aaron Weiker (
  • James Hiscock (

Thanks also to everyone who has submitted PRs, logged issues, given feedback or asked questions.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.