How to create a Gatsby Starter
Tags: howto, gatsby, contentful, publishing
Published: 2019-04-15 16:09:03

---
title: How to create a Gatsby Starter
published: true
tags: how-to,gatsby,contentful,publishing
canonical_url: 
---

![](https://cdn-images-1.medium.com/max/1024/1*9Mntlltb4s_NTKQNNMfz9Q.jpeg)<figcaption>Photo by <a href="https://unsplash.com/photos/PpzBE1hWeGI?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Jed Owen</a> on <a href="https://unsplash.com/search/photos/suitcase?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption>

A few weeks ago I published my first starter for Gatsby and I want to share what I learn from this journey.

As many starters in Gatsby, it began as a [personal portfolio](http://emasuriano.com). After I published it and share it on Tweeter, people start to ask me if it was Open Source, and I said “Ermm yes 🤔”.

{% tweet 1033837348881137665 %}

Technically all the code was open for everybody in [Github](https://github.com/EmaSuriano/emasuriano.github.io) but it was not configurable at all (lots and lots hardcoded information about me). So instead of helping developers, it was an awful experience when you have to guess where to change the code.

It was at this point I started thinking about creating a Gatsby starter to ease the setup of the page. My goal was to achieve a _2 minutes Setup_ with defined steps, so I had to work a lot on making something _configurable_ and also _extensible._

### #1. Make it attractive to developers 💅
<iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FxTiTnnzSvW1FxGVi12%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FxTiTnnzSvW1FxGVi12%2Fgiphy.gif&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FxTiTnnzSvW1FxGVi12%2F200.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="199" frameborder="0" scrolling="no"><a href="https://medium.com/media/38563052ed7a5b0abb5a59135ca9e175/href">https://medium.com/media/38563052ed7a5b0abb5a59135ca9e175/href</a></iframe>

You can think about your starter as a page you are selling to developers (you won’t get any money because it’s not the point of open source). So you have to make it **attractive ✨** For that I follow these 3 rules:

> Make it work.

> Make it fast.

> Make it pretty.

**_Make it work_** is for making your app actually functional and without any bugs or exception. Fortunately, I kind of had it this rule because my page was already working without any issues.

After achieving this, a very good tip for this point is to make a list of all the features you implemented. So a developer can take a quick glance what it’s inside without reading any codebase. 👍

**_Make it fast_** remains for building an application with an overall good performance. Achieving this point with Gatsby it’s not that hard, because Gatsby it’s already blazing fast out of the box 🔥 But still, you can write code that performs horribly.

For measuring the performance of my application I used Google Lighthouse. It gives you a report with statistics of different aspect in your application, like performance, accessibility, PWA and more. 👍

**_Make it pretty_** _,_ this rule can be explained with this phrase:

> _If_ an application looks bad or if it doesn’t support my screen then I won’t use it.

Yes, it’s that simple! You have to provide something that looks attractive to others and also responsive, which is my opinion is a MUST in the current web development state.

A great tip if you are working with React is to pick a design system with built in components. That will save you a ton of time because there was a full team which took the time to think how the spacing should be, color palette, font, responsive and many many more! 👍

### #2. Do not hardcode Personal Information 🤷‍♂️

When I looked into my pages I could easily detect that I had a mixed between component and information about me. A quick example it was the About me page, which looked like this:

![](https://cdn-images-1.medium.com/max/1024/1*XCVR6iCsSAMOvP6Ypo-z_A.png)<figcaption>Snippet of Old About me section</figcaption>

The solution was “_easy_”, all the information has to come from other resources, and fortunately doing that with Gatsby is incredibly easy!

I decided to use a CMS to store all my data and then display it on the starter, in this case, I picked [_Contentful_](https://www.contentful.com) and I’m really happy with it 😃.

The first step is to create a ContentModel where I can declare the shape of the data about the owner of the portfolio.

![](https://cdn-images-1.medium.com/max/1024/1*fO6SDQeQlxjZMHTnnPzkMg.png)<figcaption>Content Model for About me</figcaption>

After that, I need to fill my Content Model with Data by creating a Content. I did this to provide an example of how it should look when you fill all your information, and also without data the starter is completely empty 😂

![](https://cdn-images-1.medium.com/max/1024/1*BvmjDD5BaFoZbl6OdBgwwA.png)<figcaption>Snippet of New About me</figcaption>

By doing this, the person who wants to change information about himself doesn’t have to look into the component structure to find where the picture is being mounted. Just simply go into _Contentful_ and change the asset for the picture and that’s it ✨

### #3. Provide a Quick Setup 🚀

This is a crucial step if you want to encourage people to start using it. As a maintainer, you have to provide simple steps to get up and run the starter.

Also, the setup might change depending on what you picked to build your starter. In my case, as I used _Contentful_ as the data provider I had to explain an easy migration of all my ContentModel and Content to the space of another person.

**Quick tip:** Remember to add gatsby new command as the first step of the setup. It’s the way the documentation suggest to do it and also it’s better than cloning the repo.

So the steps I defined for my starter are:

- gatsby new mate-portfolio
- yarn setup
- yarn develop

Try to be as specific as you can when introducing a new step that normally doesn’t exist, in my case yarn setup. Also, I paste how the result of the console should look like if everything went smooth.

### #4. Add it to the official Gatsby starters list 📦

This might be the easiest and most grateful step, which is basically going official!

For any who doesn’t know, Gatsby has a [list of all the starters](https://www.gatsbyjs.org/starters/) inside its website, and people (me included) go there looking for the starters. This step is like register a domain for your website so it can be discoverable by users in Google.

The way to add your starter is just by opening a pull request to the Gatsby repository and editing the file starters.yml where you write a brief description and the URL for the starter.

```
- url: Link to a demo of your starter
 repo: Link to GitHub repo
 description: Your starter description

# These correspond to the category filters in the library
 # Make an effort to use the existing tags, and add more if needed!
 tags:
 - Redux

# Add your site features
 # These will be included on your starter's detail page.
 features:
 - Blog post listing with previews (image + summary) for each blog post
```

After your pull request is merged, you’ll be able to see as a new entry of the showcase. Here you can see mine!

[gatsby-starter-mate](https://www.gatsbyjs.org/starters/gatsby-starter-mate)

One last thing, at the moment the maintainers accept your pull request you will be part of the Gatsby community! Gatsby gives “free swag” to any contributor (they have a shop where you can pick for free some stuff and deliver it to your home), which is the best way to show gratitude to developers, thank you so much Gatsby 🎉

I highly suggest you go and check out the [Spectrum community](https://spectrum.chat/gatsby-js), it’s a forum with awesome developers so you can ask for anything and also answer.

That’s it! This was my experience with building a Gatsby starter I hope you find it helpful. In case you build one too, please share your experience in the comment 😀