My profile picture. My mom says I'm a handsome boy!
← All Posts

Gatsby

#Code, #Projects

I recently had some issues with Next.js on Zeit's Now - I tried to move to their API routes but discovered that they don't work with the filesystem. The code worked fine locally but broke the moment I deployed - the issue wasn't the easiest to figure out!

A friend recommended I check out Gatsby. I had looked at it a few years ago and decided on Next.js, but I decided now was as good a time as ever to move my site over to it and give it another try!

This website is now all in on Gatsby. The process took a little over four hours start to finish, most of which was learning about Gatsby structures and theories. Moving React components and stylesheets was very easy, and the content modifications for my blog posts were pretty minor. The biggest investment was writing the GraphQL connections and working with slug URLs.

What I like

Frontmatter! It's a super minor thing, but I missed the frontmatter in my blog post files from back in the Jekyll days. With Gatsby I have it back. This might be a 'recent' MDX thing thought - I haven't checked.

The plugin system is amazing as well - I rolled my own Prism system last time, but with Gatsby it's a one-line plugin inclusion. Much easier to maintain, and much less prone to bugs!

What I don't like

Helmet is a great tool but it doesn't feel quite as clean as Next.js's _document.js and _app.js - I think I prefer those and the direct ability to modify the HTML structure.

What I changed my mind on

Originally I thought a GraphQL API for interacting with the filesystem was massive overkill. Why have an API for a filesystem? For a large scale website it might make sense, but for a blog? It seemed like over-engineering to the extreme.

Coming back, I realized I had four files that served as custom filesystem APIs to achieve what I needed for my website design. 🤔 Hmmm. I missed the mark on this one by a couple hundred miles. The GraphQL system streamlined a lot of code for me. What turned me away from the platform initially is now one of my favorite parts about it.

What's Next? (Haaaa!)

Since my website wasn't working the goal was to get switched over and back online as fast as possible - I'm sure I violated some Gatsby best practices, and I know I haven't taken full advantage of the platform yet. I'm looking forward to making adjustments and tapping into more of Gatsby's capabilities in the future.

Next.js is still a fantastic framework - I'll definitely still be using it. In fact, I'll probably be using it in short order when I begin working on Aquarius's dashboard.