Let me get this disclaimer out of the way first:
I am developing this as part of my bachelor’s project. That means I have already been working on it since the beginning of October, and will continue working on it (at least) until the end of 2020.
Also, I am unsure of whether I am allowed to publish any code yet - if I receive PR’s before I submit my report, is that plagiarism? To be on the safe side, I’m going to delay release until January 2021.
Now, lets get into it!
I am building a system for embeddable web comments, which uses the Matrix protocol.
It’s a thing you can add to your static (or not) website, to get a comments section where the back-end is any Matrix server.
It’s essentially a competitor to Disqus or Facebook Comments - but decentralized and open source using Matrix!
If you’re not familiar with Matrix: it’s essentially an instant-messaging protocol, that federates messages between any number of participating Matrix servers.
The architecture is essentially like email, but much better for instant messages, custom multimedia stuff, and group conversations.
It also has a bunch of interesting features, like easily bridging to other protocols (like irc, slack, discord).
Useful links include: https://matrix.org https://element.io
Using Matrix for web comments has some interesting properties:
Client independence
You can participate in the comment conversation from a large number of existing clients
Redundancy
If the default server goes down, you can still access the conversation through any other server (which has previously federated the room).
Privacy
You don’t have to authenticate against any specific server. You only have to authenticate against the Matrix server that you trust.
Freedom from third-party influence
The antithesis to this would be using Facebook Comments, in which case Facebook decides what you can and cannot say. When basing it on an open spec like Matrix, you can point your comments section towards a Matrix server you trust - or just run the Matrix server yourself.
Openness
Matrix is an open specification, governed by a non-profit, with a really acessible and transparent spec-change process. All major clients and server implementations are open source.
I don’t think I need to argue here why this matters.
So yeah… that’s why.
But how?
It’s essentially two parts:
The embeddable web client
This is the thing you put in your website. It lets you view comments while unauthenticated, by making a guest account on a default Matrix server, and fetching the messages from there. The web client allows you to either post comments as this guest user, or to log in with Matrix user on any other homeserver - at which point all Matrix communications happen with the chosen homeserver, instead of the default one.
The web client is written in Elm, because I prefer programming to debugging.
The server-side appservice
An appservice is like a “Matrix server plug-in”. It lets you do special stuff inside a Matrix server.
The appservice is a non-essential component (the entire system works without it). But it adds a lot of niceties that you might want.
Mainly it supports some moderation stuff, like banning users across a number of Matrix rooms, or provisioning moderation rights across all those rooms.
The appservice also automates room creation, so you don’t have to manually create a new Matrix room, every time you put up a new blog post.
So yeah… that’s roughly it.
There’s of course a bunch more interesting details, but I guess I’ll leave those until later.
Feel free to reach out, if you’re curious about this project or Matrix in general. I’ll be more than happy to chat about it!