Migrating from Gatsby to Next.js & S3

Jul 7, 2020

Next JS logo

This site has gone through some changes. Visually there isn't too much of a difference, but under the hood I've changed the backbone of this site. Originally this was all made using GatsbyJS along with their most popular starter template. Now everything is powered by Next.js.

Issues with Gatsby

Gatsby isn't a bad platform and after they just raised almost 30 million dollars I'm excited to see what they'll produce in the future.

However, I kept running into some small obscure bugs that were difficult to track down and fix. This could have been because of the template I was using. It could have been because Gatsby is still a relatively new technology and still working out some of the kinks.

Either way, too many of the details were obfuscated away by Gatsby. It can be convenient for getting sites up and running quickly. But I ended up fighting against the framework a lot when problems came up.

Potential Options

Next.js is an opinionated Javascript framework, but not nearly to the extent as Gatsby. It provides a straightforward way of serving webpages and it does this very well whether you're creating a fully featured web app or a simple static site.

The requirements for this blog were pretty minimal. The main requirement was to have an easy way to serve static pages and to have a way to easily write and publish content. I didn't need to have a fully loaded web server to serve blog posts. So I planned on keeping EC2 out of this.

Github pages was a possibility, but I had already spun up a site using this method in the past and although Jekyll is a little weird, Github pages is an amazing feature. If anyone wants to spin up their own personal blog or site, I would point them to github pages first.

Actually, I would push someone to use Squarespace or Unstack first. But those aren't as much fun if you want to get your hands dirty 😄


Ultimately I decided on using Next.js for a couple of reasons.

  • I love React and Next is built entirely around React.
  • I've used Next in the past, it powers Wonderment, and I know from experience how mature of a product it is.
  • Next has a great feature for exporting static html if your requirements allow for it. A simple blog is the best use case for this feature 🎉
  • With static exports I don't have to manage a server. I can upload all my assets to S3 and serve my entire website through a Cloudfront distribution. My deploy process is simply uploading all of my static assets to a single S3 bucket.
  • In order to write a new post all I have to do is create a new markdown file in my posts folder and start writing.

I'm very happy with this decision so far. Everything is a lot simpler with Next.js and S3 serving the site. I still believe in what Gatsby can do in the future, but I will be watching from the sidelines for now 🍿

A handsome man.

I'm Wesley. I live in Boston and work on Wonderment.

Go back to home