by uesteibar

uesteibar / neuron

A GraphQL client for Elixir

217 Stars 31 Forks Last release: Not found Other 76 Commits 26 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:


Build Status Hex Version

A GraphQL client for Elixir.



def deps do
  [{:neuron, "~> 5.0.0"}]

JSON library

Neuron defaults to using Jason for JSON encoding and decoding. To use Jason, add it to your deps

{:jason, "~> 1.1"}

It is also possible to customize which JSON library that is used

Neuron.Config.set(json_library: AnotherJSONLibrary)


Neuron defaults to using HTTP(S) protocol with HTTPoison for Connecting to GraphQL endpoint. You can however customize that behaviour, by providing custom library, which should implement Neuron.Connection behaviour:

defmodule MyConnection do
  @behaviour Neuron.Connection

@impl Neuron.Connection def call(body, options) do IO.inspect("NEURON CALLED"), options) end end

Then set it up in config:

Neuron.Config.set(connection_module: MyConnection)


iex> Neuron.Config.set(url: "")

iex> Neuron.query(""" { films { count } } """)

Response will be:

{:ok, %Neuron.Response{body: %{"data" => %{"films" => %{ "count": 123 }}}, status_code: 200, headers: []}}

You can also run mutations

iex> Neuron.query(""" mutation createUser($name: String!) { createUser(name: $name) { id name } } """, %{name: "uesteibar"} )

You can also set url and headers as shown below

iex> Neuron.query(""" mutation createUser($name: String!) { createUser(name: $name) { id name } } """, %{name: "uesteibar"}, url: "", headers: [authorization: "Bearer "] )

More extensive documentation can be found at

Running locally

Clone the repository

git clone [email protected]:uesteibar/neuron.git

Install dependencies

cd neuron
mix deps.get

To run the tests

mix test

Style guide

Code is formatted with

mix format
mix credo
should not show warnings.

To format the code and run static code analysis with credo

mix format
mix credo


Pull requests are always welcome =)

The project uses standard-changelog to update the Changelog with each commit message and upgrade the package version. For that reason every contribution should have a title and body that follows the conventional commits standard conventions (e.g.

feat(connection): Make it smarter than Jarvis

To make this process easier, you can do the following:


npm i -g commitizen cz-conventional-changelog


as default
echo '{ "path": "cz-conventional-changelog" }' > ~/.czrc

Instead of

git commit
, you can now run
git cz

and follow the instructions to generate the commit message.

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.