Absinthe brings a full GraphQL implementation to Elixir. Teams use it to define schemas, run queries, and expose APIs from Phoenix or Plug apps.
Overview
Absinthe is a GraphQL implementation aimed at Elixir developers who want an idiomatic, readable API for building and serving GraphQL. Schemas are defined with macros that are checked at compile time, which the project says helps catch structural mistakes early and supports steady runtime behavior.
The query pipeline is configurable: parsers, validations, and resolution steps can be added, swapped, or removed, including on a per-document basis. Resolution supports asynchronous fields, batched loading to ease N+1 query patterns, and a plugin model for further extension.
Safety features include complexity analysis with configurable limits and options around precompiled versus ad hoc documents. Schemas can be written in snake_case Elixir style while responses can be exposed in camelCase for clients, or via a custom adapter.
Backend integrations highlighted in the material include Phoenix and Plug, with additional frontend-oriented support for Relay alongside other GraphQL clients. The package is installed from Hex and includes Mix tasks for schema metadata.
Key features
- Compile-time schema macros
- Configurable query pipeline
- Asynchronous field resolution
- Batched field resolution
- Complexity analysis and limits
- Snake_case to camelCase schema naming
- Phoenix and Plug backend support
- Relay frontend integration
Use cases
- GraphQL APIs on Elixir
- Phoenix application APIs
- Relay-compatible GraphQL services
- Custom GraphQL validation pipelines