Gatsby to Astro Migration

Migrating from Gatsby to Astro

Migrating from Gatsby to Astro | Blog

Migrating from Gatsby to Astro

I’ve had this URL for a while now, it has been a blog since around 2018. It has lived on many platforms in that time. I forget them all. Sometimes a platform seems fine at the beginning, but as you use it more and more, you realise it isn’t giving you what you want, at least not entirely.

It started out on a managed platform, I remember that, it was really quick and easy to get started and at the time, that’s what I wanted. I have the technical chops to build something from scratch, at least I like to think so anyway. But if all I want to do is ‘talk’ about what I’m doing or what I am interested in at the minute, then why do I want to spend time building and maintaining my own platform?

Legacy OneMoreDavid

Platforms will always try to upsell

I think the first platform was like a budget airline where the initial price seems good, but they keep upselling you until you’ve basically paid the same as using the flight that was at a better time or from a more convenient airport… You got ‘this much’ for ‘this price’ but they built their pricing options in a really clever way, so that they knew you’d want a couple of things from the next tier, so you pay more than you want, just to get those extra features, oh and then look at that next tier, that gets rid of their adverts and either lets you monetise as you wish, or simply remove adverts. So you pay to upgrade to a new tier, then comes the service renewal, and guess what, they’ve increased prices.

I then moved to Wordpress (managed hosting), which was okay, but again, the pricing model kind of annoyed me, less so than that first provider though. However, I think it was whilst with this service provider that I was forced to disable comments. I had dared write a post on the subject of web3, more specifically, NFTs. The post was absolutely smashed by bots, spamming the heck out of it. The comments service did a relatively good job of controlling spam until this post, when it seemed to just give up and the flood gates opened. I disabled comments in 2020 as a result.

Legacy OneMoreDavid (2)

My time with the VPS

Some time in 2021 I think, I started hosting the blog myself. I had access to a bunch of VPSs, so I carved off a bit of space and migrated my blog to a self-hosted Hugo deployment. That was fine for a while. Eventually the company I was working with started migrating customers away from the VPS offering, so I rebuilt the blog using Gatsby and that’s where we’ve been for the last couple of years.

Over the last couple of years I have added and removed things, I have customised the blog in numerous small ways to make that blog mine. I mean it is still a Gatsby blog, so it can’t be completely different from any other Gatsby blog, but it has enough differences to make it a little unique. The problem with things like Gatsby and Wordpress etc, is that they are built to be many things to many people, very few people need everything. So you turn bits on and you modify bits, but when the core code is updated by the devs, it can break all of those little things you have done. Probably there are some ‘best practices’ to follow, but I didn’t.

Legacy OneMoreDavid (3)

Netlify is cool

I was using Netlify for that Gatsby blog, it worked brilliantly, when paired with a GitHub repo, I can write a new blog post (using Markdown), the Netlify robots monitor my GitHub repo and push out the changed site after I merge to main. At some point I noticed that my Netlify builds would fail, the error is rarely useful. I’d spend some time trying to find a cause, change a few things, push again, and it would work. A couple of blog posts later and the build would fail again. Eventually I realised that I should just trigger a manual deploy before doing any troubleshooting as deploying the exact same code again would succeed. The problem might be with Netlify. It might be with my many little customisations. I didn’t figure out the root of the problem.

Comments Broke My Site

A couple of months ago, I had a few reach-outs via Twitter and LinkedIn regarding some content on the blog, I loved that. I started thinking about re-enabling comments. As we got to the end of September I had some time and decided to enable comments using GitHub.

Comments Broke My Site

I found myself in Dependency Hell, I accept that this was partly the result of my own customisations, but adding this new module to enable comments required some versions of modules that I didn’t have, those versions broke something else and I basically spent a couple of days intermittently looking for an answer.

Astro

I gave up and re-built the blog using Astro from the ground up. Initially I was aiming to avoid using any modules beyond core, but I quickly realised that I didn’t want to try and reinvent every wheel. So I may stumble into Dependency Hell again at some point, but I’ve tried to build the custom stuff in a way that it will be less of an issue keeping things up to date. I hope.

I’ve never worked with Astro before so I did lean on LLMs for a lot of support, I use an LLM like a friendly senior dev that can sometimes tell me an answer, but often, point me in the right direction so I can figure it out myself.

Speed

I never bother testing the speed before, the old site felt fast enough, but now I’m using Astro, I notice it is faster in almost all regards. I keep links to the 3 latests articles on my personal portfolio site as well David-Dickinson.com, I noticed that the speed at which those 3 links are generated on the other site has vastly increased, again, I never really thought it was slow before, but now I can see it could have been (and is) much faster.