Themis dev diary #6

Themis is done. Not complete, mind you, but done. I haven’t worked much on it over the summer, and there are many reasons for that: writing, relationships, and so on. Code falls behind, and I’ve been focusing more on Liblio, my federated creator platform.

It’s a bit different, owing to its different requirements. For instance, there’s no real threading for comments, and the central metaphor is an announcement rather than a discussion. Really, it’s more of a Tumblr/DeviantArt/etc. replacement than a serious platform for debate. (I’ll open up a public repo once I’m more confident in its state, just so you know.)

But designing and implementing Liblio has taught me a lot about Themis. Mostly, what I’ve learned is that it isn’t scalable. New features are very difficult to add. The front end is in dire need of refactoring. And the server stack just isn’t up to what I want. So that’s why I’ve decided to make a change. Thus, I announce the successor to Themis: D4.

What is D4, you might ask? Well, that’s easy. It’s Themis, but revised and revamped. The name itself alludes to alliteration, something I love: the 4 D’s are Declare, Discuss, Debate, Decentralize. That’s basically the project’s motto; branding and the like will come later.

Note that I am not simply throwing away the Themis code. All of the core functionality will move to D4. It will be a federated platform for discussion with a heavy emphasis on threaded conversation, rich filtering systems, topic-based grouping, and all the good things that come from opening up and having honest debate without the fear of reprisal. It will still speak ActivityPub, so you can (in theory) follow and participate even if you’re on Mastodon, Pleroma, or any of the other myriad fediverse platforms.

In the coming weeks, I hope beat the code into shape for a release. Once that’s done, I’ll go ahead and push the final Themis alpha, which will have a link to the project’s successor. Until then, here’s a bit of a postmortem.

Rationale

The premise behind Themis was sound, in my opinion. It still is. If I didn’t believe that, I wouldn’t be doing the same thing all over again with D4. And the world truly needs platforms like this. The flat timeline approach of Twitter and Mastodon makes it difficult to track a conversation. The commercialization and attendant censorship necessities on, say, Facebook and Reddit create a hostile environment for honest debate. Essentially every popular platform now promotes (by design or by accident) the polarization of social media that we see today. So we do need something different.

However, the software I was using to develop Themis just didn’t cut it. Nest is a great framework. Typescript is what JavaScript should be, if you ask me. Vue remains my favorite UI library. But everything I had done became too brittle. As any developer knows, it’s all too easy to turn your code castle into a house of cards, and that’s what happened to me.

It’s a poor craftsman who blames his tools, yes, but in this case some of the tools weren’t up to snuff. In particular, TypeORM, the database abstraction layer specifically recommended by the Nest documentation, is…not production-ready. It was at version 0.3 when I used it, and that beta label showed in too many respects. Thanks to Liblio (and the excellent SQLAlchemy library I’m using for it), I can see the deficiencies more clearly. Most apparent is that TypeORM has very limited support for nested or hierarchical data. For a back end based on nested messages, that’s far from ideal.

I have other problems with the stack I was using, but I don’t want this to turn into a rant, so let’s just say that I had to do some major hacking to make everything work right. (One example: Nest’s HTTP body parser, obviously necessary for requests like, oh, making a post, doesn’t allow you to use custom JSON mimetypes. Those are required by the ActivityPub spec.) And the documentation, as is far too common in the Node/JS/TS world, told me almost nothing. In a lot of cases, I discovered a bug or limitation only after hours of digging through Github issues, StackOverflow posts, or even the actual source code of a library. And it was just maddening.

But the final straw was my attempt at upgrading a few weeks back. I was using Vuetify for the Themis UI. (What can I say? I’m the weirdo who really likes Material Design.) Well, they put out a new major version, 2.0. So why not upgrade, right? Themis is still alpha, so breakage is to be expected.

Uh, nope. I still have no idea what happened, but upgrading from Vuetify 1.5 to 2.0 broke everything. I followed the instructions in their docs, but got a series of Typescript compilation errors that I could not resolve. Maybe it was something to do with my build setup. I don’t know. What I do know is that it frustrated me so much that I just plain quit. I don’t need that level of stress.

Compared to that, Liblio is a breath of fresh air, and it gave me the perspective to see what’s wrong with Themis and, more importantly, what I can do to fix it.

Fixing it, I think, means making it into something else, and that something is D4.

Leave a Reply

Your email address will not be published. Required fields are marked *