another server ◦ getProductsForStore , placeOrder ◦ e.g. gRPC • REST ◦ Resources and What you can do with them ◦ Built on top of HTTP and (mostly) uses JSON ◦ GET /stores/1, GET /stores/1/products , POST /stores/1/orders
stock? Pricing Which is the cheapest in stock variant and what is the price for the same? Loyalty Points Does any of this product’s variants provides Loyalty Points? How much? Cashback Campaigns Does any of this product’s variants provides Cashback? How much? Product Information Get Product Label to be displayed from data enriched via Akeneo Product Feed + Pricing Get Image of the cheapest Product Variant, which is in stock
which is aware about how to fetch and aggregate data specifically required for a Front-end Application Can allow Back-end to evolve independently of Front-ends, hiding the complexity and implementation details of Back-end https://samnewman.io/patterns/architectural/bff/
Typed Definition of Data and their Relation Its implementation can act as a BFF for Client Applications providing access to authorized data, across different technologies
stock? Pricing Which is the cheapest in stock variant and what is the price for the same? Loyalty Points Does any of this product’s variants provides Loyalty Points? How much? Cashback Campaigns Does any of this product’s variants provides Cashback? How much? Product Information Get Product Label to be displayed from data enriched via Akeneo Product Feed + Pricing Get Image of the cheapest Product Variant, which is in stock
Subscriptions) • Types ◦ What can be sent and requested using a GraphQL Operation ▪ Primitive, having a value ▪ Complex, having multiple fields (Complex or Primitive) • Resolvers ◦ How data will be prepared Schema allows Introspection of GraphQL API
{ unitPrice { value currencyCode } } } } POST /graphql • /clusters • /product-feed • /product-information • /pricing • /product-information • /cashback • /loyalty-points GraphQL automatically optimizes execution by NOT invoking APIs for Loyalty Points and Cashback, as data for them is not requested by the client
a single endpoint Resolver optimization needs to be taken care of Can prove difficult to find performance bottlenecks and cause of errors (but there is a solution!)
the New Facebook.com with React, GraphQL and Relay https://youtu.be/WxPtYJRjLL0?t=300 • React.js Conf 2015 - Data fetching for React applications at Facebook https://www.youtube.com/watch?v=9sc8Pyc51uU