&gt; The biggest question I have is what&#x27;s going to process the GraphQL query on the server<p>It&#x27;s really not much different from processing a REST-based API request. In theory, you could parse the request and then just execute the necessary SQL to fill out the result.<p>However, what Facebook&#x27;s GraphQL library lets you do is define a schema that specifies how each piece of the result is fetched. It&#x27;s like a declarative API builder. (&quot;GraphQL&quot; is a huge misnomer; it&#x27;s neither graph-query-oriented, nor is it a query language — it&#x27;s a protocol.) GraphQL-the-language doesn&#x27;t make much sense until you look GraphQL-the-library and understand its design.<p>For example, let&#x27;s say the GraphQL query is:<p><pre><code>  query {
    story(id: &quot;1&quot;) {
      text
    }
  }
</code></pre>
Your schema might be declared like this:<p><pre><code>  const storyType = new GraphQLObjectType({
    name: &#x27;Story&#x27;,
    description: &#x27;A story.&#x27;,
    fields() {
      id: {
        type: new GraphQLNonNull(GraphQLString),
        description: &#x27;The ID.&#x27;,
      },
      text: {
        type: GraphQLString,
        description: &#x27;The text.&#x27;,
      }
    }
  });

  const queryType = new GraphQLObjectType({
    name: &#x27;Query&#x27;,
    fields() {
      story: {
        type: storyType,
        args: {
          id: {
            description: &#x27;ID of the story to fetch&#x27;,
            type: new GraphQLNonNull(GraphQLString)
          }
        },
        resolve(root, {id}) {
          return SQLDatabase.findStoryById(id)
        }
      }
    }
  });
</code></pre>
You declare static fields as well as resolver functions that take arguments and are expected to furnish the query with the actual results. You then &quot;execute&quot; the query, which will cause the resolver&#x27;s to run as they are triggered by parts of the query. For example, if the storyType contains resolvers, any nested queries will invoke them.<p>I recommend looking at the tests [2] in the GraphQL JS library, because they show some useful examples. There&#x27;s already a Ruby [1] library for declaring schemas in the same way.<p>If you&#x27;re doing SQL underneath, optimizing a GraphQL query into the fewest possible SQL queries might be tricky. For example, let&#x27;s say each story has an author; doing an author query per story isn&#x27;t going to cut it; you&#x27;re going to want to join the authors table. But the outer queryType doesn&#x27;t know if the query will be asking for the authors. I don&#x27;t know if the library provides any way to solve this yet.<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;rmosolgo&#x2F;graphql-ruby" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;rmosolgo&#x2F;graphql-ruby</a><p>[2] <a href="https:&#x2F;&#x2F;github.com&#x2F;graphql&#x2F;graphql-js&#x2F;tree&#x2F;master&#x2F;src&#x2F;__tests__" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;graphql&#x2F;graphql-js&#x2F;tree&#x2F;master&#x2F;src&#x2F;__test...</a>