2 ms·
I recently built a project in both Gatsby and NextJS. Or rather, I built it in Gatsby due to the hype and then threw away everything to do it again in NextJS. I
by WnZ39p0Dgydaz1 6y ago
I recently built a project in both Gatsby and NextJS. Or rather, I built it in Gatsby due to the hype and then threw away everything to do it again in NextJS. I would highly recommend going with NextJS.
Fundamentally, they are both very similar if you use them for static site generation (NextJS also supports SSR, but that's a different story). The main difference is Gatsby's data layer, which allows GraphQL queries to integrate all kinds of sources. Gatsby's data model is quite complex, with all kinds of GraphQL node creation callbacks, schema inference, non-determinism when it comes to ordering, etc. If you do something custom you're going to spend most of your time learning the ins and outs of (ugly) Gatsby internals and debugging edge cases as opposed to working on your application-specific logic. It's like crawling through 4 layers of abstractions to get a simple job done, over and over again. Look at how large the docs are - it's not only because the documentation is good - it's because there are so many complexities to consider. And most of the issues are not even discussed in the docs.
NextJS is on the opposite end. It's incredibly simple and straightforward. Yes, it does less out of the box, and I had to re-implement some of the logic that Gatsby already provides, but that amounted to a few hundred lines of application-specific code, like sourcing files from a local folder. I would rather maintain these few hundred lines than being locked into some overly complex framework that constantly changes.
Any new developer would immediately understand the Next.js code, perhaps after walking through the hour-long NextJS tutorial. A new developer would need days to understand the multiple Gatsby layers and their integrations and idiosyncrasies. I'd pick simplicity.
One use case where Gatsby would shine if there is a plugin or data sources that already does exactly what you need. But I found the plugin ecosystem isn't that great either - it's mostly small stuff from the developers behind gatsby, not contributed by the community.
I really don't understand the hype behind Gatsby. To me NextJS seemed superior in almost every way.