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

DDA with GraphQL and React

Avatar for Rakesh Menon Rakesh Menon
September 09, 2017

DDA with GraphQL and React

Modern web applications rely heavily on the REST API backends. Monoliths are being further broken down into individual microservices to speed up development & deployment, to make frequent releases hassle free.

With the number of client devices accessing the API services increasing exponentially, we run into issues such as each client requesting for new changes and API teams getting into what we call the “version hell” and maintenance nightmares.

Clients, in most of the cases, need to invoke multiple APIs and join resources for different use-cases and soon we run into issues of under/over delivering data in most of the cases. We have traditionally solved this problem with orchestration layers, designed to deliver exactly the data required for the view.

But can we do better? Yes, and the answer to that is Demand Driven Architecture!

Who uses it? Facebook, Netflix and others!

Topics we explore:

1. Need for Demand driven architecture.
2. Principles of demand driven architecture
3. Introduction to GraphQL and core concepts
4. Architecting your application – example using React & GraphQL
5. Libraries involved to help make this happen!

Avatar for Rakesh Menon

Rakesh Menon

September 09, 2017

Other Decks in Technology

Transcript

  1. Demand Driven Architecture (DDA) with GraphQL & React S E

    P T E M B E R 9 , 2 0 1 7 - M E E T U P
  2. 3 Key Takeaways from this session • Need for Demand

    Driven Architecture (DDA) • Principles of DDA • Understand GraphQL and core concepts • Architecture best practices • Hands on with GraphQL server (Express) and client (React)
  3. 7

  4. 8 Today Web Apps REST APIs Data Source 1 Mobile

    Apps IoT devices Data Source 3 Data Source 2
  5. 9

  6. 12 • Unpredictable requirement changes – New Endpoints • Overfetching

    / Underfetching of data • Versioning Hell Problems with REST APIs
  7. 13 Web API v1 Mobile Tablet API v3 API v2

    Web Mobile Tablet Web Mobile Tablet
  8. 14 • Unpredictable requirement changes – New Endpoints • Overfetching

    / Underfetching of data • Versioning Hell • API Documentation Problems with REST APIs
  9. 15

  10. 16 • Server teams decide what the client should be

    consuming • Team challenges: • Client teams request changes • Different teams - different requirements Supply Driven Architecture
  11. 17

  12. 19 • Jargon coined by Kovas Boguta and David Nolen

    in QCon 2015 • Client demands the data & shape instead of service making assumptions of what the client needs. What’s that now?
  13. 26 • Related to Open Graph API • Graph database

    query language • Client-side state management • Limited to JS / NodeJS • Limited to React ecosystem What is it NOT?
  14. 27 GraphQL is a query language for APIs and a

    runtime for fulfilling those queries with your existing data. Specification: http://facebook.github.io/graphql/
  15. 28

  16. 29 query MyProduct { product(id: 123) { name description picture

    { width height url } } } { "data": { "product": { "name": "Delicious Cake", "description": "Just taste it!”, "picture": { "width": 150, "height": 150, "url": http://... } } } }
  17. 31

  18. 32 • Created in 2012 • Open-sourced in 2015 –

    announced in React Conf 2015 • Battle-tested @ Facebook and Production Ready! History
  19. 36 • Shared definition • Graphs as a conceptual model

    • Introspection • Data Typing • Developer Experience (GraphiQL) • Community! Differentiators
  20. 37 Tomorrow’s stack! Web Apps GraphQL Layer External APIs Mobile

    Apps IoT devices Any datasource Databases
  21. 40

  22. 48

  23. 56

  24. 58

  25. 59