GraphQL APIs for Developer Communities

Going Social with the GRANDstack starter

--

Using the GRANDstack Starter With GitHub, MeetUp, StackOverflow and Twitter data.

The GraphQL Community Graph

As you might have read before, we’re gathering the public activity of the graphql community in a Neo4j graph database. I also showed how that data can be used to find awesome female engineers in the GraphQL community.

GRANDstack Starter

The GRAND stack combines GraphQL, React, Apollo, and the Neo4j Database.

With the GRANDstack starter project you get up and running with an API back-end and a React UI front-end in minutes.

Using the starter, our community data can be easily turned into a React app. All the steps that William Lyon outlined in the video stay the same

The three things that change are:

  1. the GraphQL schema
  2. the Neo4j server address
  3. the GraphQL query + react code

I tried to keep the changes minimal so that you can just use the existing starter project and change the three files.

I quickly go over the example for StackOverflow, here are the files for Twitter, Meetup, and GitHub.

StackOverflow — GraphQL Schema

The GraphQL schema uses currently SOUser, Question, Answer and Tag with the data that is currently collected. I had to add the SOUser label to he data as neo4j-graphql-js doesn’t allow tagging secondary labels on types which would be a nice feature.

If you ever used StackOverflow you should be able to work with this schema immediately.

graphql-schema.js

Neo4j Server Settings

This uses the publicly available community graph Neo4j server (currently running Neo4j 3.3.5) with a read-only user.

Update your .env file to this:

Please adapt the GRAPHQL_URI when you deploy as described in the Readme of the api module.

With that in place, our API backend can restart and we can check out the data in the playground at http://localhost:4000.

GraphQL Query & React Code

I wanted to keep the changes of the starter really minimal, but I’m also a React noob, so please bear with me.

I changed the query to also include a few questions and their score and nested tags names. That GraphQL query then runs as a single 3-hop-graph query in Neo4j. (:SOUser)-->(:Question)-->(:Tag)

UserList.js

The pretty boring UI looks like this. But fortunately in our Hackathon you can do much better :)

With these 3 minimal changes you can now run your GRANDstack starter against our “social graph” data.

So please participate in the GRANDstack Hackathon that still runs until June 30th and let your submission win a “Brik Laptop Covers” in many different sizes. Even with bricks for your favorite logos.

Good Luck! We’re looking forward to your submissions.

--

--

Michael Hunger
GRANDstack - GraphQL, React, Apollo, Neo4j Database

A software developer passionate about teaching and learning. Currently working with Neo4j, GraphQL, Kotlin, ML/AI, Micronaut, Spring, Kafka, and more.