zlacker

[parent] [thread] 16 comments
1. est+(OP)[view] [source] 2025-09-30 09:23:55
I ditched Disqus for the exact same reason, too many ads

Then I built an alternative using free Cloudflare Worker

https://github.com/est/req4cmt

It's a simple service that transform comment POST form data to JSON, append to a .jsonl file, then do a `git push`

It renders comments by `git fetch` from a .jsonl file from a remote repo, or simply via raw.githubusercontent.com if your repo was hosted by Github.

The advantange over Github issue/discussion based comment plugins:

1. All data is stored a .git

2. no login of any sort

Github OAuth login might leak all your repo data along with your `access_token` to the plugin provider.

The `git push` works for any remote. You can choose github/gitlab or whatever.

replies(5): >>ffsm8+f3 >>antony+M7 >>Cthulh+W8 >>firest+Se >>ftchd+kL
2. ffsm8+f3[view] [source] 2025-09-30 09:59:53
>>est+(OP)
The issue with that approach is risk.

You now have a direct way for users to insert data into your repo, which can include illegal things. And if you're required to delete it later, you'll be forced to edit your git history.

But if everyone behaves, it's a great solution

replies(3): >>bmez+D3 >>cormor+zi >>est+Fk
◧◩
3. bmez+D3[view] [source] [discussion] 2025-09-30 10:04:17
>>ffsm8+f3
and the wasted CPU and memory involved. Git is by no means a good design for a comment-system, it is overcomplicating it in ways previously unimaginable.
replies(1): >>est+9l
4. antony+M7[view] [source] 2025-09-30 10:55:20
>>est+(OP)
I find the idea of using Git for comments somewhat terrifying, not least of all for the permanence of the history making moderation a nightmare.
replies(1): >>est+oq
5. Cthulh+W8[view] [source] 2025-09-30 11:07:15
>>est+(OP)
.jsonl files are fine for low volume comment threads I think, but others have already mentioned the use of git for storage. Would sqlite or Cloudflare's own D1 (SQLite compatible, also available in their free plan) work as an alternative?
replies(1): >>est+xl
6. firest+Se[view] [source] 2025-09-30 12:07:49
>>est+(OP)
I have done something similar with API Gateway, Lambda and DynamoDB. It is very cheap and doesn’t use Git.
◧◩
7. cormor+zi[view] [source] [discussion] 2025-09-30 12:37:48
>>ffsm8+f3
Worrying about editing git history buries the lede. Any comment system allows users to insert data into your site, which, if it might be illegal things, is a legal risk.
◧◩
8. est+Fk[view] [source] [discussion] 2025-09-30 12:52:59
>>ffsm8+f3
> direct way for users to insert data into your repo

Yes, and spam is also a huge concern.

I plan to mitigate by adding "Pull Request" style moderation next.

And you can switch to a private repo

For mass moderation, just git clone, grep the lines, sed them out, and `git push -f`

Remember the use case is for static generated personal blogs.

I'd argue it's even quicker than, say a paginated bloated megabytes javascript rendered single-page application moderation system.

◧◩◪
9. est+9l[view] [source] [discussion] 2025-09-30 12:56:03
>>bmez+D3
> Git is by no means a good design for a comment-system

I did try to implement partial-clone but failed

Let's be honest, for a personal blog, >1k comments is an overestimate.

It is painful for writing, but reading comments is quite fast and 99% is about loading.

replies(1): >>intern+5N
◧◩
10. est+xl[view] [source] [discussion] 2025-09-30 12:58:52
>>Cthulh+W8
> Would sqlite or Cloudflare's own D1 work as an alternative

They certainly do, but for they same reason why people chose static site generators like Hugo over Wordpress, I'd like complete control of full data.

The good value of static-hosted comments is that you `git clone` for backup and `git push` for redudency.

I also dislike managing DBs. Think of all those mess with backups, migrations, imports, exports, difference between mysql/pg/sqlite/d1. Tons of operating cost just for the sake of few blog comments

