Skip to content

Why Fedify?

Developing a federated application using ActivityPub can be complex and time-consuming. While the ActivityPub specification provides a solid foundation for decentralized social networking, implementing it from scratch presents significant challenges. Fedify alleviates these pain points, allowing developers to focus on their application's unique features rather than protocol intricacies.

Common pain points when implementing ActivityPub from scratch

Without a framework like Fedify, developers face numerous challenges:

Technical complexity

Steep learning curve
The ActivityPub family of specifications is extensive, covering hundreds of pages of technical documentation
JSON-LD complexities
Dealing with context resolution, expansion, and compaction manually is error-prone
Cryptographic hurdles
Implementing HTTP Signatures, key management, and signature verification correctly requires specialized knowledge

Infrastructure requirements

Message delivery reliability
Building retry logic, exponential backoff, and failure handling from scratch
Performance bottlenecks
Naive message delivery implementations can cause timeouts, high memory usage, and server crashes
Scalability issues
Direct delivery to thousands of followers can overload your application servers

Federation challenges

Incompatible implementations
Different ActivityPub servers interpret the specifications differently, requiring implementation-specific adaptations
Evolving ecosystem
Federation standards continue to evolve with community extensions and conventions
Security vulnerabilities
Potential for SSRF attacks, signature forgery, and other security issues without careful implementation

Development overhead

No standardized tools
Developers must build their own debugging and testing utilities for federation
Reinventing the wheel
Common patterns like WebFinger resolution or follower management must be reimplemented
Maintenance burden
Keeping up with security patches and protocol changes across the fediverse

Protocol complexity and data handling

The ActivityPub family of W3C recommendations—including ActivityStreams 2.0, Activity Vocabulary, and ActivityPub—is extensive and challenging to implement correctly. Messages encoded in JSON-LD using the ActivityStreams vocabulary require careful attention to contexts, IRI resolution, and object serialization.

Fedify provides:

  • A higher-level abstraction over these protocols
  • Type-safe TypeScript classes for all standard ActivityStreams types
  • Utilities for creation, manipulation, and validation of ActivityPub objects

Federation infrastructure

Building an ActivityPub server requires implementing several interconnected systems:

Message processing and delivery

Fedify offers a comprehensive solution for managing ActivityPub's inbox/outbox model:

  • Robust inbox handlers with activity de-duplication
  • Configurable message queues with reliable retry mechanisms

Scalability with fan-out architecture

One of the most challenging aspects of ActivityPub implementation is efficiently delivering activities to potentially thousands of recipients. Fedify's two-stage delivery process addresses this:

  1. For activities with many recipients, a single consolidated message containing the activity and all recipient information is created
  2. A background worker processes this message and re-enqueues individual delivery tasks
  3. Each delivery has independent retry logic and error handling

Two-stage delivery process

Create post

Create activity

1. Single consolidated message

2. Process message

3. Create individual delivery tasks

Deliver to recipient 1

Deliver to recipient 2

Deliver to recipient N

Failed? Retry with backoff

Failed? Retry with backoff

Failed? Retry with backoff

Client

Application

Fedify

Message Queue

Fan-out Worker

Delivery Queue

Remote server 1

Remote server 2

Remote server N

fv5g7

Benefits include:

  • Faster API response times for improved UX
  • Reduced memory consumption through payload deduplication
  • Configurable fan-out strategies with "auto", "skip", or "force" options

Security and interoperability

Security is paramount in federation, while interoperability across diverse implementations presents ongoing challenges.

Fedify provides:

Technology agnosticism

Fedify doesn't force you to use specific technologies, giving you the freedom to build with your preferred tools.

Framework flexibility

Works with virtually any JavaScript/TypeScript web framework:

… and many more!

Database independence

  • Use any SQL or NoSQL database (PostgreSQL, MySQL, MongoDB, etc.)
  • Use any ORM (Prisma, TypeORM, Drizzle ORM, etc.)
  • Fedify only requires a key-value interface for its internal caching

Developer experience

Fedify significantly improves the developer experience through:

TypeScript-native design

Comprehensive type definitions with intelligent auto-completion

Observability

Built-in OpenTelemetry support for tracing and monitoring

CLI toolchain

Tools for testing and debugging federation, including:

Success stories

Several notable projects have chosen Fedify to implement ActivityPub federation, demonstrating its effectiveness in real-world applications:

Ghost: Federation for a major publishing platform

Ghost, a leading open-source publishing platform used by thousands of journalists, creators, and companies worldwide, chose Fedify for their ActivityPub implementation:

  • Built a separate ActivityPub service with Fedify rather than integrating directly into Ghost core
  • Leveraged Fedify to quickly implement federation while focusing on delivering value to their large user base
  • Contributes back features and bug fixes to the Fedify ecosystem

ActivityPub sits on top of a lot more standards than you might think, so it's sometimes necessary to juggle a lot of complex standards to get the full picture… This is the main reason I created Fedify.

We can definitely attest to the problems that Fedify is working hard to solve, because even in just a few weeks of early prototyping we were running into the issues described above right away.

—From Alright, let's Fedify

Hollo: Single-user microblogging

Hollo is a federated microblogging platform specifically designed for single users, created by the original developer of Fedify:

  • Initially faced challenges implementing ActivityPub from scratch, which inspired the creation of Fedify
  • Now powered by Fedify, offering features like Mastodon-compatible API, CommonMark support, and Misskey-style quotes
  • Serves as both a showcase and test case for Fedify's capabilities

Implementing ActivityPub from the ground up was quite painful for me… I realized that I was already building a sloppy quasi-framework for ActivityPub. I thought, “No way, I'm going to build a proper ActivityPub framework,” and Fedify is the result.

—Hong Minhee, creator of Fedify and Hollo, in Alright, let's Fedify

Hackers' Pub: Community-driven federation

Hackers' Pub is an open-source community project building federation capabilities with Fedify:

  • Demonstrates how community-driven projects can leverage Fedify to implement ActivityPub
  • Showcases the accessibility of federation technology to developers beyond large organizations
  • Part of the growing ecosystem of developers adopting Fedify to join the fediverse

Conclusion

While building an ActivityPub server from scratch can be educational, it's a complex undertaking that can slow development and lead to interoperability or security issues.

Fedify abstracts away these complexities, providing a robust, secure, and developer-friendly framework. By handling the low-level details of ActivityPub, WebFinger, authentication, and more, Fedify empowers you to:

Develop faster
Focus on your application's core functionality and user experience
Reduce errors
Leverage type safety and battle-tested components
Ensure interoperability
Work seamlessly with the diverse fediverse ecosystem
Improve security
Rely on built-in security mechanisms and best practices
Stay flexible
Integrate with your technology stack of choice

If you're looking to build a federated application on the ActivityPub protocol, Fedify offers a powerful and efficient path to success.