hello world and keystatic
My first ever blog post
hello world!
After years of procrastinating. I have finally decided to recreate my website with the functionality of adding blogposts. While exploring on the different options of doing blogposts, I came across the magic of keystatic.
I was considering several options:
- Markdown files in my web files, but that would mean for every need blogpost I would have to recommit and deploy, which is a hassle
- A custom admin panel dashboard for me to add my posts, and the posts are stored in DB, which definitely is a nono to me
- Write my posts in a Obsidian vault? or possibly another third party platform, and use APIs to call that? Sounds like I'm relying a lot on third party, which is something I didn't want to get into.
- Finally Keystatic, it sounds like a hassle to set that up too, but eventually I figured it is the best option for me. Why so? I will explain...
Firstly, my website is a Next.JS project with the repo hosted on GitHub, and deployed to Vercel. With that being said, keystatic allows me to edit posts through a CMS that is available on my website (yes this website), and I can authenticate through logging into my own github, and from there I would be able to add my own posts. After adding my own posts, it gets commited to Github and it will allow vercel to redeploy.
What I really like about this setup is that despite having a CMS, there isn't actually a separate database storing all my blogposts somewhere. My blogposts still live within my own Github repo as files. Keystatic is basically just giving me a much nicer interface to create and edit them.
So instead of me having to open my project, create a new markdown file, remember whatever fields I need, commit it, push it, and wait for vercel to deploy, I can just visit the keystatic page on my website, login with Github, write whatever I want to write, and save.
Keystatic will handle the committing part for me, Github will detect the new commit, Vercel will detect the Github commit, and the website gets redeployed.
Basically:
Me writing random stuff > Keystatic > Github > Vercel > you reading this
And I think that's pretty cool.
Another reason why I like this is because I still own all of my content. If one day I decide that I don't want to use Keystatic anymore, all my blogposts are still sitting inside my Github repo. I'm not really locked into anything. I can remove Keystatic, switch to another CMS, go back to manually writing markdown files, or do whatever stupid system I come up with in the future.
It also means I don't have to maintain another database, another backend service, or another platform just for me to occasionally write something here. Considering how often I actually procrastinate on things, setting up an entire database just for a blog would probably be a very overengineered solution.
Which is saying something coming from a software engineer.
There were definitely some annoying parts setting Keystatic up though. Especially figuring out the Github App, authentication, environment variables, callbacks, and getting everything to work properly together with Vercel. At one point I literally opened /keystatic and was greeted with:
Keystatic is not configured.
Very helpful.
But eventually everything worked, and now I have what is basically my own little CMS directly inside my website.
I also want this blog to be something that I don't really have to think too hard about posting on. I don't plan on making everything some professionally written technical article. It might be about something I'm building, something I learnt, a random thought, games, tech, or whatever I feel like writing about.
But for now, this works.
And considering this is the first blogpost...
hello world!