ActivityPub - The Protocol Decentralised Social Networking
Tags: fediverse, socialmedia, web3, webdev
Published: 2023-10-25 11:27:54

This is Day 7 of my [100-day challenge to level up](https://github.com/sidgujrathi/100DaysOfScaleUp/), and today, I have explored the world of ActivityPub. I'm on a mission to explain this cool protocol and show you how it works. If you're curious about ActivityPub, you're in the right place. Let's jump right in!

## The Fediverse

![ActivityPub](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a8lctx5vld89klpgi31a.png)

Ever heard of the word 'Fediverse'? It might sound a bit complex, but it's really not. Think of it as a big playground where all the social media platforms get together and play nicely with each other.

Now, you might be wondering, 'Why are we talking about the Fediverse and how does this relate to ActivityPub?' Well, for now just remember that ActivityPub is the magic that makes this whole 'Fediverse' idea possible.

Lets understand all the parts in this play one by one.

## Social Media - An Universe in itself

Fast forward to 2023, and our social media platforms have become like self-contained universes. They're bustling with activity, constantly evolving, and have developed their own unique cultures, inhabitants, rules, and characteristics.


![Social Media Universe](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9ov69puvz042m93apr5c.png)

From a technical perspective, you can think of every user as an active participant in the system, effectively serving as clients. In simpler terms, their devices, be it phones, computers, or other gadgets, act as clients.

Now, when users engage in discussions, make posts, comment, or hit the like button, all these actions become activities that flow to the central server. These activities are then accessible and viewable by other users.

## The Need

Alright, picture this: You're tweeting away on Twitter, while your two friends are hanging out on Facebook and Threads. Why, you ask? Well, they've got some beef with Twitter being called "X" for some reason! 😅 And you? You'd rather not jump into Mark's universe.

Here's the kicker: Since you're not on their turf, you can't chat with your buddies, see their posts, drop comments, or toss them some likes – even though you really want to.

You can't, why? your Twitter universe has its own unique cultures, inhabitants, rules, and characteristics and language as well and there is no way you can get or pass information to other universes.

## Enters ActivityPub 💫 🤝

![Fediverse](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a8lctx5vld89klpgi31a.png)

Imagine ActivityPub as a kind of super-smart internet postman or a bridge builder. It's like the service that ensures different websites and apps can talk to each other, almost like sending emails or letters.

This is basically the "go-to" way for social networks to mingle and for different platforms to shake hands. In simpler terms, if Twitter, Facebook, Threads, and others decided to hop on the ActivityPub train, all your worries about connecting with friends on various platforms would disappear.

ActivityPub is like a cosmic portal where these online worlds can chat with each other and swap the info they need. It's like the grand meeting point for the digital universe. 😄

And this whole setup called "_Fediverse_"! - The "federated universe" which is decentralised social network of independent servers that can connect and communicate with each other.

## Technical Jargon

Till this point I hope I clear idea around what Activity Pub is and it's purpose.

Now lets understand technically what it is?

ActivityPub is an open standard protocol by [w3 Org](https://www.w3.org/TR/activitypub/) that facilitates social networking and interaction between various platforms.

**Federated Servers:** ActivityPub relies on a network of federated servers. Each server represents a different platform or service.

**Activity Objects:** Everything you do online, from posting a cat meme to sharing your latest blog, is encapsulated as an "activity object." These objects carry information about your actions in JSON format.

**Followers and Actors:** You, as a user, are an "actor." You can follow other actors on different servers.

**Inbox and Outbox:** Servers have inboxes and outboxes where they receive and send activity objects. When you post something, your server sends your activity object to the followers' inboxes.

**Delivery via HTTP:** Servers communicate with each other through HTTP requests, the same protocol your browser uses.

Thanks to ActivityPub, activity objects can traverse server boundaries. Your posts become visible, likable, and comment-worthy to users on different platforms. It's like having a global conversation.

In essence, ActivityPub shatters the barriers between online platforms, enabling users to engage seamlessly across servers. It's akin to chatting with a friend on a diverse messaging platform. ActivityPub's underlying structure empowers federated social networking, making the digital universe a more interconnected place. So, the next time you share a post or follow someone on a different platform, remember that ActivityPub is orchestrating the technical magic behind the scenes. 🌐🔍