fedimg: ActivityPub server written in NodeJS
Table of contents
Background
I started the project just because I wanted to build something again. After looking at some projects which I use daily, I realized I wanted to build an ActivityPub server.
I go into detail in the article but this spec has been a fascinating concept ever since I learned about its existence back in 2022.
I believe in “learning by building stuff” ideology and as such, this project will help me understand a lot of concepts including ActivityPub, building sophisticated social media experiences and so on.
Inspiration
I have been following activity around ActivityPub since 2022. It was also around the time when I migrated from Twitter to Mastodon.
I would highly recommend checking out Mastodon and ActivityPub. It could truly be the next-gen social media platform, if given a chance.
There are several projects which implement ActivityPub but the way they currently work is, each project manages one type of content - for example:
Mastodon is a microblogging platform.
Lemmy & Kbin are link aggregator platforms similar to Reddit.
PeerTube is a video sharing platform.
Unlike traditional social media platforms, these software have 2 fascinating features:
- Allow following users across different ActivityPub servers (collectively called the #Fediverse).
- Users are allowed to migrate to different server hosted at a different domain within the same project. For example, a user from
mastodonserver1.com
can migrate to another Mastodon server hosted attechstuffonly.com
.
Goals
I aim to accomplish the following goals for this project:
Multiple content types are supported - text, images and short videos (sometime in the near future)
“My Feed” section that is tuned according to your followers & following collections. I need to research this a lot before I begin!
License
I wanted to go with MIT license just like I do with all my personal projects but after some consideration, I decided to go with AGPLv3 for this project. It is identical to that of Mastodon. The rationale for this choice stems from the fact that I studied Mastodon’s code for many days for implementation purposes.
Progress
This project lives on GitHub here. It is bare-bones as of writing as I have prioritized building necessary features into the project.
This is actively under development and things will change (and break) often.
I have recently returned to the project from a 7 month hiatus. This personal time has allowed me to think clearly and I am happy to report it’s been a good decision. The project lives!!! :)
What works:
User registration & login
Follow a remote user
Accept remote user’s Follow request (can’t Reject though!)
Profile page with option to upload profile picture and set “display name”
What’s missing:
There are many things missing in my implementation but here’s an overview of what I think is important at the moment.
Landing page
UI is terrible and in some cases, it doesn’t exist yet.
Reject a remote user’s follow - UI & backend
Create Activity management
Undo activity management
Implement
/actor/outbox
endpointSevere lack of documentation for project
Challenges
It was hell trying to implement HTTP Signatures. This was mandatory as all AP severs won’t accept certain requests without it. I remember spending several weeks trying different things to get the expected output.
I ran into trouble setting up generating public & private keys for registered users.
Staying motivated was a HUGE problem. I always got cornered with imposter syndrome when something fails.
The “do it right the first time” entity in my head was difficult to negotiate. We currently have several
FIXME
comments throughout the code because that’s the ONLY way I was able to move forward when building something this huge.
Conclusion
I am excited about this project and the learning potential I gain from this experiment is immense. Consider following my Mastodon account here or following my project’s hashtag here for more updates.
I plan on making this a series provided I have something new to report!
Bye for now :)
Subscribe to my newsletter
Read articles from Surya Teja Karra directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by