Comment on Ditch the DIY Drama: Why Use Fedify Instead of Building ActivityPub from Scratch?
arotrios@lemmy.world 1 week ago
Holy wall of text, Batman!
Comment on Ditch the DIY Drama: Why Use Fedify Instead of Building ActivityPub from Scratch?
arotrios@lemmy.world 1 week ago
Holy wall of text, Batman!
mutual_ayed@sh.itjust.works 1 week ago
The Allure of the Fediverse and the Challenges of ActivityPub Implementation
The fediverse—a decentralized social web powered by protocols like ActivityPub—is an exciting space to explore. If you’re considering building the next great federated app, connected to platforms like Mastodon, Lemmy, Pixelfed, and more, you might be tempted to implement ActivityPub from scratch. While this approach offers total control, it’s a daunting task due to the complexity of the standards involved.
The Challenge: Data Modeling with ActivityStreams & JSON-LD
At its core, ActivityPub relies on ActivityStreams 2.0 vocabulary and JSON-LD syntax. This combination introduces significant complexity:
Understanding ActivityStreams Vocabulary:
You need to model actions and objects (e.g., posts as
Note
orArticle
, profiles asPerson
orOrganization
, and actions likeCreate
,Follow
,Like
,Announce
) using the precise terms defined in the specification.JSON-LD Specifics:
JSON-LD has unique rules that complicate direct JSON manipulation:
Fedify: Simplifying ActivityPub Development
Fedify, a TypeScript framework, abstracts the complexity of ActivityPub development. It handles the heavy lifting, allowing you to focus on what makes your app unique.
Example Code with Fedify
Fedify simplifies federation logic:
Web Interface and Logs
When running your app:
Web interface available at: http://localhost:8000/
Logs example:
.lhr.life/r/2 | ╰─────────────────┴───────────────────────────────────────╯
Conclusion
Building a federated app with ActivityPub is challenging, but tools like Fedify make the process manageable. By abstracting away the complexity of JSON-LD and ActivityStreams, Fedify allows developers to focus on creating innovative applications for the fediverse.