Implementing and using GraphQL at GitHub

Dd18bb36fa5f06e45843ff8de33b793e?s=47 Kyle Daigle
September 14, 2016

Implementing and using GraphQL at GitHub

This talk was given at GitHub Universe 2016. Alongside Dan Schafer from GitHub, we discuss GraphQL, the what's and the hows, and how GitHub has launched its public GraphQL API.

Dd18bb36fa5f06e45843ff8de33b793e?s=128

Kyle Daigle

September 14, 2016
Tweet

Transcript

  1. 1.

    Implementing and Using GraphQL Kyle Daigle Platform Interface Engineering Manager,

    GitHub Dan Schafer Software Engineer, Co-Creater of GraphQL, Facebook
  2. 3.

    Today • Over 250,000 OAuth Applications • Over 6,000,000 users

    have installed an OAuth app • REST API v3 • Webhooks
  3. 5.

    Pains of our API • Getting the data you want

    can be multiple REST calls away • It’s difficult for us to release comprehensive REST responses that don’t expose too much data that’s too expensive to calculate. • When we’re forced to make a change, it’s very hard to know who it will impact • GitHub uses the API for its own integrations but not for product features
  4. 9.
  5. 14.
  6. 16.
  7. 17.
  8. 21.

    { "me": { "name": "Daniel Schafer", "profilePic": { "width": 50,

    "height": 50, "url": "https://cdn/50.jpg" } } } { me { name profilePic { width height url } } }
  9. 22.

    { me { name friends { name } } }

    { "me": { "name": "Daniel Schafer", "friends": [ { "name": "Kyle Daigle" }, { "name": "Nick Schrock" }, { "name": "Lee Byron" },
  10. 23.

    { me { name friends { name events { name

    } } } } { "me": { "name": "Daniel Schafer", "friends": [ { "name": "Kyle Daigle", "events": [ { "name": "Github Universe" }, { "name": "GraphQL Meetup" }, ] }
  11. 24.

    { me { name friends(first: 1) { name events(first: 1)

    { name } } } } { "me": { "name": "Daniel Schafer", "friends": [ { "name": "Kyle Daigle", "events": [ { "name": "Github Universe" } ] } ] } }
  12. 30.

    { me { name friends(first: 1) { name events(first: 1)

    { name } } } } type Query { me: User user(id: Int): User }
  13. 31.

    { me { name friends(first: 1) { name events(first: 1)

    { name } } } } type User { name: String profilePic(size: Int = 50): Image friends(first: Int): [User] events(first: Int): [Event] }
  14. 32.

    { me { name friends(first: 1) { name events(first: 1)

    { name } } } } type User { name: String profilePic(size: Int = 50): Image friends(first: Int): [User] events(first: Int): [Event] }
  15. 33.

    { me { name friends(first: 1) { name events(first: 1)

    { name } } } } type Event { name: String attendees(first: Int): [User] }
  16. 36.

    { me { name attendees(first: 1) { name } }

    } type User { name: String profilePic(size: Int = 50): Image friends(first: Int): [User] events(first: Int): [Event] }
  17. 38.

    { __schema { types { name fields { name type

    { name } } } } } type Query { me: User user(id: Int): User } type User { name: String profilePic(size: Int = 50): Image friends(first: Int): [User] events(first: Int): [Event] } type Event { name: String attendees(first: Int): [User] }
  18. 42.
  19. 43.

    CLIENT APP SERVER Views v3 Models Models v2 Models v3

    Here's your 123 v3 model Model: 123, v3, plz
  20. 44.

    CLIENT APP SERVER Models v2 Models v3 Models v4 Views

    v4 Here's your 123 v4 model Model: 123, v4, plz
  21. 45.

    Models Views Here's your 123 model CLIENT Model: 123, plz

    APP SERVER Model: 123, plz Model: 123, plz Model: 123, plz Model: 123, plz Model: 123, plz
  22. 47.
  23. 48.

    Views v2 Views Models Models v2 This data shape, plz

    Here's your specific data CLIENT APP SERVER Type System
  24. 49.

    Views v3 Views v2 Views Models Models v2 Models v3

    This data shape, plz Here's your specific data CLIENT APP SERVER Type System
  25. 51.
  26. 57.
  27. 62.
  28. 63.

    GitHub Platform Forum • Public forum to discuss early access

    and pre-release features • Staffed by GitHub Platform Engineers, Product Managers, and Support staff • Feedback can immediately be used by GitHub engineers • Integrators can work with each other to share novel uses and best practices
  29. 66.

    Early Access Program • We will provide a communication channel

    to collaboratively impact the direction and approach of a project. • We will strive to keep documentation updated, but you can expect unannounced breaking changes as we develop quickly. • We may stop or pause access to Early Access releases at any point. • You will encounter bugs and there will be reliability and stability hiccups.
  30. 86.
  31. 87.

    FIN