Breaking REST Chains:

A Fastify & Mercurius Pathway to GraphQL Glory

 Luca Del Puppo 

Luca Del Puppo

  • Senior Software Developer
  • JavaScript enthusiast
  • TypeScript lover
  • “Youtuber”
  • “Writer”

Love sport: running, hiking

Love animals

Why GraphQL?_

Rest API

Desktop Browsers

Mobile Browsers

Other Browsers
TVs, SmartWatchs..

Bill is 22.
He is a Junior Backend Developer who fights with the Frontend and Mobile developers to build a specific endpoint for every single view, with just some different fields but the same logic

Desktop Browsers

Mobile Browsers

Other Browsers
TVs, SmartWatchs..

Schema

Queries

Mutations

Subscriptions

You can scale your server "easily"_

But remember
every layer is a cost

Why Mercurius?_

  • Mercurius is a high-performance GraphQL adapter for the Fastify web framework
  • It has many core features and plugins for building world-class production-ready applications
  • It supports advanced features out of the box, such as Apollo Federation specifications and Subscriptions
  • It's entirely Open Source and made available under the MIT license
  • Fantastic community
  • Caching of query parsing and validation
  • Automatic loader integration to avoid the N+1 problem
  • Just-In-Time compiler via graphql-jit
  • Subscriptions
  • Federation support
  • Federated subscriptions support
  • Gateway implementation, including Subscriptions
  • Batched query support
  • Customizable persisted queries

Core features_

Today recipe_

  1. Build a GraphQL server with Mercurius Fastify and JavaScript
  2. Convert it to TypeScript
  3. Resolve 1+N problem
  4. Add Custom Directives or Validations
  5. Add Authentication
  6. Working with Federation
  1. Build a GraphQL server with Mercurius Fastify and JavaScript
  2. Convert it to TypeScript
  3. Resolve 1+N problem
  1. Build a GraphQL server with Mercurius Fastify and TypeScript
  2. Resolve 1+N problem

Let's get our hands dirty_

Conclusion_

  • Don't hate REST API
  • Build one use from everyone
  • Build with Mercurius is a piece of cake
  • Don't forget, using Mercurius all the Fastify's benefits are there with you 
  • Be careful with the layers in your Applications
  • Give the right power to your Frontend Developers
  • Don't forget to monitor your server

About this presentations_

Slides

Code

Resources to read_

Resources to watch_

Book_

Luca Del Puppo

@puppo92

Luca Del Puppo

Puppo_92

@puppo

We are hiring

Thank you!_

Breaking REST Chains: A Fastify & Mercurius Pathway to GraphQL Glory

By Luca Del Puppo

Breaking REST Chains: A Fastify & Mercurius Pathway to GraphQL Glory

  • 863