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

GraphQL Hive Workshop

Laurin Quast
September 19, 2023
52

GraphQL Hive Workshop

Laurin Quast

September 19, 2023
Tweet

Transcript

  1. GraphQL Hive Workshop Laurin Quast Safely Evolve your Federated GraphQL

    Schema @n1rual Tuesday, Sep 19 2023 @n1ru4l Kamil Kisiela @kamilkisiela @kamilkisiela
  2. 1. (Intro) Evolving GraphQL can be Hard 2. Schema Registry

    3. Breaking Change Detection 4. Usage Reporting 5. Conditional Breaking Changes 6. Q&A Workshop Agenda
  3. A Single Pull Request GraphQL can be easy The simple

    Setup Update GraphQL Schema Update GraphQL Operations Deploy • Rolling out changes is simple • Breaking clients does not happen (?)
  4. Internal External GraphQL can be hard The Complex Setup •

    Many teams/products/developers • GraphQL API and Client(s) owned by different Teams • Code is spread across different repositories or even companies GraphQL Client GraphQL Client GraphQL Client GraphQL API GraphQL Client
  5. Git Workflow Develop Iterate on code according to CI feedback

    CI (GitHub Action) CD (GitHub Action) Check if code works Deploy code to production
  6. Git Workflow Develop iterate on code according to CI feedback

    CI (GitHub Action) CD (GitHub Action) • Validate Schema • Detect Breaking Changes • Report CI Status GraphQL Inspector
  7. Federated / Composite Schemas The Complex Setup • Composition should

    not fail in production (Gateway must be reliable) • Schema changes should be trackable • Subgraphs might not be within the same Git Repository GraphQL API GraphQL API GraphQL API Supergraph GraphQL API
  8. Schema Registry • Centralised repository for managing and validating GraphQL

    schemas • Validate and subgraph schemas • Schema history (Version control for GraphQL) • Categorisation of schema changes (breaking, safe, conditional breaking)
  9. Workflow Develop iterate on code according to CI feedback CI

    (GitHub Action) CD (GitHub Action) GraphQL Hive Schema Registry GraphQL Hive Schema Registry • Verify schema integrity • Compose Supergraph (if needed) • Detect breaking changes • Report CI status • Persist schema history • Write supergraph to CDN (if needed)
  10. Git Workflow Develop iterate on code according to CI feedback

    CI (GitHub Action) CD (GitHub Action) GraphQL Hive Schema Registry GraphQL Hive Schema Registry • Verify schema integrity • Compose Supergraph • Detect breaking changes • Report CI status • Persist schema history • Write supergraph to CDN
  11. Git Workflow Develop iterate on code according to CI feedback

    CI (GitHub Action) CD (GitHub Action) GraphQL Hive Schema Registry GraphQL Hive Schema Registry • Verify schema integrity • Compose Supergraph • Detect breaking changes • Report CI status • Persist schema history • Write supergraph to CDN
  12. GitHub Workflow Develop iterate on code according to CI feedback

    hive check • verify schema integrity • no breaking changes • enforce best practices hive publish • publish new schema • inform gateways • inform consumers CI (GitHub Action) CD (GitHub Action) GraphQL Hive Schema Registry GraphQL Hive Schema Registry
  13. GitHub Workflow Develop iterate on code according to CI feedback

    hive check • verify schema integrity • no breaking changes • enforce best practices hive publish • publish new schema • inform gateways • inform consumers CI (GitHub Action) CD (GitHub Action) GraphQL Hive Schema Registry GraphQL Hive Schema Registry
  14. Git Workflow Develop iterate on code according to CI feedback

    hive check • verify schema integrity • no breaking changes • enforce best practices hive publish • publish new schema • inform gateways • inform consumers CI (GitHub Action) CD (GitHub Action) GraphQL Hive Schema Registry GraphQL Hive Schema Registry
  15. Deployment Flow Continious Deployment GraphQL Hive Schema Registry GraphQL Gateway

    Apollo Router Poll super graph from registry Deploy Subgraph Subgraph 1 Subgraph 2 Subgraph 3 Publish subgraph schema to registry Query subgraphs
  16. Usage Reporting SDK GraphQL API Hive SDK • JavaScript •

    Ruby • Java • Custom GraphQL Hive Report schema usage
  17. Usage Reporting SDK GraphQL API Hive SDK • JavaScript •

    Ruby • Java • Custom GraphQL Hive Report schema usage
  18. Conditional Breaking Changes • Mark breaking changes as safe changes

    based on schema usage • If a fi eld is not used for N days, it is safe to remove it
  19. Other Features • SSO (Okta, Auth0, etc.) built-in • All

    Cloud Features are available on Self-Hosted