Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Crossing Domain Boundaries with GraphQL

DamirSvrtan
September 05, 2019

Crossing Domain Boundaries with GraphQL

How is it like to be an API consumer and an API provider at the same time? How is building an orchestration layer for distributed data different than building an API backed by a single database? When building an app that goes across many domains, when is the time to sync data and when is it okay to proxy? How to deal with downstream failures and communicate that efficiently to our customers? The Netflix Studio often builds orchestration layers to tackle and abstract a lot of the complexities that are behind various micro services - let’s see how GraphQL fits perfectly into that story and helps making those layers a better experience for developers on both sides of the API.

DamirSvrtan

September 05, 2019
Tweet

More Decks by DamirSvrtan

Other Decks in Programming

Transcript

  1. CROSSING DOMAIN
    BOUNDARIES with GraphQL

    View Slide

  2. THE DVD RENTAL COMPANY

    View Slide

  3. VIDEO ON DEMAND

    View Slide

  4. ORIGINAL CONTENT

    View Slide

  5. BIG SHIFT?

    View Slide

  6. OLD INDUSTRY

    View Slide

  7. REMEMBER THESE?

    View Slide

  8. PROBLEM SPACE

    View Slide

  9. Studio apps

    View Slide

  10. STARTING WITH A MONOLITH

    View Slide

  11. SPECIALIZATION

    View Slide

  12. STARTING
    fresh

    View Slide

  13. MASH OF EXISTING & NEW DATA

    View Slide

  14. SINGLE DATA SOURCE

    View Slide

  15. UI TALKS TO MULTIPLE APIS?

    View Slide

  16. UI TALKS TO MULTIPLE POLYGLOT APIS?

    View Slide

  17. SEEMS LIKE TROUBLE

    View Slide

  18. ORCHESTRATION LAYER

    View Slide

  19. API TECH?

    View Slide

  20. API
    Requirements

    View Slide

  21. STOP OVERFETCHING

    View Slide

  22. EFFICIENT RELATIONSHIP
    FETCHING

    View Slide

  23. HANDLE COMPLEX
    RELATIONSHIPS

    View Slide

  24. GOING FORWARD with
    GraphQL

    View Slide

  25. ORCHESTRATING WITH GRAPHQL

    View Slide

  26. INITIAL HICCUPS

    View Slide

  27. query {
    production(id: $productionID) {
    title
    logline
    dates(...) {
    startDate
    endDate
    }
    talent(...) {
    firstName
    lastName
    }
    shootingLocations {
    address
    latitude
    longitude
    }
    }
    }

    View Slide

  28. EASY INTROSPECTION

    View Slide

  29. DOCUMENTATION AS A
    FIRST CLASS CITIZEN

    View Slide

  30. THE POLYGLOT ORCHESTRATION LAYER

    View Slide

  31. API CLIENTS

    View Slide

  32. HANDWRITTEN API CLIENTS

    View Slide

  33. AUTOGENERATED API CLIENTS

    View Slide

  34. AUTOGENERATED API CLIENTS
    SWAGGER CODE GENERATOR
    GRPC
    JSON API SPEC

    View Slide

  35. NETFLIX ECOSYSTEM
    CHANGES FAST!

    View Slide

  36. PRODUCTION - SEASON RELATIONSHIP

    View Slide

  37. DEPRECATION API

    View Slide

  38. PARTIAL DATA RESPONSES

    View Slide

  39. MICROSERVICES WILL FAIL!

    View Slide

  40. PARTIAL DATA LOAD
    {
    "data":{
    "productions":[
    {
    "title": "Stranger Things S03",
    "dates": "...",
    "shootingLocations": []
    }
    ]
    },
    "errors":[
    {
    "message":"Unable to load shooting location data",
    "extensions":{
    "error_type":"PARTIAL_LOAD_ERROR"
    }
    }
    ]
    }

    View Slide

  41. OPT-IN, NOT OPT-OUT

    View Slide

  42. NO KNIGHTS IN SHINING
    ARMORS

    View Slide

  43. "FETCH ALL AT ONCE"
    FALLACY

    View Slide

  44. LAZY LOADING STILL APPLIES

    View Slide

  45. WHAT THE future holds ...

    View Slide

  46. DUPLICATED EFFORTS

    View Slide

  47. UNIFIED STUDIO GRAPH

    View Slide

  48. GRAPHQL FEDERATION

    View Slide

  49. Conclusion

    View Slide

  50. DAMIR SVRTAN
    TWITTER: @DAMIRSVRTAN

    View Slide