# Nostr Relay Infrastructure Guide

Personal and self-hosted relay solutions for sovereign Nostr usage.

---

## Table of Contents
1. [Overview](#overview)
2. [Personal Relay Solutions](#personal-relay-solutions)
   - [Haven](#haven) - Multi-relay system
   - [Citrine](#citrine) - Mobile relay app
3. [Public Relay Strategies](#public-relay-strategies)
4. [Relay Comparison](#relay-comparison)

---

## Overview

While Nostr is protocol-based and "dumb relays" are the norm, **personal relays** offer sovereignty, backup, and advanced features for power users.

### Why Personal Relays?
- **Data sovereignty** - Your notes, your server
- **Backup** - Never lose your content
- **Privacy** - Private notes stay on your relay
- **Performance** - Faster access to your own data
- **Advanced features** - Web of trust, filtering, media hosting

---

## Personal Relay Solutions

### Haven

**GitHub:** [bitvora/haven](https://github.com/bitvora/haven)  
**Tagline:** "High Availability Vault for Events on Nostr"

**What it is:**
Haven is the most comprehensive personal relay solution. It's essentially **4 relays + a media server** in one deployment.

**The Four Relays:**

| Relay Type | Purpose | Access |
|------------|---------|--------|
| **Private Relay** | Drafts, eCash, sensitive notes | Owner only (Auth protected) |
| **Chat Relay** | DMs and group chats | Web of Trust only (Auth protected) |
| **Inbox Relay** | Zaps, reactions, mentions | Writes: anyone tagging owner. Reads: anyone pulling owner's tags |
| **Outbox Relay** | Owner's public notes | Owner writes, anyone reads. Blasts to other relays |

**Key Features:**
- 🔐 **Web of Trust** - Spam protection via WoT
- 🗂️ **Access Control** - Whitelist/blacklist npubs
- 📥 **Inbox Pull** - Auto-imports notes where you're tagged
- 📤 **Blastr** - Auto-broadcasts to other relays
- 💾 **Import/Export** - JSONL backup/restore
- 🖼️ **Blossom Media Server** - Built-in image/video hosting
- ☁️ **Cloud Backups** - Automatic encrypted backups

**Use Case:**
Best for power users who want complete control and advanced features. Runs as a server (Docker, VPS, or home server).

**Deployment:**
- Docker container
- Self-hosted on VPS or home server
- Cloud backup integration (S3 compatible)

---

### Citrine

**GitHub:** [greenart7c3/Citrine](https://github.com/greenart7c3/Citrine)  
**Tagline:** "A Nostr relay in your phone"

**What it is:**
Citrine turns your Android phone into a personal Nostr relay. No server needed - your phone *is* the relay.

**Current Features:**
- 📤📥 **Export/Import** database (full backup)
- 👤 **Account-only export** - Just your events
- ⚙️ **Relay management** - Port config, icon, user settings, start/stop
- 📡 **Broadcast** - Auto-publishes events when back online
- 🔌 **Content resolvers** - Plugin system

**How it works:**
Any Nostr client that supports Android can connect to Citrine as a relay. The relay runs locally on your phone and stores events in a local database.

**Use Case:**
Perfect for mobile-first users who want:
- Offline capability (relay is local)
- Easy backup/restore
- No server maintenance
- Portability - your relay travels with you

**Platform:**
- Android only (via APK or Zapstore)
- Open source (Kotlin)

---

## Public Relay Strategies

Even with a personal relay, you need public relays for:
- **Discovery** - Being found by others
- **Redundancy** - If your relay goes down
- **Network effects** - Reaching wider audiences

### Recommended Setup
1. **Personal relay** (Haven/Citrine) - Primary storage
2. **2-3 public relays** - For discovery and redundancy
3. **Outbox blasting** (Haven) - Auto-sync to public relays

### Popular Public Relays
- `wss://relay.damus.io` - Most popular
- `wss://relay.nostr.band` - Good for search
- `wss://nos.lol` - General purpose
- `wss://relay.primal.net` - Primal's relay

---

## Relay Comparison

| Feature | Haven | Citrine | Public Relay |
|---------|-------|---------|--------------|
| **Platform** | Server/VPS | Android | Cloud |
| **Setup** | Docker/VPS | APK install | None |
| **Privacy** | Maximum (4 relay types) | High (local) | Low (public) |
| **WoT/Filtering** | ✅ Yes | ❌ No | ❌ No |
| **Media Server** | ✅ Blossom | ❌ No | Varies |
| **Backup** | ✅ Cloud + JSONL | ✅ Export | ❌ No |
| **Mobile** | ❌ No | ✅ Yes | ✅ Yes |
| **Multi-device** | ✅ Yes | ❌ No | ✅ Yes |
| **Best for** | Power users | Mobile users | Everyone |

---

## Advanced: Haven Web of Trust

Haven's WoT system protects your inbox and chat relays:

**How it works:**
1. Define trust depth (e.g., 2 hops from follows)
2. Haven calculates WoT from your follow list
3. Only WoT members can DM you or write to inbox
4. Automatically updates as you follow/unfollow

**Benefits:**
- Eliminates DM spam
- Protects inbox relay from spam
- Dynamic - no manual whitelist maintenance

---

## Quick Start Recommendations

### Mobile-First User
→ **Citrine** on Android + 2 public relays

### Power User / Content Creator
→ **Haven** (4-in-1 relay) + Blossom media server

### Minimalist
→ 3-4 public relays (no personal relay)

### Privacy Focused
→ **Haven** private relay + minimal public outbox blasting

---

*Last updated: 2026-02-19*
