Lighthouse

# Boilerplate free schema definition

Define your schema without any boilerplate by using the GraphQL Schema Definition Language.

type User {
  name: String!
  posts: [Post!]! @hasMany
}

type Post {
  title: String!
  author: User @belongsTo
}

type Query {
  me: User @auth
  posts: [Post!]! @paginate
}

type Mutation {
  createPost(
    title: String @rules(apply: ["required", "min:2"])
    content: String @rules(apply: ["required", "min:12"])
  ): Post @create
}

# Query just what you need

In a GraphQL query, the client can get all the data they need, and no more, all in a single request.

query PostsWithAuthor {
  posts {
    title
    author {
      name
    }
  }
}

# Get predictable results

A GraphQL server can tell clients about its schema, so they will always know exactly what they will get.

{
  "data": {
    "posts": [
      {
        "title": "Lighthouse rocks",
        "author": {
          "name": "Albert Einstein"
        }
      },
      {
        "title": "World peace achieved through GraphQL",
        "author": {
          "name": "New York Times"
        }
      }
    ]
  }
}