Where to start with a distributed/decentralized social network concept?

I’m thinking of implementing a decentralized/distributed social network like secure-scuttlebutt with Elixir.

The key is that, each user is running their own network on their machine. So I would want to create an Elixir executable that that could be a long-running daemon/service on desktops and ideally on mobile (maybe with lumen?).

In order to update their local network, users connect to servers that basically blindly connect you directly to other users (like a switchboard operator with earplugs).

And it could actually store your “rolodex” of known users in ETS :smiley:

I’ll take any / all thoughts on this. Where to start? This is a bad idea for elixir?

2 Likes

Wow, looks like this post is highly relevant Social networks with Phoenix.Presence

There was a job offer on ElixirJobs in April from a company called moodle who were looking for an Elixir dev to help them with their project which was some kind of a social network implementing the ActivityPub protocol.

Apparently that project is open source: https://gitlab.com/moodlenet/servers/federated

That ActivityPub spec looks rather complicated not sure if this is something you’d want to start with but it might help you or inspire.

3 Likes

Corollary: make sure you understand CRDTs as well. It’s an extremely important concept in decentralised storage.

(However, maybe the storage library you choose will handle decentralised data reading and writing already.)

There’s also an Elixir CRDT library.

2 Likes

Why not secure-scuttlebutt? I made (an incomplete) implementation of the SSB protocol in erlang and it was fairly straight-forward. The only thing I didn’t like about the protocol was that it seemed to rely on the javascript JSON serialization, so unless you serialized exactly as node does it may not interoperate with other implementations. I might remember wrong though.

Secure scuttlebutt protocol is documented here: https://ssbc.github.io/scuttlebutt-protocol-guide/

I used https://github.com/jlouis/enacl for crypto but this was a couple of years ago so there may be better alternatives out there.

Is elixir suitable for this? I don’t now. For the server side work it definitely is but desktop and mobile? I think it is doable but not might be the most suitable.

2 Likes

Elixir is pretty good at federation and similar distributed problems. Check out what the guys at Pleroma are doing: https://pleroma.social/.

3 Likes

I want to make something that is an extension of natural human relationships. SSB gets a lot of things right, but there are also assumptions in the design that make it really difficult to fix. For example, the assumption that I want to automatically leech/seed feeds from friends of my friends.

I won’t go into more depth than that because it would require a book haha

1 Like

Just adding on to this thread.

The below blog post talks about how Presence is actually a CRDT distributed database (essentially). Can someone point me to the codebase for the Presence system? Seems like it could be easily extended to include more than just online presence “pings”. If it could hold data like status updates, then it’s already halfway there to being like SSB.

:wave:

Can someone point me to the codebase for the Presence system?

It’s split among two libraries, :phoenix and :phoenix_pubsub. :phoenix contains the Phoenix.Presense behaviour and its default implementation using :phoenix_pubsub’s Phoenix.Tracker. Most of the actual logic dealing with CRDTs and stuff is split from those files into a few other modules though.

2 Likes