Overview

View Source

GreenFairy Logo

GreenFairy

Hex.pm Documentation CI

A cleaner DSL for GraphQL schema definitions built on Absinthe.


⚠️ Experimental: GreenFairy is in early development. The API may change between versions.

Features

  • One module = one type — SOLID principles with auto-discovery
  • CQL filtering — Hasura-style where and orderBy on every connection
  • Multi-database — PostgreSQL, MySQL, SQLite, MSSQL, ClickHouse, Elasticsearch
  • DataLoader — Batched association resolution built-in
  • Relay — Cursor pagination, global IDs, Node interface
  • Authorization — Type-owned field visibility

Installation

def deps do
  [{:green_fairy, "~> 0.1.0"}]
end

Quick Example

defmodule MyApp.GraphQL.Types.User do
  use GreenFairy.Type

  type "User", struct: MyApp.User do
    field :id, non_null(:id)
    field :name, :string
    field :email, non_null(:string)

    connection :posts, MyApp.GraphQL.Types.Post
  end
end
query {
  users(where: { email: { _ilike: "%@example.com" } }, first: 10) {
    nodes { id name email }
    pageInfo { hasNextPage endCursor }
  }
}

Documentation

License

MIT — see LICENSE

Contributing

See CONTRIBUTING.md for guidelines.