Sunday, July 18, 2021

Blog Architecture Changes

What if I architect my blog like this:

  • Blog just pulls in RSS feed to render content, titles, HTML etc all done on the server
  • RSS built via build command that I can run on my local machine, it could also I guess be done automatically via a cron job but I don't think that it's super necessary

Build command is pretty heavy, use Go for speed, this is how it would work:

  1. Fetch all files on S3
  2. Read their content
  3. Convert markdown to HTML
  4. Create RSS file
  5. Delete/add RSS file to src directory in blog client, deploy blog client to Netlify

This process removes the need to have any backend. You still need to store files in some kind of cloud storage for backup purposes. S3 is suitable for this.

The blog has now implemented these features. I worked on this over one weekend. You can view the build code logic here. I'm very happy with the results! Will now be able to turn off my Heroku Rails server that was talking to S3.

I'm also much happier with an improved Lighthouse score that easily pushes above 80 for performance.

The main clean up left is to split the rss code up into functions. For now it works and I'll leave it but the code could be much cleaner.

I realised that files in src will have different urls after each deploy. There is a duplicate rss.xml file in both src and public. The RSS file that others can consume with a fixed url is in public.