It's just a bunch of .jsonl files, the last resort is direct inline those .jsonl into .html files when generating

◧◩
11. est+oq[view] [source] [discussion] 2025-09-30 13:28:41
>>antony+M7
They are just bunch of static hosted .jsonl text files, one comment per commit, and makes up exactly one line

In case of comments you don't like, just delete the line and `git commit`

to erase the history entirely, use `git cherry-pick` and `git push -f`

It might be a nightmare for people not familiar with `git`, but for folks running a static blog like Hugo, they use lots of shell commands anyway.

replies(1): >>antony+Jx6
12. ftchd+kL[view] [source] 2025-09-30 15:07:28
>>est+(OP)
pardon my ignorance, but isn't there a solution that adds a Github comment box right below your post, and you comment directly with your Github account?

isn't that better IF the commenter has a GH account? (if you're writing a personal tech blog, then it's not a problem, your readers are Github users already)

replies(1): >>est+XE2
◧◩◪◨
13. intern+5N[view] [source] [discussion] 2025-09-30 15:14:27
>>est+9l
> Let's be honest, for a personal blog, >1k comments is an overestimate.

Maybe, maybe not. Before 2024, my blog got <10k views/y. Then in 2024 it got close to 1 million (this year it will likely be 100k). Very hard to predict traffic thanks to hn and stuff!

◧◩
14. est+XE2[view] [source] [discussion] 2025-10-01 02:37:19
>>ftchd+kL
> and you comment directly with your Github account

Github issue or discussion based plugins require OAuth

If you look closely, some OAuth scope requires "Act on your behalf". Others require "repo" scope which means read your private data.

◧◩◪
15. antony+Jx6[view] [source] [discussion] 2025-10-02 12:18:33
>>est+oq
Your implementation might be static json files, but it's not impossible to force other filetypes in there. This in itself makes it high risk?

Allowing force-push is considered an antipattern for Git, and generally best avoided. It's a safeguard against lost history and prevents data loss.

That aside, the comments are the history. Git is the wrong tool for the job. Why would you choose a generic version-control system designed for source code diffs & merges for the specialised task of chronologically-ordered comments? A database such as PostgreSQL is a far superior choice in just about every possible way. I admire your ingenuity here to make something out of what's available, but I respectfully disagree with this being a good way to capture user-generated content when there are better alternatives.

replies(1): >>est+yua
◧◩◪◨
16. est+yua[view] [source] [discussion] 2025-10-03 15:09:51
>>antony+Jx6
> it's not impossible to force other filetypes in there. This in itself makes it high risk

you mean other files will bloat the repo and slow down the performance? Yes it's a very valid concern, but this system targets personal blogs, which I assume had very few comment traffic.

> Git is the wrong tool for the job ..... A database ... is a far superior choice in just about every possible way

the same argument applies to Wordpress.

But most tech people are choosing static generated blogs anyway, and with git too. File system is the database.

And there are good reasons for that.

replies(1): >>antony+Mck
◧◩◪◨⬒
17. antony+Mck[view] [source] [discussion] 2025-10-07 09:53:29
>>est+yua
You hit a chord here with me, I've moved away from WP to Hugo & Eleventy. For interactive features like comments, the search/sort/filter of databases is a strong draw though, and I'm already wanting to add search to Hugo. There's compromises in every approach, but SQL brings a lot to the table that flat files just can't do without a fair wedge of effort... or is there a tool/library that could index thousands of markdown files plus their comments in json/yaml/md format? Statically rendering the comments would give get me 80% of the way there, without free text search. Maybe I'm just ignorant of the tools available, blinded by my past experience and knowledge with older architectures.

I still wouldn't put them into Git along with the rest of the site, that's a definitely no-no. A separate Git? Also no for me. Filesystem does seem viable on reflection, and I feel inspired to explore this now.

[go to top]