Trifecta

Trifecta is actual stand-alone software that you can use to paste and drag images to, for easy sharing. It has pained me for years that I had to use imgur for this purpose. Not only does imgur install lots of cookies and trackers on my browser, I also then force these onto the people that visit the images that I share. I checked out some existing solutions you could download, but I worry about their security.

So, also to make a point, I decided to create an open source minimalistic but also useful image sharing solution that I could trust. And more important, that other people could trust as well, because you can check out the whole code within a few hours.

And this is what you then end up with:

A self-contained solution with just a handful of dependencies that gives you a feature complete image sharing site:

  • Full user and session management
  • Drag and drop multiple images at the same time
  • Posts can contain multiple images
    • Each post has an optional title, each image an optional caption
    • Posts can be public, or time limited public
  • Passwordless accounts are possible (log in using a temporary sign-in email link)
    • Lost password email flow
  • One cookie, locked tight to the site
  • Comes as source, binary, docker, or .deb or .rpm
  • Source code small enough you could read all if it in a day
  • Source code also reusable for other web frameworks
  • Clean design with a minimalistic Javascript frontend and a C++ backend

Note that this is not intended as a public site where random people can share images, as this does not tend to end well. It is however very suitable for company, group, or personal use.

I wrote more about the why of it all in the post “A 2024 Plea For Lean Software, with running code”.

Components

The software consists of a server process, which provides an HTTP API for creating users, posts, images etc. It hosts all these in a single sqlite3 database. The server also hosts a few Javascript and HTML/CSS/SVG files that provide the frontend. To send out password reset/passwordless login emails, it connects to an SMTP server.

To run the software, put it behind a real webserver that does TLS and certificate management for you. Instructions are in the README.

The server configures the sqlite database automatically, there is no need to load a schema. Out of the box, the system is not operational as it has no admin user. If you run the server with --rnd-admin-password it will create an admin user with a randomly generated password for you. If you run it again like that it will only change the password.

Running the server

You could of course start everything manually, but it is likely better to either use the supplied systemd file or the Docker image. You can get the software as .deb and .rpm, or you can use the Docker/podman container on the Docker hub. There is also a helpful Docker compose file with which you can configure the container.

Security updates

For best security, it is recommended to run the Docker image and install something like Watchtower to enable security updates.