Bluesky (AT Protocol) Self-Host Guide: Complete Setup and Configuration

Table of Contents

What is Bluesky AT Protocol?

Bluesky AT Protocol is an open-source, decentralized social networking protocol that enables federated microblogging. It's designed to give users control over their social media experience while maintaining interoperability across different platforms and servers.

Bluesky AT Protocol Interface

Features of Bluesky AT Protocol

Decentralized Architecture

Unlike traditional social media platforms, AT Protocol allows users to run their own servers (called Personal Data Servers or PDSs) while still being able to interact with the broader network.

Personal Data Sovereignty

  • Complete ownership of your data
  • Portable identity across servers
  • Control over content moderation policies
  • Custom algorithms and feeds

Federation and Interoperability

  • Connect with users across different AT Protocol servers
  • Maintain social connections when switching servers
  • Cross-platform compatibility

Advanced Content Moderation

  • Customizable moderation policies
  • Community-driven content filtering
  • Personal blocklists and filters
  • Transparent moderation decisions

Why Self Host Bluesky AT Protocol?

Self-hosting gives you complete control over your social media experience and data.

Benefits of Self-Hosting AT Protocol

  • Complete Data Ownership: Your posts, follows, and interactions belong to you
  • Custom Moderation: Set your own content policies and moderation rules
  • Performance Control: Optimize server performance for your needs
  • Privacy Protection: No third-party data mining or advertising tracking
  • Algorithmic Freedom: Create custom feeds and discovery algorithms
  • Censorship Resistance: Immune to platform-wide bans or policy changes

System Requirements

Minimum Requirements

  • CPU: 2 cores
  • RAM: 4GB
  • Storage: 50GB SSD
  • Network: Stable internet connection
  • OS: Linux (Ubuntu 20.04+ recommended)
  • Docker and Docker Compose
  • CPU: 4+ cores
  • RAM: 8GB+
  • Storage: 200GB+ SSD
  • Network: High-speed internet with low latency
  • Dedicated IP address
  • SSL certificate

Installation Guide

  1. Clone the AT Protocol repository:
git clone https://github.com/bluesky-social/atproto.git
cd atproto
  1. Set up environment variables:
cp .env.example .env
# Edit .env with your configuration
  1. Start the services:
docker-compose up -d

Manual Installation

  1. Install dependencies:
# Install Node.js 18+
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs

# Install PostgreSQL
sudo apt-get install -y postgresql postgresql-contrib
  1. Clone and build:
git clone https://github.com/bluesky-social/atproto.git
cd atproto
npm install
npm run build
  1. Configure database:
sudo -u postgres createdb bluesky
sudo -u postgres createuser bluesky
  1. Start the Personal Data Server:
npm run start:pds

Configuration

Environment Variables

# Server Configuration
PDS_HOSTNAME=your-domain.com
PDS_PORT=3000
PDS_DATA_DIRECTORY=/data/pds

# Database Configuration
PDS_DB_POSTGRES_URL=postgresql://bluesky:password@localhost:5432/bluesky

# Blob Storage
PDS_BLOB_UPLOAD_LIMIT=52428800
PDS_DID_PLC_URL=https://plc.directory

# Email Configuration (optional)
PDS_EMAIL_SMTP_URL=smtp://username:password@smtp.gmail.com:587
PDS_EMAIL_FROM_ADDRESS=noreply@your-domain.com

# Moderation
PDS_MODERATION_EMAIL=admin@your-domain.com

DNS and SSL Setup

  1. Configure DNS records:
A record: your-domain.com → your-server-ip
CNAME: *.your-domain.com → your-domain.com
  1. SSL certificate with Let's Encrypt:
sudo certbot --nginx -d your-domain.com -d *.your-domain.com

Reverse Proxy Configuration (Nginx)

server {
    listen 443 ssl http2;
    server_name your-domain.com;
    
    ssl_certificate /etc/letsencrypt/live/your-domain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/your-domain.com/privkey.pem;
    
    location / {
        proxy_pass http://localhost:3000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Backup and Maintenance

Regular Backup Strategy

#!/bin/bash
# Backup script for AT Protocol PDS

# Database backup
pg_dump bluesky > /backup/bluesky-$(date +%Y%m%d).sql

# Data directory backup
tar -czf /backup/pds-data-$(date +%Y%m%d).tar.gz /data/pds/

# Cleanup old backups (keep 30 days)
find /backup -name "*.sql" -mtime +30 -delete
find /backup -name "*.tar.gz" -mtime +30 -delete

Update Process

  1. Backup your data
  2. Pull latest changes:
git pull origin main
npm install
npm run build
  1. Restart services:
docker-compose down
docker-compose up -d

Monitoring

Set up monitoring for:

  • Server uptime and performance
  • Database health
  • Storage usage
  • Network connectivity
  • Federation status

Troubleshooting

Common Issues

Federation Problems

  • Check DNS configuration
  • Verify SSL certificate
  • Test connectivity with other AT Protocol servers

Database Connection Errors

# Check PostgreSQL status
sudo systemctl status postgresql

# Reset database connection
sudo systemctl restart postgresql

Storage Issues

# Check disk usage
df -h

# Clean up old data (be careful!)
docker system prune -a

Performance Issues

  • Monitor resource usage with htop
  • Check database performance
  • Optimize PostgreSQL configuration
  • Consider increasing server resources

Log Analysis

# Check PDS logs
docker-compose logs pds

# Monitor real-time logs
tail -f /var/log/pds/pds.log

FAQ

How is AT Protocol different from Mastodon?

AT Protocol focuses on personal data ownership and portability, while Mastodon uses ActivityPub for federation. AT Protocol allows you to move your identity and data between servers more easily.

Can I migrate from Twitter/X to my AT Protocol server?

Currently, there are limited migration tools. You can export your Twitter data and manually recreate your network, but automated migration is still in development.

What's the difference between PDS and Relay?

  • PDS (Personal Data Server): Stores your personal data and posts
  • Relay: Aggregates data from multiple PDSs for discovery and search
  • App View: Provides the user interface and timeline algorithms

How do I handle content moderation?

AT Protocol allows you to:

  • Set server-wide moderation policies
  • Use community moderation services
  • Create custom content filters
  • Subscribe to third-party moderation lists

Is self-hosting expensive?

Basic hosting can cost $10-50/month depending on usage. Costs increase with:

  • Number of users
  • Storage requirements
  • Bandwidth usage
  • Server resources

Can I use my own domain?

Yes! AT Protocol supports custom domains for user handles. Users can have handles like @username.yourdomain.com.

How do I backup my AT Protocol data?

Regular backups should include:

  • PostgreSQL database
  • Blob storage (images, videos)
  • Configuration files
  • SSL certificates

What happens if my server goes down?

  • Your data remains safe if you have backups
  • You can restore to a new server
  • Your identity can be recovered using your cryptographic keys
  • Followers will reconnect when you're back online