If you use Threema, you probably know of the "Threema Web" feature.
But did you know it's open source?

So what’s Threema Web?

It’s basically a web application, that connects with your phone and allows you to chat on your desktop through the browser. You can see all your chats in the browser as they appear on the phone.

I’m not a fan of the fact that Threema is closed source. But did you know that Threema Web is open source? This means we can host our very own copy! And that’s even officially supported!

Let’s do it!

Getting the source

It’s on GitHub! Awesome!

git clone https://github.com/threema-ch/threema-web.git

Building it

Now you’ll want to edit the file src/config.ts and change SELF_HOSTED to true.

Next we build it with npm (get it with apt install npm on Debian based systems)!

While in the threema-web folder (root of the repo) run:

npm install --production

Now we wait for it to build. I successfully built it on WSL because I’m evil.

Packing and distributing it

And now we pack it for distribution!

npm run dist

It will take a little while, and in the end it will output to dist/threema-web-[VERSION].tar.gz which is the archive you’ll want to extract to your “web space”, to self-host Threema Web.

Make sure your web server knows the mime type application/wasm for .wasm files, as stated in the upstream guide.

Result

Check out (and feel free to use) my own self-hosted copy! I made sure there’s no Cloudflare in between, for privacy. https://threema.sindastra.de/

I also made sure to get an A+ on ssllabs.com.

That’s all there is to it…

But wait! There is more! (Advanced)

If you followed this guide, you should now have your self-hosted version of Threema Web, as seen in the “Result” section above. But that’s just the web application! The SaltyRTC and the STUN / TURN servers are still hosted by Threema. While you can also self-host the those, this is out of the scope of this guide. Maybe if people want to, I could write a guide for that too. Let me know in the comments!

External Links