DEV Community

St3l
St3l

Posted on

GatsbyJs: Pros and Cons

Hello everybody,

I'll soon start to work on a static website project using Strapi for the back-end. But I wonder if working with Gatsby for the front-end is relevant. That's why I'm looking for people's opinion/experience of Gatsby because I can't figure it out by myself...
So, if you could help me to make my choice, it would be great :D

Cheers!

Top comments (12)

Collapse
 
developertharun profile image
Tharun Shiv

Hi ,
It definitely can bring in great speed in your website. Here are few reasons for which I would choose Gatsby as my front-end

  1. The speed of Gatsby websites are phenomenal: my entire Blog is Gatsby based, you can navigate and check for yourself : tharunshiv.com
  2. The availability of plugins: there are a lot of plugins that are available which you can use to do huge tasks easily.
  3. It is react based: so there are many components which you can use that are already available.
  4. Ease of use with markdown: you can use markdown files to run an entire website, now how cool is that?

No doubt that JAMStack is the present and the future. This power when combined with PWA, will rule the domain of web development for a long time.
Thanks for asking.

tharunshiv image


😊
Collapse
 
stel profile image
St3l

Thank you Tharun for your answer. The good speed of Gatsby websites is definitely a pros to use Gatsby !

Collapse
 
developertharun profile image
Tharun Shiv

Even if you have dynamic content, since you said it's only a little bit, you can use GraphQL and databases to pull dynamic data into the application right?

Thread Thread
 
developertharun profile image
Tharun Shiv

You mentioned that you're gonna use an API service, so this shows that you're gonna isolate your front end and backend, so you would be using services like GraphQL, Axios or Firebase like services which would help you make requests and populate the website. May I know how your thought process is currently?

Thread Thread
 
stel profile image
St3l

Well with my team we agreed to use Next.js that seems more suitable for our project. So Gatsby is out of the table..
Thank you for your time Tharun, really appreciate it :)

Thread Thread
 
developertharun profile image
Tharun Shiv

Sure.. :)
I'm just curious about the pros of Next.js, can you help me with that? Like what made you choose Next.js over Gatsby. :)

Thread Thread
 
stel profile image
St3l

The main reason was that our project might evolve and its dynamical part might be more important in the future ^^

Thread Thread
 
developertharun profile image
Tharun Shiv

Alright.. thanks for the knowledge. :) All the best with your project!

Collapse
 
julbrs profile image
Julien Bras • Edited

Hello

GatsbyJs is a Static Site Generator, like Hugo, Jekyll etc...

It is not the ideal framework (as far as I know) if you want to setup a front-end based on REST api (like Strapi.io is providing). But as Gatsby is itself based on React then I am sure it is possible to consume a REST api :D

I am suggesting more to look at the famous Create React App that will be more basic or Next.js that is handling Server Side Rendering.

A good article here : dev.to/benjaminmock/gatsby-vs-next...

Collapse
 
stel profile image
St3l

Thank you Julien for your answer. The link to the article is really useful because I'm thinking to use create react app :)

Collapse
 
juliusdelta profile image
JD Gonzales

Gatsby generates static sites and very much has a specific use case. There's a couple of questions to answer about it to see if it fits for you:

  1. Do I have a lot of dynamic data?

This means: Does your data vary by the individual user that's logged in? This means usually that you have to do some client side fetching and if that's all you're doing than Gatsby probably isn't the right fit.

  1. Are the data queries I'm running static? Do they only need to be run one time for all users of the site?

This is common among blogs. Where the user plays almost no part in what data loads and all the data is the same for each user. In this case Gatsby could be a good fit but again it depends more deeply on what you're wanting as well as how steep of a learning curve you're willing to deal with.

While Gatsby allows for client side code just fine and managing dynamic data, it has a steep learning curve compared to something like create-react-app if you're going to be hydrating data from a rest api.

Gatsby also sort of requires you to normalize the data as it comes in so you can use GraphQL to query it and this all happens during the build time, when the site is actually generated. This makes the learning curve exceptionally steep for Gatsby.

Unless you are developing a blog or just really want to learn Gatsby I probably wouldn't recommend it. I personally use it for my blog and it works just fine for that but none of my data is fetched client side so it all happens during the build process.

Collapse
 
stel profile image
St3l

Thank you JD for your answer. My project is mainly static but we have a small part of it that require dynamic data. That's why I'm doubting about using Gatsby.