Skip to content

Instantly share code, notes, and snippets.



Last active May 1, 2019
What would you like to do?
GraphQL Summit 2017 in San Francisco
GraphQL at massive scale
- IBM cloud = node micro services (30+ teams) - separate codebases
- frontend need to fetch data from multiple endpoints (bad documentation) - it’s a inconsistent mess
- graphql centralize this - grapnel microservice (single endpoint), documentation included
- data sources (schema + resolvers + model + connector) = plugin (independent GitHub repo)
- GrAMPS Middleware (schema stitching)
- extended error messages (GUID, documentation links
- datasource starter kit (strong starting point for new data sources)
- GitHub: grapms-graphql/gramps-express (based on Apollo server) - MIT licence - GraphQL Apollo Microservice Patterns Server
Universal GraphQL - beyond the frontend
- Apollo link, Apollo cache, Schema Stitching, Apollo Engine
- GraphQL for designers (React - real datasources! - move GraphQL early into your process
- Apollo Launchpad
- Apollo Client 2.0 (server rendering + client merge deferred) -
GraphQL - client-driven development
- started as FQL as a wrapper around business logic and storage layer -> GQL (because of iOS client needs)
- fragments originally only on client with defragmentation (server didn’t know the fragments for ~3 months)
- Component Kit (iOS), Litho, Flux
- Mutations (missnamed -> should’ve been Actions from Flux)
- server implemented mutations 5-6 months behind the client (client hidden REST + GraphQL requests)
- subscriptions on client … similar story
- quote: "Done is better than perfect"
- at the beginning it was just query but it made sense on client and eventually it was implemented in server (because it made sense)
Lightning Talks (nugget of awesomenes)
- Animation as a Function of Data (Operation Result, Type System, ALL THE THINGS)
- Jam Stack, Jam Stack Radio
- Devtools for GraphQL (Apollo, Relay)
Building GraphQL-native Microservices (Graphcool)
- backend: not as a gateway for REST but native implementation on server
- schema stitching, GraphQL Weaver
- Graphcool Framework opensourced (GraphQL Database, cloud native)
- GraphQL SDL (?)
- Framework demo: ???
GraphQL Subscriptions - the full stack
- normal queries are request/response, client driven, fetches exactly, but without real-time updates (tricky with request/response)
- subscriptions: request followed by stream of responses ("response stream" result of new event on an underlying "source stream")
- lifecycle: request, subscribe (construct source stream + subscribe those events), response
- scaling state is hard (state = who subscribed, what day sent, how to send back, …)
- live queries (for reactive GraphQL) = observing state (live) vs. observing events (subs)
Lightning Talks
- GraphQL Radio (?) -
- how to convince coworkers for GraphQL in the company (in general convince about new idea)
- remember - Introduce a designer to GraphQL today
Extending the Limits of GraphQL (author of Graphene - Python implementation) … CEO
- announcement of Graphene-Python 2.0 (better resolution API, Python 3 + Subscriptions thanks to async iterators)
- quote: "Your API is a user interface."
Going Public: Launching and Scaling a GraphQL API for 3rd party Developers (Yelp, GitHub)
- "@deprecated" directive is useless (Lee Byron)
- GitHub - rate limiting via time (RateLimit query: out, limit, nodeCount, remaining, resetAt)
Moving the New York Times to GraphQL
- QueryRenderer from Relay Modern is not isomorphic (does not support SSR)
- uses Apollo client (1.0)
- Scoop CMS
- very long queries (20kb query itself)
- recursion (infinite) in GraphQL is still unsolved problem
- Relay Client Extensions - not really documented and not completely ready yet because client schema needs to be little bit different - but stay tuned! (Lee Byron)
- all nullable fields (how to handle in React)? - try to write Babel plugin similar to "_.get" that expands all the checks even with Flow annotation (Lee Byron) - FB call it IDX
- Viewer pattern (mutations?)
quote: "It’s not about what technology you use but what you can build with it…"
The GraphQL Stack: How everything fits together
- GraphQL result caching - GraphQL Gateway in front of GraphQL Server (additional layer)
- Apollo Engine GraphQL Gateway … GraphQL result caching (memcache)
- Full stack caching (Apollo, Relay)
- response "extensions" - (per path cache hits),
- caching in the API and the client
- Tracing + Errors -,
- Schema Stitching (via Stitcher)
Twitch’s GraphQL Transformation
- switched from REST APIs to GraphQL in one year
- authorisation - pushed to uservices (it’s not part of the API layer)
- GQL Europe - How to implement authorisation… (YouTube video)
- document good practices (!) - explain why
- iterate on a styleguide, write linters (!) - enforces styleguide, don’t use boilerplate, generate code instead
- quote: "Wanna go fast? - go alone … far? Go together.."
GraphQL Under the Hood
- parse query: string -> parser + lexer -> AST … semantically correct
- validation of the schema: persistent/static queries (extract all queries on compile time to the server and after that just send only ID of the queries from client - no need for sexing, parsing and validation - store AST)
- we can run multiple operations at the time (?)
- execute schema ; context is not part of the specification
Lightning Talks
- native mobile apps with GraphQL - avoid overfetching and extra round trips
- GraphQL on the Edge (pushing GraphQL to the very edge) "GNT" - GraphQL Normalized Types -
- GraphQL gest (for testing) -
- KhanAcademy - best practices for errors in GraphQL - errors part of the response (validation: response field "errorFields + hasError")
- quote: "some errors are really data" (!)
Teaching GraphQL
- a model for learning new skills (stages: beginner, competent practitioner, expert)
- quote: "All models are wrong, but some are useful."
Handling Authentication and Authorization in GraphQL
- internal tool called Phenix (Slackbot) for getting credentials inside of company (Auth0)
- GraphQL doesn’ have opinion about authorization
- get headers from context in resolver (kinda Viewer approach, but not really - he didn’t mention the Viewer)
- directives (@hasScope, @isAuthenticated) - on the server schema definition -
Building Large-Scale, Multi-Branded Web App on a GraphQL Foundation (Air France + KLM)
- BlueWeb Project (new interface for KLM and AirFrance)
- Typescript, Angular, Apollo (client + server), Node.js, Docker, NgRx (to manage client store - now replaced with Apollo)
- 4 related project with separate release cycles - UBCs (Unique Business Component)
. schema for each of UBC (again independent subportions of the schema - but not in one schema because of single point of failure)
- all types and resolvers in separate schema as a NPM packages
- they are using "buildSchema" from Apollo
- "don’t request same types in one query"
- they want to implement persistent queries in the future
- price for flight per hour (interesting idea)
Lightning Talks
- how to manage massive FB schemas (10k, 20k+ types)
- types == class, fields == methods
- using meta annotations in Hack to generate GraphQL Schema (don’t write your own schema but write it to code)
- FB use codegens for this
- Apollo-Codegen -
- tools: eslint-plugin-graphql (knows how to validate schema), apollo-codegen, prettier
GraphQL Live: Reactive Queries at Facebook
- new way of doing live updates in GraphQL
- "query @live {"
- pushing updates to clients via HTTP2 (?)
- state oriented (not event oriented === subscriptions)
- reactive datalayer
- polling is perfectly valid but quite naive
- reactive datastore (Meteor, Firebase, RethingDB)
- problems with over-observing, masked dependencies (depends only on previous query), partial reactivity, …
Apollo Client 2.0 - More Than GraphQL
- YouTube: Apollo Mission Briefing
- cache, link (opens door for local storage like Relay client extensions)
- Apollo Link State (@client directive) - soon
- Apollo Link REST (@rest directive) - query REST data with GraphQL … "@rest(route: '/users') @type(type: 'User[]')"
GraphQL at Twitter
- a lot of microservices (Thrift services (!))
- meassure query complexity and depth
- all queries whitelisted
- Strato (internal virtual database) - closed source
"Quote: "GraphQL is enabling technology"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment