{"id":14975992,"url":"https://github.com/ghivert/elm-graphql","last_synced_at":"2025-09-09T18:16:19.198Z","repository":{"id":23213223,"uuid":"98442004","full_name":"ghivert/elm-graphql","owner":"ghivert","description":"GraphQL made easy in Elm!","archived":false,"fork":false,"pushed_at":"2022-12-10T20:32:47.000Z","size":128,"stargazers_count":55,"open_issues_count":7,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-30T08:26:12.682Z","etag":null,"topics":["elm","elm-graphql","frontend","graphql","graphql-client"],"latest_commit_sha":null,"homepage":"http://package.elm-lang.org/packages/ghivert/elm-graphql/latest","language":"Elm","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ghivert.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-26T16:07:46.000Z","updated_at":"2022-09-04T05:05:24.000Z","dependencies_parsed_at":"2023-01-13T22:57:18.974Z","dependency_job_id":null,"html_url":"https://github.com/ghivert/elm-graphql","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/ghivert/elm-graphql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghivert%2Felm-graphql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghivert%2Felm-graphql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghivert%2Felm-graphql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghivert%2Felm-graphql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ghivert","download_url":"https://codeload.github.com/ghivert/elm-graphql/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghivert%2Felm-graphql/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274340821,"owners_count":25267295,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-09T02:00:10.223Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elm","elm-graphql","frontend","graphql","graphql-client"],"created_at":"2024-09-24T13:53:06.124Z","updated_at":"2025-09-09T18:16:19.158Z","avatar_url":"https://github.com/ghivert.png","language":"Elm","funding_links":[],"categories":["Libraries"],"sub_categories":["Elm Libraries"],"readme":"# Elm GraphQL\n\n## Opinion\n\nJust import GraphQL, and write queries and mutations! This package suppose your decoders are already written and do not write decoders, or that you want to keep control on the data received by GraphQL response. It only provides a nice syntax to do GraphQL queries and mutations, and decode the `\"data\"` at the root of standard GraphQL response for you as long as you use the HTTP wrapper. Just think on your schema, and don't bother with everything else. By not writing custom decoders, you can make multiple queries on the same data, with different schemas each times. They will always be converted to the same type, avoiding you to rewrote a type for each request like others can do. Moreover, it is purely written in Elm, avoiding you to think to recompile .graphql files.\n\n## How to use?\n\nBasically, creates an object with `object`, add some fields with a list of `field`, and you're done! You can add some arguments, selectors or alias to the fields, by using the corresponding functions. The type system is here to protect you from doing anything crazy, so relax and enjoy GraphQL!\n\nOtherwise, a (huge) example:\n\n`Main.elm`\n```elm\nmodule Main exposing (..)\n\nimport Json.Encode as Encode\nimport Json.Decode as Decode exposing (Decoder, field, maybe, int, string)\nimport Http exposing (Error)\nimport GraphQl exposing (Operation, Variables, Query, Named)\n\ntype Msg\n  = GraphQlMsg (Result Error NameAndAddress)\n\ntype alias User =\n  { id : Maybe Int\n  , name : Maybe Name\n  }\n\ntype alias Name =\n  { firstName : Maybe String\n  , lastName : Maybe String\n  }\n\ntype alias Address =\n  { street : Maybe String\n  , town : Maybe String\n  }\n\ntype alias NameAndAddress =\n  { user : User\n  , address : Address\n  }\n\ndecodeName : Decoder Name\ndecodeName =\n  Decode.map2 Name\n    (maybe (field \"first_name\" string))\n    (maybe (field \"last_name\" string))\n\ndecodeUser : Decoder User\ndecodeUser =\n  Decode.map2 User\n    (maybe (field \"id\" int))\n    (maybe (field \"name\" decodeName))\n\ndecodeAddress : Decoder Address\ndecodeAddress =\n  Decode.map2 Address\n    (maybe (field \"street\" string))\n    (maybe (field \"town\" string))\n\ndecodeNameAndAddress : Decoder NameAndAddress\ndecodeNameAndAddress =\n  Decode.map2 NameAndAddress\n    (field \"user\" decodeUser)\n    (field \"address\" decodeAddress)\n\n\nuserRequest : Operation Query Variables\nuserRequest =\n  GraphQl.named \"MySuperQuery\"\n    [ GraphQl.field \"user\"\n      |\u003e GraphQl.withArgument \"id\" (GraphQl.variable \"id\")\n      |\u003e GraphQl.withAlias \"current_user\"\n      |\u003e GraphQl.withSelectors\n        [ GraphQl.field \"id\"\n        , GraphQl.field \"name\"\n          |\u003e GraphQl.withSelectors\n            [ GraphQl.field \"first_name\"\n            , GraphQl.field \"last_name\"\n            ]\n        ]\n    , GraphQl.field \"address\"\n      |\u003e GraphQl.withArgument \"city\" (GraphQl.string \"Paris\")\n      |\u003e GraphQl.withArgument \"id\" (GraphQl.int 12)\n      |\u003e GraphQl.withArgument \"type\" (GraphQl.type_ \"LOFT\")\n      |\u003e GraphQl.withSelectors\n        [ GraphQl.field \"street\"\n        , GraphQl.field \"town\"\n        ]\n    ]\n    |\u003e GraphQl.withVariables [ (\"id\", \"123\") ]\n\nsendRequest : Int -\u003e Cmd Msg\nsendRequest id =\n  GraphQl.query userRequest\n  |\u003e GraphQl.addVariables [ (\"id\", Encode.int id) ]\n  |\u003e GraphQl.send \"https://example.com\" GraphQlMsg decodeNameAndAddress\n```\n\n## Want to contribute?\n\nIf you think this package is good, or if you want to bugfix something, or just globally improve the package, feel free to contribute. Make a PR, open an issue, and I will gladly work on it to make it part of `elm-graphql`!\n\n## Alternatives\n\nIf you're searching a complete solution including Decoders implicitly defined with your query, take a look at [Elm GraphQL by Dillon Kearns](https://github.com/dillonkearns/elm-graphql) or maybe [Elm GraphQL in Elm](https://github.com/jamesmacaulay/elm-graphql), and if you're searching for converting .graphql files to Elm, take a look at [GraphQL to Elm](https://github.com/jahewson/elm-graphql)!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghivert%2Felm-graphql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fghivert%2Felm-graphql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghivert%2Felm-graphql/lists"}