Fast by Default: Extending GatsbyJS with Plugins

A presentation at FrontConf in April 2019 in Munich, Germany by Nicolas Goutay

Slide 1

Slide 1

FrontConf 2k19 — Munich — 27/04/2019 Fast by Default: Extending GatsbyJS with Plugins & /phacks

Slide 2

Slide 2

👋 Hi! My name is Nicolas Goutay. I am a Web Performance Evangelist at Theodo. I love building side-projects, and I’m a top GatsbyJS contributor. I have stage fright am really excited to be with all of you today! ☺ You can find me on Twitter/GitHub at @phacks. & /phacks

Slide 3

Slide 3

What is GatsbyJS? & /phacks

Slide 4

Slide 4

What is GatsbyJS? Static Site Generators (SSGs) Progressive Web Apps (PWAs) Jekyll, Hugo, Middleman React, Vue, Angular 😎 Build performant websites 📱 App-like, snappy experience 📟 Little to no backend 🏗 Easily reuse code & components 🎨 Off-the-shelf themes ✨ Build interactive websites & /phacks

Slide 5

Slide 5

What is GatsbyJS? Static Progressive Web Apps 😎 Build performant websites 📟 Little to no backend 🎨 Off-the-shelf themes 📱 App-like, snappy experience 🏗 Easily reuse code & components ✨ Build interactive websites & /phacks

Slide 6

Slide 6

What is GatsbyJS? The SSG part relies on NodeJS and GraphQL The SPA part is a fully-featured React application & /phacks

Slide 7

Slide 7

Gatsby Plugins & /phacks

Slide 8

Slide 8

Gatsby Plugins There are two ways to inject external data into a Gatsby website: & /phacks

Slide 9

Slide 9

Gatsby Plugins There are two ways to inject external data into a Gatsby website: 🛠 At build-time (GraphQL) & /phacks

Slide 10

Slide 10

Gatsby Plugins There are two ways to inject external data into a Gatsby website: 🛠 At build-time (GraphQL) * At runtime (React, fetch…) & /phacks

Slide 11

Slide 11

Gatsby Plugins 🛠 What kind of data are suitable for build time injection? Static data (e.g. blog posts) or weakly dynamic data (where one can wait ~1 minute for them to deploy to production, e.g. e-commerce catalog updates). & /phacks

Slide 12

Slide 12

Gatsby Plugins 🛠 What kind of data are suitable for build time injection? Static data (e.g. blog posts) or weakly dynamic data (where one can wait ~1 minute for them to deploy to production, e.g. e-commerce catalog updates)

  • What kind of data are suitable for runtime injection? Highly dynamic data (e.g. real-time notifications, data controlled by users). & /phacks

Slide 13

Slide 13

Gatsby Plugins Gatsby plugins allows one to inject data from any datasource (remote API, database, filesystem…), through a GraphQL interface, into your Gatsby website’s React components. They abstract the complexity of remote datasources away from the frontend developer. & /phacks

Slide 14

Slide 14

Gatsby Plugins https://theatres-parisiens.fr https://github.com/phacks/theatres-parisiens & /phacks

Slide 15

Slide 15

Gatsby Plugins & /phacks

Slide 16

Slide 16

Gatsby Plugins & /phacks

Slide 17

Slide 17

Gatsby Plugins & /phacks

Slide 18

Slide 18

Gatsby Plugins & /phacks

Slide 19

Slide 19

A small story: From Digital to Analog and Back Again & /phacks

Slide 20

Slide 20

From Digital to Analog and Back Again & /phacks

Slide 21

Slide 21

From Digital to Analog and Back Again 😍🎧 & /phacks

Slide 22

Slide 22

From Digital to Analog and Back Again 😭💸 & /phacks

Slide 23

Slide 23

From Digital to Analog and Back Again & /phacks

Slide 24

Slide 24

From Digital to Analog and Back Again https://phacks.github.io/showcase-for-discogs https://github.com/phacks/showcase-for-discogs & /phacks

Slide 25

Slide 25

From Digital to Analog and Back Again 🤔 Two problems with the naive approach 🐌 Slow loading times as I fetch 60+ resources from the Discogs API & /phacks

Slide 26

Slide 26

From Digital to Analog and Back Again 🤔 Two problems with the naive approach 🐌 Slow loading times as I fetch 60+ resources from the Discogs API 👆 Hitting the Discogs API rate limit means that only one person can visit the website every minute & /phacks

Slide 27

Slide 27

From Digital to Analog and Back Again 🤔 Two problems with the naive approach 🐌 Slow loading times as I fetch 60+ resources from the Discogs API 👆 Hitting the Discogs API rate limit means that only one person can visit the website every minute 😅 (I think I invented the litteral opposite of scalability) & /phacks

Slide 28

Slide 28

Building a Gatsby Plugin & /phacks

Slide 29

Slide 29

Building a Gatsby Plugin & /phacks

Slide 30

Slide 30

Building a Gatsby Plugin & /phacks

Slide 31

Slide 31

Live coding! & /phacks

Slide 32

Slide 32

FrontConf 2k19 — Munich — 27/04/2019 🙏 Thanks! Slides, links & GitHub sources will be available later on my Twitter: @phacks ☺