All Projects → haskell-graphql → Graphql Api

haskell-graphql / Graphql Api

Licence: other
Write type-safe GraphQL services in Haskell

Programming Languages

haskell
3896 projects

Labels

Projects that are alternatives of or similar to Graphql Api

Graphqlite
Use PHP Annotations to declare your GraphQL API
Stars: ✭ 370 (-8.42%)
Mutual labels:  graphql
Parse Server
API server module for Node/Express
Stars: ✭ 19,165 (+4643.81%)
Mutual labels:  graphql
Django Restql
Turn your API made with Django REST Framework(DRF) into a GraphQL like API.
Stars: ✭ 396 (-1.98%)
Mutual labels:  graphql
Firestore Apollo Graphql
An example of a GraphQL setup with a Firebase Firestore backend. Uses Apollo Engine/Server 2.0 and deployed to Google App Engine.
Stars: ✭ 371 (-8.17%)
Mutual labels:  graphql
Villus
🏎 A tiny and fast GraphQL client for Vue.js
Stars: ✭ 378 (-6.44%)
Mutual labels:  graphql
Skmz
A GraphQL-based Web App written with Go, React and MongoDB
Stars: ✭ 380 (-5.94%)
Mutual labels:  graphql
Juniper
GraphQL server library for Rust
Stars: ✭ 4,187 (+936.39%)
Mutual labels:  graphql
Graphql Constraint Directive
Validate GraphQL fields
Stars: ✭ 401 (-0.74%)
Mutual labels:  graphql
Graphiti
Swift GraphQL Schema/Type framework for macOS and Linux
Stars: ✭ 378 (-6.44%)
Mutual labels:  graphql
Admin On Rest
A frontend framework for building admin SPAs on top of REST services, using React and Material Design.
Stars: ✭ 392 (-2.97%)
Mutual labels:  graphql
Graphql Auto Generating Cms
Use your existing graphQL schema to generate CMS in a couple steps. DEMO: http://cms-demo.web4fly.com/
Stars: ✭ 373 (-7.67%)
Mutual labels:  graphql
Keystone
The most powerful headless CMS for Node.js — built with GraphQL and React
Stars: ✭ 5,404 (+1237.62%)
Mutual labels:  graphql
Nest Ideas Api
REST API for app ideas built in nestjs
Stars: ✭ 380 (-5.94%)
Mutual labels:  graphql
Bootcamp 2020
Learn to Build Modern Full Stack Serverless Multi-Tenant SaaS Apps and APIs
Stars: ✭ 369 (-8.66%)
Mutual labels:  graphql
Lucid
A developer tool for engineers working with React and GraphQL.
Stars: ✭ 397 (-1.73%)
Mutual labels:  graphql
Django Api Domains
A pragmatic styleguide for Django API Projects
Stars: ✭ 365 (-9.65%)
Mutual labels:  graphql
React Query
⚛️ Hooks for fetching, caching and updating asynchronous data in React
Stars: ✭ 24,427 (+5946.29%)
Mutual labels:  graphql
Framework
.NET Core Extensions and Helper NuGet packages.
Stars: ✭ 399 (-1.24%)
Mutual labels:  graphql
Graphql Ws
Coherent, zero-dependency, lazy, simple, GraphQL over WebSocket Protocol compliant server and client.
Stars: ✭ 398 (-1.49%)
Mutual labels:  graphql
Walkable
A Clojure(script) SQL library for building APIs: Datomic® (GraphQL-ish) pull syntax, data driven configuration, dynamic filtering with relations in mind
Stars: ✭ 384 (-4.95%)
Mutual labels:  graphql

graphql-api

CircleCI Documentation Status

graphql-api helps you implement a robust GraphQL API in Haskell. By the time a query makes it to your handler you are dealing with strong, static types that make sense for your problem domain. All your handlers are normal Haskell functions because we derive their type signature from the schema. If you have used servant, this will sound familiar.

The library provides type combinators to create a GraphQL schema, and functions to parse and evaluate queries against the schema.

You can find the latest release on hackage.

We implement the GraphQL specification as best as we can in Haskell. We figure they know what they're doing. Even if an alternative API or behaviour looks nicer, we will defer to the spec.

Tutorial

A simple graphql-api tutorial can be read at readthedocs.io.

To follow along and get your hands dirty, clone this repository, enter the graphql-api root directory, and run:

stack repl tutorial

Example

Say we have a simple GraphQL schema like:

type Hello {
  greeting(who: String!): String!
}

which defines a single top-level type Hello which contains a single field, greeting, that takes a single, required argument who.

We can define this schema in Haskell and implement a simple handler like so:

{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators #-}

import Data.Text (Text)
import Data.Monoid ((<>))

import GraphQL
import GraphQL.API
import GraphQL.Resolver (Handler, returns)

type Hello = Object "Hello" '[]
  '[ Argument "who" Text :> Field "greeting" Text ]

hello :: Handler IO Hello
hello = pure (\who -> returns ("Hello " <> who))

run :: Text -> IO Response
run = interpretAnonymousQuery @Hello hello

We require GHC 8.0.2 or later for features like the @Hello type application, and for certain bug fixes. We also support GHC 8.2.

With the code above we can now run a query:

run "{ greeting(who: \"mort\") }"

Which will produce the following GraphQL response:

{
  "data": {
    "greeting": "Hello mort"
  }
}

Status

Our current goal is to gather feedback. We have learned a lot about GraphQL in the course of making this library, but we don't know what a good GraphQL library looks like in Haskell. Please let us know what you think. We won't mind if you file a bug telling us how good the library is.

Because we're still learning, we make no guarantees about API stability, or anything at all really.

We are tracking open problems, missing features & wishlist items in GitHub's issue tracker.

Roadmap

  • Near future:
    • Better error messages (this is really important to us)
    • Full support for recursive data types
    • Close off loose ends in current implementation & gather feedback
  • Medium future:
    • Full schema validation
    • Schema introspection
    • Stabilize public API
  • Long term:
    • Derive client implementations from types
    • Allow users to implement their own type combinators

References

Copyright

All files Copyright (c) 2016-2017 Thomas E. Hunger & Jonathan M. Lange, except:

  • src/GraphQL/Internal/Syntax/AST.hs
  • src/GraphQL/Internal/Syntax/Encoder.hs
  • src/GraphQL/Internal/Syntax/Parser.hs

for which see LICENSE.BSD3 in this repository.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].