Ben Wilson
Written By
Ben Wilson
Developer @ Cargosense

A full time Elixir developer at CargoSense, Ben is a co-author of the Absinthe GraphQL implementation for Elixir.

Getting Started

Install Dependencies

It’s time to start creating your project. The First you’ll need to have Elixir and Erlang installed on your machine. See

Unlike some frameworks, Phoenix works within the ordinary structure of a regular Elixir application. It does however bring its own generator to add in some basic Phoenix code to get you going.

This tutorial also uses Postgres as the database for this app. See here for installing postgres on your OS:

For OS X users it should be as simple as brew install postgres.

Setting up your App

You’re going to build an app called Community, and you can think of it as a miniature version of Hacker News, Slashdot, or any other site that displays content on the basis of user submissions and votes.

Say y to the question about fetching and installing dependencies, and then cd into the application directory.

In order to support GraphQL your application needs some additional dependencies which are configured in the mix.exs file. They go inside the list found within the defp deps do function:

{:absinthe_ecto, "~> 0.1.0"},
{:absinthe_plug, "~> 1.3.0"},

Add the following lines to priv/repo/seeds.exs so that you have some basic seed data:

alias Community.News.Link
alias Community.Repo

%Link{url: "", description: "The Best Query Language"} |> Repo.insert!
%Link{url: "", description: "Awesome GraphQL Client"} |> Repo.insert!

At this point the database tables created, and the migrations and the have been run. If at any point you want to clear everything out you can just run mix ecto.reset. If you get postgres connection issues be sure to double check your database credentials inside config/dev.exs.

Next Chapter


Learn how to define the GraphQL schema with Absinthe, implement query resolvers in Elixir and test your queries in a GraphiQL Playground.

Go to next chapter