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 full-size slide

  2. THE DVD RENTAL COMPANY

    View full-size slide

  3. VIDEO ON DEMAND

    View full-size slide

  4. ORIGINAL CONTENT

    View full-size slide

  5. OLD INDUSTRY

    View full-size slide

  6. REMEMBER THESE?

    View full-size slide

  7. PROBLEM SPACE

    View full-size slide

  8. STARTING WITH A MONOLITH

    View full-size slide

  9. SPECIALIZATION

    View full-size slide

  10. STARTING
    fresh

    View full-size slide

  11. MASH OF EXISTING & NEW DATA

    View full-size slide

  12. SINGLE DATA SOURCE

    View full-size slide

  13. UI TALKS TO MULTIPLE APIS?

    View full-size slide

  14. UI TALKS TO MULTIPLE POLYGLOT APIS?

    View full-size slide

  15. SEEMS LIKE TROUBLE

    View full-size slide

  16. ORCHESTRATION LAYER

    View full-size slide

  17. API
    Requirements

    View full-size slide

  18. STOP OVERFETCHING

    View full-size slide

  19. EFFICIENT RELATIONSHIP
    FETCHING

    View full-size slide

  20. HANDLE COMPLEX
    RELATIONSHIPS

    View full-size slide

  21. GOING FORWARD with
    GraphQL

    View full-size slide

  22. ORCHESTRATING WITH GRAPHQL

    View full-size slide

  23. INITIAL HICCUPS

    View full-size slide

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

    View full-size slide

  25. EASY INTROSPECTION

    View full-size slide

  26. DOCUMENTATION AS A
    FIRST CLASS CITIZEN

    View full-size slide

  27. THE POLYGLOT ORCHESTRATION LAYER

    View full-size slide

  28. HANDWRITTEN API CLIENTS

    View full-size slide

  29. AUTOGENERATED API CLIENTS

    View full-size slide

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

    View full-size slide

  31. NETFLIX ECOSYSTEM
    CHANGES FAST!

    View full-size slide

  32. PRODUCTION - SEASON RELATIONSHIP

    View full-size slide

  33. DEPRECATION API

    View full-size slide

  34. PARTIAL DATA RESPONSES

    View full-size slide

  35. MICROSERVICES WILL FAIL!

    View full-size slide

  36. 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 full-size slide

  37. OPT-IN, NOT OPT-OUT

    View full-size slide

  38. NO KNIGHTS IN SHINING
    ARMORS

    View full-size slide

  39. "FETCH ALL AT ONCE"
    FALLACY

    View full-size slide

  40. LAZY LOADING STILL APPLIES

    View full-size slide

  41. WHAT THE future holds ...

    View full-size slide

  42. DUPLICATED EFFORTS

    View full-size slide

  43. UNIFIED STUDIO GRAPH

    View full-size slide

  44. GRAPHQL FEDERATION

    View full-size slide

  45. DAMIR SVRTAN
    TWITTER: @DAMIRSVRTAN

    View full-size slide