DEV Community

Leonardo Teixeira Menezes
Leonardo Teixeira Menezes

Posted on • Updated on

ActivityPub, Fediverse and the Future of social networks

With the recent growth of Mastodon and Threads, you might have heard about ActivityPub, a relatively new networking protocol that has gathered momentum and is on its way to change how social networks work on the web. This article will give you an introduction to ActivityPub, how it’s used on the Fediverse, and some insights into how it might grow on the internet going ahead.

A Crash Course into ActivityPub

The ActivityPub protocol is a decentralized social networking protocol, it defines how applications can represent and communicate classic social network interactions such as ‘Posting a Photo’ or ‘Following a person’, creating a standard with which decentralized social network servers and clients can communicate. ActivityPub is a real-time pub/sub protocol, based on HTTP and JSON.

Let’s start by breaking down an ActivityPub request with one example request, this is a request from UserA to follow UserB on a social network:

HTTP POST Request

{
  "@context" : "https://www.w3.org/ns/activitystreams",
  "id":"https://my-example.com/my-first-follow",
  "type" : "Follow",
  "actor" : "https://mastodon.social/users/UserA",
  "object" : "https://mastodon.social/users/UserB"
}
Enter fullscreen mode Exit fullscreen mode

At first glance, you might notice how intuitive it is, we are making a request of type ‘Follow’ performed by the actor ‘UserA’ to the object ‘UserB. There are three sets of types in ActivityPub:

  • Activities: They describe actions that can happen on the social network.
  • Actors: Describe entities that can perform activities.
  • Objects: Describes an object of any kind.

With these three sets, we can describe classic social network interactions, such as posting an image, following someone, or checking in on an event. The value that ActivityPub creates is by defining a standard to communicate these interactions across federated social networks, creating the possibility, for example, for a user on a social network to follow and interact with someone on a different network.

In order to enable federated social network interactions ActivityPub created the definition of an actor Inbox and Outbox, these are a collection of every action published by the actors that are ready to be requested by other social networks (Outbox) and a collection in which an actor receives actions performed by other actors (Inbox).

Image illustrating other social network instances requesting an actor Inbox and Outbox

In practical terms, your “Inbox” will be an endpoint in which other actors can do POST requests to inform you of new activities, and your “Outbox” will be requested using GET requests by actors to update themselves on the latest activities you created.

Your Inbox and Outbox exist on your ‘Home Server’, we are going to explore the concept of a ‘Home server’ later but for now think of it as the server that is hosting your social network account, this server is going to be responsible for the underlying infrastructure of your social network, for receiving new activities posted on your Inbox and for making your Outbox available for other networks to fetch.

The Fediverse

‘Fediverse’ is a combination of the words “Federated” and “Universe”, it’s also a term that was invented to describe a group of federated social networks that interact with each other using protocols such as the ActivityPub. It started out with a single social network in 2008 and now has more than thousands of live instances with millions of active users. Since the release of ActivityPub in 2018 most of these servers already added support for it and it’s now the most prominent protocol for this server-to-server communication.

In order to join the Fediverse as a user you need to either create your own server to host your account or to choose an existing instance to be your ‘Home server’. Your home server will be responsible for all your account infrastructure on the Fediverse, it will host your Inbox and Outbox and will be the source of truth for your account information.

Adding support for ActivityPub and joining the Fediverse means that a social network can leverage the existing user base of the Fediverse to create content for its own users and to increase the reach of users on its network.

One of the biggest drivers behind the growth of the Fediverse is the open-source project Mastodon. Mastodon is an open-source social network server based on ActivityPub that you can use to host your own social network, it’s also the backend for some of the biggest Fediverse projects that are currently live, such as the Mastodon Social (1M+ users) and Truth Social (2M+ users).

Why would users care about the Fediverse?

There are two main benefits of being part of the Fediverse, Freedom and Content.

Being part of the Fediverse means that you have the freedom to choose a network tailored to your specific needs as your home server, users are free to pick instances based on their content moderation policy, technical reliability, and others, while still being able to interact with their friends that are using a different network or even hosting their own instance.

Using a Fediverse social network also means that you are going to have more content than a traditionally upcoming social network. The Fediverse already has millions of users and several social networks have already announced that they are going to add support for it, such as Tumblr and Threads, this means that even if you are part of a small federated instance you can still consume content being posted on other social networks.

As Bill Gates once said, “Content is king” on the Internet, and since the beginning of social networks users have flocked to where content is being published, but this might change with the Fediverse. With content being available to the whole Fediverse as opposed to a single social network instance this means that each user can make their decision about their home server without taking content into consideration.

Challenges Ahead

Both ActivityPub and the Fediverse have several challenges ahead if they are to continue with their current growth rate.

The first and most pressing one is scalability, ActivityPub is a very recent protocol, it was published in 2018 and so far it has been an uphill battle to scale it with constant outages and degraded user experience. This could be a common case of scaling issues for an early-stage social network with a high growth rate however there are some design decisions behind this protocol that might make it especially hard to scale. Jeff Darcy, an engineer at Meta, wrote a post about this topic, I recommend the read for more context about some of these issues as well as some insights on scaling social networks: https://gist.github.com/jdarcy/60107fe4e653819138396257df302eef

Another important issue is privacy and safety, being a distributed and decentralized network the Fediverse doesn’t have guarantees on how instances are going to handle users right to privacy. Let’s walk through an example, a user posts a picture on their feed, the post is then distributed to all the instances connected to the Fediverse however the user realizes they made a mistake and chooses to delete the picture, in this scenario, a request to delete the picture will be sent to all instances but there are no guarantees that they are going to actually fulfill this request. This issue is not only about instances acting in bad faith, there might be legitimate instances with different policies regarding content deletion requests. In short, there are no guarantees on how instances and users in different instances will interact with the content you post.

Lastly, it’s not clear what the incentives will be for existing social networks to join the Fediverse. Networks in the Fediverse distribute all the content being posted on them, meaning that users will be able to access content that was previously only accessible on their own app/website on a completely different surface, over which the network has no control over. This creates several monetization issues, for example, websites won’t be able to display ads when you consume content shared by them on a different social network.

Keep an eye out

Regardless if you want to create an account in a Fediverse instance or if you use a social network that will add support for it, I recommend keeping an eye out for this space. It’s not frequent that we have an experience of a distributed and federated group of social networks at this scale and, given the current growth trend, it might just be the beginning of a new standard for how social networks operate on the web.

Liked reading this post? Follow me on @ltmenezes on Twitter to keep yourself up-to-date with my latest articles.

Top comments (0)