Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 10024e1

Browse files
author
madalynrose
committed
merged in master
2 parents c525e4a + df1591a commit 10024e1

File tree

154 files changed

+6793
-3953
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+6793
-3953
lines changed
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
---
2+
title: Reducing unnecessary user interaction in Gatsby Cloud
3+
date: 2019-12-09
4+
author: Shannon Soper
5+
tags: ["ux", "cloud"]
6+
---
7+
8+
In my last blogpost, I introduced how we’re [making it easier to start with Gatsby Cloud for
9+
free](https://www.gatsbyjs.org/blog/2019-11-25-getting-started-with-gatsby-cloud/) with starters. This blogpost introduces the next set of changes that we shipped to help users get started faster. How did we do it? Inferring from history to reduce unnecessary user interaction. Quite a mouthful and needs some explanation.
10+
11+
## The problem
12+
13+
So what problem did we learn about?
14+
15+
When watching folks onboard onto Gatsby Cloud, there was a clear point of confusion. Please see the screenshot below and read the thought bubble which depicts _approximately_ what users said during usability tests.
16+
17+
![This screenshot depicts step two of Gatsby Cloud onboarding, during which users select an organization from GitHub. I drew a speech bubble on top of the screenshot pointing out that users are confused by this screen. The speech bubble says: “Wait, I don't want to create a repository in my work's GitHub organization. Terminate mission!"](select-work-org-confusion.png)
18+
19+
## What was the real problem?
20+
21+
We knew users were confused, yet we didn’t know how to solve it quite yet. Here are some principles that helped us figure out the reason for the confusion and how to resolve it.
22+
23+
## Interaction is negative
24+
25+
I know, I know, this is a bit of a purposefully inflammatory and misleading statement. Interaction design is something I care about and do full-time along with many of you, so why would I say it’s negative? Well, the real phrase ought to read “_unnecessary_ interaction is negative.” So anything software can do to [_reduce_ the amount of unnecessary interaction](http://worrydream.com/MagicInk/#p145) it takes to reach a goal is good.
26+
27+
So how do you reduce unnecessary interaction?
28+
29+
## Reduce interaction by inferring from history and the environment
30+
31+
To reduce interaction, you can infer “as much as possible from history and the environment.” See this full quote below:
32+
33+
<Pullquote>If the software properly infers as much as possible from history and the environment, it should be able to produce at least a reasonable starting point for the context model. Most of the user’s interaction will then consist of correcting (or confirming) the software’s predictions. This is generally less stressful than constructing the entire context from scratch.</Pullquote>
34+
35+
_Quote from Brett Victor, [“Magic Ink”](http://worrydream.com/MagicInk/#p173)_
36+
37+
The principle is to make the best guess we can of what the user wants and then let them _correct_ our best guess if it’s wrong. And the guess will be right most of the time, if we infer from history and the environment.
38+
39+
So what could we infer from “history” and the “environment” to solve the problem we had in Gatsby Cloud, where everyone was confused and frustrated at needing to choose a GitHub organization?
40+
41+
## Inferring from history
42+
43+
The first step is simply to look at history; I’ll take you on a tour of what happened before users hit their point of confusion.
44+
45+
### User selects starter
46+
47+
In this first screenshot, the user selects a starter.
48+
![Screenshot of the starter page](final-state.png)
49+
50+
### User logs into GitHub and into Gatsby Cloud
51+
52+
Next, the user logs into GitHub and give Gatsby Cloud permission to connect with their personal GitHub account.
53+
![Screenshot of the Gatsby Cloud login page with a thought bubble the author drew on top of the screenshot. The thought bubble contains the text “Alright, I can sign in with Git Hub. I have an account!”](cloud-login-400.png)
54+
55+
### Unecessary interaction: user adds new GitHub organization
56+
57+
Then, this screen asks them to “add new organization.” This is where the software failed to learn from recent history. The user just gave the system access to their personal GitHub account, so that the last value they gave the system and we ought to stick with that value.
58+
59+
![Screenshot of the landing page for first-time visitors who have logged into Gatsby Cloud with a thought bubble the author drew on top of the screenshot. The thought bubble contains the text “What organization? GitHub organization? If so, why would I need to connect to GitHub again?” and "Gatsby Cloud, you have left me with no choice...I must click this button" referring to the "Add New Organization" button](add-new-org-confusion.png)
60+
61+
By the time the user adds an organization (and they don’t know why they have to add it), and sees this next screen below, of course they are confused about why they added an organization. They didn’t need to!
62+
63+
![screenshot of step two of Gatsby Cloud onboarding, during which users select an organization from GitHub. I drew a speech bubble on top of the screenshot pointing out that users are confused by this screen. The speech bubble says: “Wait, I don't want to create a repository in my work's GitHub organization. Terminate mission!”](select-work-org-confusion.png)
64+
65+
## Reducing interaction
66+
67+
To reduce interaction by inferring from history, we assume the user wants to save their first site in their GitHub personal account, the last value they provided us with when they logged in. They can _correct_ this assumption if it’s wrong.
68+
69+
### First-time visitor
70+
71+
The assumption that user wants to save their first site in their personal GitHub account is reflected in the following GIF that shows the user does _not have to interact with the software to tell us where to save their site_, though they _can correct the default (their personal GitHub account) if it’s wrong_.
72+
73+
![A GIF depicting a screen in which the user names their site and clicks “Next." There is text on the screen that reads: “we’ll create the repo under your personal GitHub account. Want to host it on a GitHub organization instead? Add it here!”](create-new-site.gif)
74+
75+
### Returning user
76+
77+
If there is a returning user that has already connected their personal account plus at least one more organization, their personal account will be the first item in a list and will always be pre-selected. This makes sure that, again, they _do not have to interact with the software_ except to correct it, if it’s wrong.
78+
79+
![This GIF depicts the screen in which the user names their site and their personal account is at the top of a list of GitHub organizations and is pre-selected as the destination for the site.](return-visitor.gif)
80+
81+
## What's next?
82+
83+
Stay tuned for more blogposts about why we:
84+
85+
- Added a free pricing tier, which lets you use Gatsby Cloud for free for blogs, portfolios, etc.
86+
- Made it easy to connect existing sites to Cloud
87+
- Shipped Gatsby Preview
88+
- Offer customized assessments of your builds, including Lighthouse scores
89+
90+
As a design team, we'll also keep blogging about what we’re working on. This includes:
91+
92+
- Transferring the principle of inferring from history so users choosing "I already have an existing Gatsby site" get the benefits of that principle as well
93+
- Adding more starters, including MDX, to do some of the work for you
94+
- Adding more integrations to do some work for you
95+
- Easy-to-read error messages that help you debug
96+
- More customized assessments of your builds, including performance budgets, structured logging, etc.
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
---
2+
title: How we accidentally launched a popular Gatsby plugin
3+
date: 2019-12-12
4+
author: Jari Zwarts
5+
excerpt: "The story of how gatsby-plugin-s3 came to be."
6+
tags:
7+
- AWS
8+
- S3
9+
- CloudFront
10+
- plugin
11+
- case-studies
12+
- festival
13+
---
14+
15+
It all started when we ([Oberon](https://www.oberon.nl/)) noticed a certain pattern among a subset of our clients — festivals.
16+
Their sites tend to have lots of issues with server load and costs.
17+
18+
They are, after all websites that remain largely unused for most of the year — until they’re not. And at those few yearly moments (such as at the start of a ticket sale), server loads can get really, really high.
19+
20+
This makes most festival websites not _particularly good_ candidates for hosting on servers that are shared by multiple sites, because they can bring down all other sites during this brief period.
21+
Additionally, clients are paying a fixed hosting fee for a server that mostly remains unused throughout the year.
22+
23+
In the past we’ve ‘resolved’ these issues by adding an additional caching layer like [Squid](http://www.squid-cache.org/), [CloudFront](https://aws.amazon.com/cloudfront/), etc.
24+
Adding these kinds of extra layers does make you think about why these sites are built as dynamic applications anyway.
25+
26+
For example, festival programme items rarely change after their initial publication, and it’s not like most of the content on these type of sites is particularly ‘realtime’ anyway.
27+
28+
What if we could just keep the entire site static, only updating it if changes were made in one of the data sources?
29+
We could then put it on a pay-per-request static file hosting service (like [AWS S3](https://aws.amazon.com/s3/)), where we can basically scale to infinity if need be, while keeping the costs low during the down periods.
30+
31+
When our company was approached by a [new client](https://www.oerol.nl/en/) (that had sadly earned a reputation for its website failing during peak hours), it felt like the stars were aligned, and we decided to go* full [JAMStack](https://jamstack.wtf/)*.
32+
33+
## Enter Gatsby
34+
35+
Gatsby is a static site generator, based on React.
36+
You can connect Gatsby up to a variety of sources, and query all of it through GraphQL.
37+
Source data can come from anywhere: a REST API, CSV file, database, you name it. It doesn’t need to originate from a GQL source.
38+
39+
In addition to generating everything as static assets, Gatsby also does some additional magic (mainly prefetching and codesplitting) to make your site even better.
40+
41+
They explain this all [much better on their site](/).
42+
43+
We have been using React for about 4 years now, and we’ve largely pivoted to using GraphQL for most of our API’s, so Gatsby was an instant fit, and barely required our frontend devs to learn anything new.
44+
45+
## Deployment
46+
47+
Whilst the transition to Gatsby itself was a breeze, this part is where things got a little tricky.
48+
49+
Because we were already hosting our image assets on S3, it seemed only logical to put the rest of the site on there as well.
50+
At the time however, [AWS Amplify](https://aws.amazon.com/amplify/faqs/) was the only way to go if you wanted to use Gatsby in combination with AWS.
51+
52+
AWS Amplify is a suite of services and tools including continuous integration, code hosting, and [much, MUCH more.](https://aws.amazon.com/amplify/faqs/)
53+
54+
I noticed there were some more downsides to Amplify:
55+
56+
- [Gatsby’s redirect functionality](/docs/actions/#createRedirect) did not work, at all.
57+
Our client absolutely needed redirects that they could control from the CMS, and in turn, we wanted to control them with the same data source that was already present in Gatsby, not having to write an additional script that would add a lot of overhead.
58+
59+
- [Gatsby’s recommended caching headers](/docs/caching/) were not applied — not very good for your lighthouse scores, and one of the primary reasons we chose Gatsby in the first place.
60+
61+
- Gatsby allows you to have [routes that only exist on the client side](/docs/building-apps-with-gatsby/#client-only-routes--user-authentication).
62+
63+
- Essentially, you declare a starting point — say for example: /users/, and anything past that starting point will get picked up by the client side. Once the client navigates to /users/1, it will dynamically fetch that user from some sort of API. This is great and allows for very hybrid, partially static, partially dynamic applications. However, when people directly navigate to /users/1 , they will get a 404 because it simply does not exist on the serverside, which is kind of an issue.
64+
65+
- We already had a CI service ourselves, and weren’t really interested in learning all these Amplify-specific things that we already had working ourselves just fine.
66+
67+
- Being able to add additional metadata (such as different headers for certain files) was absent.
68+
69+
So, I decided to experiment a bit and a week later, launched a plugin that fixed all of the afore mentioned problems:
70+
71+
- Gatsby redirects now work just like they do on other hosting providers, and can be configured to be permanently or temporarily.
72+
73+
- It applies the recommended caching headers by default which can also be fully customised.
74+
75+
- If a client route is requested from the server side, it redirects them back to the starting point of the client route. (aka /users/1 now redirects to /users/ instead of 404'ing). Preferably we’d rewrite the url completely, but this is not possible with S3 and [gatsby-plugin-netlify](https://www.npmjs.com/package/gatsby-plugin-netlify) does exactly the same.
76+
77+
- Unlike Amplify, it can be ran from your own infrastructure (or an EC2 instance — in which case it won’t need any configuration because it uses the AWS SDK which can automatically resolve the needed credentials!)
78+
79+
- You can now set additional metadata on objects, meaning you can (for example) specify [a custom content type for your objects](https://github.com/jariz/gatsby-plugin-s3/blob/master/recipes/custom-content-type.md).
80+
81+
You can get it here:
82+
[gatsbyjs.org/packages/gatsby-plugin-s3](/packages/gatsby-plugin-s3/?=plugin-s3)
83+
84+
## The result
85+
86+
We launched a beautiful, fast website that was cheap to host and didn’t even flinch whilst serving a million requests during our peak day. Outside of the festival period, costs were minimal. We completely proved that this stack is great for this type of project.
87+
88+
[Check it out here.](https://www.oerol.nl/en/)
89+
90+
Building the plugin allowed us to scale it as far as we needed it without a hitch, with the need for redirects and custom headers showing up fairly quickly as the project went on.
91+
92+
![The final end result, viewable at oerol.nl](oerol.png)
93+
94+
The plugin is now the de facto way of [using Gatsby in combination with S3](/docs/deploying-to-s3-cloudfront/), and the OSS community has mostly picked it up since it’s humble beginnings, adding a lot of stability and cool new ideas:
95+
96+
- Supporting prefixed deploys. (adding the possibility to have [atomic deployments](https://buddy.works/blog/introducing-atomic-deployments#what-are-atomic-deployments))
97+
98+
- Being able to swap out AWS for a different S3-compliant endpoint such as [Yandex](https://cloud.yandex.com/docs/storage/s3/) or [DigitalOcean](https://developers.digitalocean.com/documentation/spaces/).
99+
100+
- Supporting both S3 redirect objects and routing rules. (due to a [50 redirects limit in the latter](https://github.com/jariz/gatsby-plugin-s3#aws-s3-routing-rules-limit))
101+
102+
- Being able to upload really large files. (which to my surprise, [was a pretty hard issue to tackle](https://github.com/jariz/gatsby-plugin-s3/pull/58))
103+
104+
It’s [still a few features away from 1.0](https://github.com/jariz/gatsby-plugin-s3/issues?q=is%3Aopen+is%3Aissue+milestone%3A1.0), but it’s really cool to have seen what started out as a byproduct of a solution to a real world problem, turn into something that is greatly used and appreciated by the Gatsby community.

docs/blog/author.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,3 +368,7 @@
368368
bio: Sr. Software Engineer for Mediacurrent. Bass player.
369369
avatar: avatars/mark-casias.png
370370
twitter: "@teampoop"
371+
- id: Jari Zwarts
372+
bio: Frontend @ Oberon. Maker of things. https://jari.io
373+
avatar: avatars/jari-zwarts.png
374+
twitter: "@JariZwarts"

docs/blog/avatars/jari-zwarts.png

183 KB
Loading

docs/contributing/docs-contributions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ If you wrote a new document that was [previously a stub](/contributing/how-to-wr
8484

8585
After going through the [development setup instructions](/contributing/setting-up-your-local-dev-environment/), there are a few additional things that are helpful to know when setting up the [Gatsby.js docs site](/docs/), which mostly lives in the [www](https://github.com/gatsbyjs/gatsby/tree/master/www) and [docs](https://github.com/gatsbyjs/gatsby/tree/master/docs) directories. There are also some [examples](https://github.com/gatsbyjs/gatsby/tree/master/examples) in the repo that are referenced in docs.
8686

87+
- Prerequisites: install Node.js and Yarn. See [development setup instructions](/contributing/setting-up-your-local-dev-environment/).
8788
- [Fork and clone the Gatsby repo](/contributing/setting-up-your-local-dev-environment/#gatsby-repo-install-instructions).
8889
- For docs-only changes, consider using `git checkout -b docs/some-change` or `git checkout -b docs-some-change`, as this will short circuit the CI process and only run linting tasks.
8990
- Change directories into the docs site folder: `cd www`

0 commit comments

Comments
 (0)