Grumpy Gamer

Ye Olde Grumpy Gamer Blog. Est. 2004

Dec 30, 2025

When I started using Hugu for static site generation I lost the ability to have comments and we all know now supportive the Internet can be, so why wouldn’t you have comments?

I wrote a few php scripts that I added on to Hugo and I had comments again. I decided to store the comments as flat files so I didn’t complicate things by needing the bloated MySQL. I wanted to keep it as simple and fast as possible.

When a comment is added, my PHP script created a directory (if needed) for the post and saves the comment out as a .json file with name as the current time to make sorting easy.

When the blog page was displayed, these files (already sorted thanks to the filename) were loaded and displayed.

And it all worked well until it didn’t. Flat files are simple. but they can be hard to search or maintain if they need cleaning up or dealt with after a spam attack. I figured I use commandline tools to do all of that, but it’s a lot more cumbersome than I first thought.

I missed have them in a sql database.

I didn’t want to install MySQL again, but my site doesn’t get a lot of commenting traffic so I could use Sqlite instead. The downside is Sqlite write-locks the database while a write is happening. In my case it’s a fraction of a second and wouldn’t be a issue.

The second problem I had was the version of Ubuntu my server was using is 5 years old and some of the packages I wanted wouldn’t available for it. I tried to update Ubuntu and for reasons I don’t fully understand I couldn’t.

So I spun up a new server. Since grumpygamer.com is a statics site I only had to install Apache and I was off and running. Fun times.

But the comment flat files still bugged me and I thought I’d use this as an opportunity to convert over to Sqlite. PHP/Apache comes with Sqilte already installed, so that’s easy.

A long weekend and I rewrote the code to save comments and everything is back and working.

Given that a webserver and PHP already needed to be installed, it isn’t a big deal to use Sqlite. If you’re not comfortable with SQL, it might be harder but I like SQL.


Comments:

Fabio Dec 29, 2025
Nice!, i'm using MySQL since 2002 on my blog, so it's impossible to change for flat files with more than 180k comments and 9.5k posts šŸ˜… but i'll always recommend using a database, you can avoid a lot of problems with this kind of situations and it's easier to clean after spambots, there's a lot of abstractions easy to add to any code so you don't have to write everything again, but it's a choice!
Lone Pirate Dec 29, 2025
Noice! Keep it simple, but not simpler!

If one doesn't like SQL but still wants an embeddedable database, I'd recommend lmdb.
Renão Dec 29, 2025
Honestly, I liked that first iteration with the files anyhow :)
It matches the simplistic design of a (file based) static website - but as you said, there are downsides and pitfalls.

In the end it feels like making tradeoffs to have this feature - but it's worth it in my opinion.

Getting feedback right at your blog posts by having something like comments or favs/likes/toots/... can be motivating to keep on writing.
Rando from activitypub Dec 29, 2025
Really cool!
Elaine Marley Dec 30, 2025
Be nice! Plain text only.
Joe Dec 30, 2025
Ron?
Ron Gilbert āœ” Dec 30, 2025
What?
Sushinateur Dec 30, 2025
Cool :-) . Sending greetings from your database, it's nice over here ;-)
Sven Dec 30, 2025
Hi Ron!

I really like your games, blog and approach!

I can totally relate as to why a file based solution might be hard to maintain after those spam events, does the hcaptcha I see here help with that?

Cheers
Sven
Sepix Dec 30, 2025
I'm really just commenting because I can!
bil o sags Dec 30, 2025
I'm in an sql database. I love it
Ron Gilbert āœ” Dec 30, 2025
>> does the hcaptcha I see here help with that?

Yeah, it basically dropped the spam to zero. A bigger problem was script kiddies trying to do I don't know what. I'd wake up to 500 messages with random stuff in them.
Boybrush Dec 30, 2025
Hello again mr. Gilbert! Wishing you a super 2026 with a small hope for a remaster of Maniac Mansion, or... anything related with your adventure games :)
Sven Dec 30, 2025
But doesn't that mean they found a way around the captcha? Or is that 'client-side' only? Ah, you know what? Forget it. I sound like I want to extract information. :)

I hope you stay clear of those destructive SKs!
Ron Gilbert āœ” Dec 30, 2025
This was before I added captcha. It was easy to script adding comments.
Thomas Dec 30, 2025
Fir thise whi want something similar but don't want to write it themselves: check out Isso (simple, Python) and Remark42 (more features, Go).
00oofxoo00 Dec 30, 2025
I liked the files approach and I use it everywhere just i usually don't have just one directory bit I calculate some hash and split them in a pair directory/name because the fs tends to work not so well when the number of files is huge. Anyway given the fact that SQLite comes with the server probably that is a good choice too.
Encelo Dec 30, 2025
For my static Hugo sites I ended up using Giscus. There's maybe I bit of friction for users, that need a GitHub account, but it was an easy solution to integrate, as my sites are hosted on GitHub Pages.
Ccc Dec 30, 2025
Ggg
Max Battcher Dec 30, 2025
One big piece of advice is to switch your Sqlite file to WAL journalling mode. It is the mode most optimized for ā€œmany readers, occasional writersā€ and will reduce lock contention for something like webpage comments.

There’s been a lot of cool stuff happening in the field of using Sqlite as your only/primary database. Datasette is a platform built on the idea of Sqlite files as reusable databases. Companies like Fly.io and CloudFlare have been promoting it as a good idea for ā€œedgeā€ computing (moving things like your comments system out of the central static host to workers in a CDN). Tools like Litestream and backup options (such as live backup to an S3 bucket).

It’s neat to see all the exploration around Sqlite databases as a lightweight alternative to MySQL/MariaDB/PostgreSQL/etc.
Me Dec 30, 2025
Nothing beats SQL.
I used to have a comments system with a logging library. I wrote comments as INFO logs to a /comments folder. Worked nice, since there are lots of tools to query logging files.
Pascal Dec 30, 2025
I used caddy for my latest project. It is available on Debian and has letsencrypt support.
There’s also fastcgi for php, but I would likely just vibe-code a Go-based comment application.
E Dec 30, 2025
Are you aware the Thimbleweed Park forums are still active, and do you have any thoughts on that?
Ron Gilbert āœ” Dec 30, 2025
>> Are you aware the Thimbleweed Park forums are still active

I lost my passsword.
E Dec 31, 2025
lolllll
Kokos Jan 01, 2026
Don’t install MySQL/MariaDB, because bloated. Install Apache instead of nginx. :) It doesn’t compute! ;)
Alishara Jan 02, 2026
How much wood would a woodchuck chuck if a woodchuck could chuck wood?
Ricardo Jan 04, 2026
yay!
Picard Jan 04, 2026
Make it so!
Johnny Walker Jan 04, 2026
I don't like flat files. They're fast and efficient until you encounter all the problems and reasons we invented databases in the first place.

Add comment: