MCPSERV.CLUB
Mastodon

Mastodon

Self-Hosted

Decentralized, real‑time social networking

Active(100)
49.2kstars
0views
Updated 1 day ago
Mastodon screenshot 1
1 / 2

Overview

Discover what makes Mastodon powerful

Mastodon is a federated social‑networking platform built on the ActivityPub protocol, enabling seamless interoperation with any other ActivityPub‑compliant software. From a developer’s standpoint, it functions as a **Ruby on Rails** web service exposing a comprehensive REST API and an OAuth2 identity provider, while the real‑time streaming endpoint is powered by a Node.js server that pushes updates via WebSocket. The core data layer relies on PostgreSQL for relational persistence, complemented by Redis for caching and Sidekiq for background job processing. Front‑end logic is delivered through a React/Redux single‑page application that consumes the REST and streaming APIs, allowing developers to build custom UIs or integrate with third‑party services.

Backend

Streaming

Frontend

API Standards

Overview

Mastodon is a federated social‑networking platform built on the ActivityPub protocol, enabling seamless interoperation with any other ActivityPub‑compliant software. From a developer’s standpoint, it functions as a Ruby on Rails web service exposing a comprehensive REST API and an OAuth2 identity provider, while the real‑time streaming endpoint is powered by a Node.js server that pushes updates via WebSocket. The core data layer relies on PostgreSQL for relational persistence, complemented by Redis for caching and Sidekiq for background job processing. Front‑end logic is delivered through a React/Redux single‑page application that consumes the REST and streaming APIs, allowing developers to build custom UIs or integrate with third‑party services.

Technical Stack

  • Backend: Ruby on Rails (v7+), PostgreSQL, Redis, Sidekiq
  • Streaming: Node.js with the mastodon-streaming package, WebSocket/Server‑Sent Events
  • Frontend: React.js + Redux, SCSS, Webpack
  • API Standards: OAuth2 (RFC 6749), ActivityPub, JSON‑LD
  • Testing & CI: RSpec, Capybara, GitHub Actions (Ruby test workflow)
  • Containerization: Official Docker image on GitHub Packages, Helm charts for Kubernetes

Core Capabilities & APIs

  • OAuth2 Provider: Third‑party apps can request user scopes (read, write, follow) and obtain access tokens for authenticated API calls.
  • RESTful Endpoints: CRUD operations on accounts, statuses, media attachments, lists, and notifications. Supports pagination via max_id, since_id, and min_id.
  • Streaming API: Real‑time updates over WebSocket, with multiple channels (user, public, local, hashtag) and support for event types (update, delete, notification).
  • ActivityPub Integration: Full support for inbox/outbox handling, federated posting, and inter‑instance following.
  • Webhooks & Callbacks: Developers can register endpoints to receive push notifications for account events or moderation actions.
  • Extensibility: Plugins can hook into Rails callbacks, Sidekiq workers, or the streaming server. Custom emojis and theme overrides are exposed via configuration files.

Deployment & Infrastructure

Mastodon can run on any Linux host with Ruby, Node.js, PostgreSQL, and Redis installed. The official Docker image simplifies deployment; it includes pre‑configured volumes for media storage and configuration files. For larger installations, a Kubernetes deployment can scale the web, streaming, and Sidekiq pods independently. Horizontal Pod Autoscaling is supported via Redis metrics for queue depth. The architecture naturally separates concerns: the Rails API handles HTTP requests, Sidekiq processes background jobs (e.g., media transcoding), and the Node.js streaming server pushes events to clients. This modularity makes it straightforward to replace or upgrade components without downtime.

Integration & Extensibility

  • Plugin System: Developers can create Rails engines that mount routes, add database migrations, or inject middleware. The community maintains a catalog of plugins for moderation, analytics, and UI enhancements.
  • Custom Themes & CSS: The front‑end is fully themable; custom SCSS can be compiled into the asset pipeline.
  • API Hooks: Webhooks allow external services (e.g., Slack, Discord) to react to status updates or moderation actions.
  • Federation: By implementing ActivityPub, developers can extend Mastodon to support new content types (e.g., audio posts) or integrate with other federated services like PeerTube.

Developer Experience

The documentation is organized around a clear API reference, deployment guides, and developer tutorials. The GitHub repository follows semantic versioning; pull requests are reviewed by an active core team, and the issue tracker is well‑maintained. Community support is robust: a dedicated Discord channel, Zulip forum, and regular mailing lists provide rapid assistance. Configuration is largely driven by environment variables (DATABASE_URL, REDIS_URL, etc.), making CI/CD pipelines straightforward.

Use Cases

  1. Enterprise Private Social Network: Companies can host a Mastodon instance to facilitate internal communication while retaining full control over data and moderation policies.
  2. Community‑Driven Platforms: NGOs or hobby groups can deploy a federated instance to connect with other communities without vendor lock‑in.
  3. Educational Labs: Universities can use Mastodon to teach students about federated protocols, OAuth2, and full‑stack web development.
  4. Media & Content Creators: Artists can host a Mastodon instance to distribute multimedia posts with custom emojis and content warnings, leveraging the platform’s native media handling.

Advantages

  • Open Standards: ActivityPub and OAuth2 mean no proprietary APIs; developers can interoperate with any federated software.
  • Modular Architecture: Separate Rails, Node.js, and Sidekiq services allow targeted scaling and independent upgrades.
  • Strong Community & Governance: Active development, frequent releases, and transparent decision‑making reduce risk.
  • Zero Vendor Lock‑In: Self‑hosting guarantees ownership of data, privacy, and customization.
  • Rich API Surface: From simple status posting to complex federation logic, the APIs are comprehensive yet well‑documented.

For developers seeking a flexible, standards‑compliant social platform that can be tailored to niche audiences or integrated into larger ecosystems, Mastodon offers a robust, well‑

Open SourceReady to get started?

Join the community and start self-hosting Mastodon today

Weekly Views

Loading...
Support Us
Most Popular

Infrastructure Supporter

$5/month

Keep our servers running and help us maintain the best directory for developers

Repository Health

Loading health data...

Information

Category
apis-services
License
AGPL-3.0
Stars
49.2k
Technical Specs
Pricing
Open Source
Database
PostgreSQL
Docker
Official
Supported OS
LinuxDocker
Author
mastodon
mastodon
Last Updated
1 day ago