···11# Cocoon
2233> [!WARNING]
44-You should not use this PDS. You should not rely on this code as a reference for a PDS implementation. You should not trust this code. Using this PDS implementation may result in data loss, corruption, etc.
44+I migrated and have been running my main account on this PDS for months now without issue, however, I am still not responsible if things go awry, particularly during account migration. Please use caution.
5566Cocoon is a PDS implementation in Go. It is highly experimental, and is not ready for any production use.
77+88+## Quick Start with Docker Compose
99+1010+### Prerequisites
1111+1212+- Docker and Docker Compose installed
1313+- A domain name pointing to your server (for automatic HTTPS)
1414+- Ports 80 and 443 open in i.e. UFW
1515+1616+### Installation
1717+1818+1. **Clone the repository**
1919+ ```bash
2020+ git clone https://github.com/haileyok/cocoon.git
2121+ cd cocoon
2222+ ```
2323+2424+2. **Create your configuration file**
2525+ ```bash
2626+ cp .env.example .env
2727+ ```
2828+2929+3. **Edit `.env` with your settings**
3030+3131+ Required settings:
3232+ ```bash
3333+ COCOON_DID="did:web:your-domain.com"
3434+ COCOON_HOSTNAME="your-domain.com"
3535+ COCOON_CONTACT_EMAIL="you@example.com"
3636+ COCOON_RELAYS="https://bsky.network"
3737+3838+ # Generate with: openssl rand -hex 16
3939+ COCOON_ADMIN_PASSWORD="your-secure-password"
4040+4141+ # Generate with: openssl rand -hex 32
4242+ COCOON_SESSION_SECRET="your-session-secret"
4343+ ```
4444+4545+4. **Start the services**
4646+ ```bash
4747+ # Pull pre-built image from GitHub Container Registry
4848+ docker-compose pull
4949+ docker-compose up -d
5050+ ```
5151+5252+ Or build locally:
5353+ ```bash
5454+ docker-compose build
5555+ docker-compose up -d
5656+ ```
5757+5858+5. **Get your invite code**
5959+6060+ On first run, an invite code is automatically created. View it with:
6161+ ```bash
6262+ docker-compose logs create-invite
6363+ ```
6464+6565+ Or check the saved file:
6666+ ```bash
6767+ cat keys/initial-invite-code.txt
6868+ ```
6969+7070+ **IMPORTANT**: Save this invite code! You'll need it to create your first account.
7171+7272+6. **Monitor the services**
7373+ ```bash
7474+ docker-compose logs -f
7575+ ```
7676+7777+### What Gets Set Up
7878+7979+The Docker Compose setup includes:
8080+8181+- **init-keys**: Automatically generates cryptographic keys (rotation key and JWK) on first run
8282+- **cocoon**: The main PDS service running on port 8080
8383+- **create-invite**: Automatically creates an initial invite code after Cocoon starts (first run only)
8484+- **caddy**: Reverse proxy with automatic HTTPS via Let's Encrypt
8585+8686+### Data Persistence
8787+8888+The following directories will be created automatically:
8989+9090+- `./keys/` - Cryptographic keys (generated automatically)
9191+ - `rotation.key` - PDS rotation key
9292+ - `jwk.key` - JWK private key
9393+ - `initial-invite-code.txt` - Your first invite code (first run only)
9494+- `./data/` - SQLite database and blockstore
9595+- Docker volumes for Caddy configuration and certificates
9696+9797+### Optional Configuration
9898+9999+#### SMTP Email Settings
100100+```bash
101101+COCOON_SMTP_USER="your-smtp-username"
102102+COCOON_SMTP_PASS="your-smtp-password"
103103+COCOON_SMTP_HOST="smtp.example.com"
104104+COCOON_SMTP_PORT="587"
105105+COCOON_SMTP_EMAIL="noreply@example.com"
106106+COCOON_SMTP_NAME="Cocoon PDS"
107107+```
108108+109109+#### S3 Storage
110110+```bash
111111+COCOON_S3_BACKUPS_ENABLED=true
112112+COCOON_S3_BLOBSTORE_ENABLED=true
113113+COCOON_S3_REGION="us-east-1"
114114+COCOON_S3_BUCKET="your-bucket"
115115+COCOON_S3_ENDPOINT="https://s3.amazonaws.com"
116116+COCOON_S3_ACCESS_KEY="your-access-key"
117117+COCOON_S3_SECRET_KEY="your-secret-key"
118118+```
119119+120120+### Management Commands
121121+122122+Create an invite code:
123123+```bash
124124+docker exec cocoon-pds /cocoon create-invite-code --uses 1
125125+```
126126+127127+Reset a user's password:
128128+```bash
129129+docker exec cocoon-pds /cocoon reset-password --did "did:plc:xxx"
130130+```
131131+132132+### Updating
133133+134134+```bash
135135+docker-compose pull
136136+docker-compose up -d
137137+```
71388139## Implemented Endpoints
9140