Mastodon
Decentralized, open-source social network server based on the ActivityPub protocol.
Why consider Mastodon?
Mastodon is a federated social networking platform that operates as a decentralized alternative to Twitter/X. It allows individuals and communities to run independent servers while interconnecting seamlessly.
Learn Mastodon by building
Practical setup notes, real use cases, and copy-ready examples in one focused guide.
In this guide10 sections
What is Mastodon?
Mastodon is an open-source, decentralized social networking platform built on the W3C ActivityPub protocol. It operates as a direct, federated alternative to centralized microblogging platforms like Twitter and X. Instead of a single company hosting all user data and algorithms, Mastodon consists of thousands of independently operated servers that seamlessly federate with one another.
Users on one Mastodon server can follow, reply, boost, and message users on any other federated server across the Fediverse with zero vendor lock-in.
Who Is It For?
- Communities & Organizations: Hosting private or themed social networks tailored to specific interests, languages, or geographic regions.
- Journalists & Independent Publishers: Broadcasting articles, updates, and analysis without fear of platform-wide algorithmic suppression.
- Privacy-Conscious Users: Engaging in social media free from commercial ad tracking, data harvesting, and invasive profiling algorithms.
Key Features
- Federated ActivityPub protocol allowing cross-server following, interactions, and content sharing.
- Granular post privacy settings: Public, Unlisted, Followers-only, and Direct mention messages.
- Advanced content warnings (CW), customizable filtering, and comprehensive anti-harassment tools.
- Open REST API supporting rich mobile and desktop client applications across iOS, Android, and web.
- Full server-level moderation tools including domain blocking, keyword filtering, and automated report queues.
Deployment with Docker Compose
Running a Mastodon instance requires PostgreSQL, Redis, and a background worker queue.
version: '3'services: db: image: postgres:15-alpine restart: unless-stopped volumes: - ./postgres:/var/lib/postgresql/data environment: - POSTGRES_DB=mastodon_production - POSTGRES_USER=mastodon - POSTGRES_PASSWORD=secure_mastodon_password redis: image: redis:7-alpine restart: unless-stopped volumes: - ./redis:/data web: image: ghcr.io/mastodon/mastodon:v4.7.0 restart: unless-stopped env_file: .env.production command: bundle exec puma -C config/puma.rb depends_on: - db - redis ports: - 3000:3000 streaming: image: ghcr.io/mastodon/mastodon:v4.7.0 restart: unless-stopped env_file: .env.production command: node ./streaming depends_on: - db - redis ports: - 4000:4000 sidekiq: image: ghcr.io/mastodon/mastodon:v4.7.0 restart: unless-stopped env_file: .env.production command: bundle exec sidekiq depends_on: - db - redisGenerate your secret keys and configuration:
docker compose run --rm web bundle exec rake mastodon:setupStart the instance:
docker compose up -dConfigure your reverse proxy (Nginx or Caddy) with SSL certificates to point to ports 3000 (web) and 4000 (streaming).
Practical Use Cases
1. Community Interest Network
A tech collective establishes an instance dedicated to open-source software where members post project updates and collaborate while remaining connected to the global Fediverse.
2. Organization Public Broadcast Channel
A non-profit organization maintains its own official verified Mastodon instance to publish announcements and press releases directly to followers worldwide.
3. Niche Regional Discussion Forum
A regional city group launches a local Mastodon server for neighbors and municipal representatives to discuss civic issues with local moderation rules.
Troubleshooting and Limitations
- Media Storage and CDN: As your server federates with thousands of remote instances, downloaded media attachments can rapidly consume storage; configure an S3 bucket with lifecycle cleanup rules for remote media cache.
- Sidekiq Queue Backlog: On active instances, ensure sufficient Sidekiq worker concurrency to prevent delay in delivering outgoing federated messages.
Official Resources
- Official Website: https://joinmastodon.org
- GitHub Repository: https://github.com/mastodon/mastodon
- Documentation: https://docs.joinmastodon.org
Related tools
More options with a similar category or technology profile.
MyPaint
Nimble, distraction-free, and easy graphic application for digital painters.
Pencil2D
Easy, intuitive traditional hand-drawn 2D animation software across raster and vector.
Hydrogen
Advanced open-source drum machine and pattern-based step sequencer for audio production.
Pure Data
Open source visual programming language for multimedia, audio, and physical computing.