Skip to content

HiveTalk/swarm

Repository files navigation

Swarm: Nostr Team Relay Software

This relay software provides a Nostr relay to a team. This is a fork of the bitvora team-relay with modifications for Swarm.hivetalk.org

In the .env file, the team domain is used to reject non team members, only members in nostr.json are allowed for the specified team domain.

Additional features we added for production use:

  • Blossom
    • added read and write timeouts
    • prevent slow header attacks, max header size
    • max size upload
    • added /mirror endpoint to allow for syncing content with other relays
    • added /list endpoint to allow for listing content for a specific user
  • Relay Kinds - add support to limit kinds allowed, kinds specified in .env file
  • Frontend
    • added front page with relay and blossom information
    • added Bouquet integration, to enable media upload and syncing with other relays.
Screenshot 2025-08-16 at 6 32 59 PM
swarm-demo.mp4

Table of Contents

Prerequisites

  • A Linux-based operating system
  • Go installed on your system
  • A Webserver (like nginx) if blossom is enabled

Setting Environment Variables

  1. Create a .env file in the root directory of your project.

  2. Add your environment variables to the .env file. For example:

    RELAY_NAME="Swarm"
    RELAY_PUBKEY="8ad8f1f78c8e11966242e28a7ca15c936b23a999d5fb91bfe4e4472e2d6eaf55"
    RELAY_DESCRIPTION="Swarm Team Relay"
    
    DB_ENGINE="lmdb" # lmdb, badger, postgres
    DB_PATH="db/" # only needed for lmdb, badger
    

only needed for postgres

POSTGRES_USER=swarm
POSTGRES_PASSWORD=password
POSTGRES_DB=relay
POSTGRES_HOST=localhost
POSTGRES_PORT=5437

TEAM_DOMAIN="swarm.hivetalk.org"
BLOSSOM_ENABLED="true"
BLOSSOM_PATH="blossom/"
BLOSSOM_URL="http://localhost:3334"

```

Compiling the Application

  1. Clone the repository:

    git clone https://github.com/hivetalk/swarm.git
    cd swarm
  2. Build the application:

🚀 Quick Setup

1. Build the Bouquet Client

# Option A: Use the build script (recommended)
./build-bouquet.sh

# Option B: Manual build
cd clients/bouquet
pnpm install
pnpm run build:integration
cd ../..

2. Start the Go Server

# Build and run the Go server
go build -o swarm
./swarm

More details about Bouquet integration can be found in the BOUQUET_INTEGRATION.md file.

Running the Application as a Service

  1. Create a systemd service file:

    sudo nano /etc/systemd/system/team-relay.service
  2. Add the following content to the service file: (update paths and usernames as needed)

    [Unit]
    Description=Team Relay
    After=network.target
    
    [Service]
    ExecStart=/path/to/yourappname
    WorkingDirectory=/path/to/team-relay
    EnvironmentFile=/path/to/team-relay/.env
    Restart=always
    User=ubuntu
    
    [Install]
    WantedBy=multi-user.target
  3. Reload the systemd daemon:

    sudo systemctl daemon-reload
  4. Enable and start the service:

    sudo systemctl enable team-relay
    sudo systemctl start team-relay
  5. Check the status of the service:

    sudo systemctl status team-relay

Conclusion

Your team relay will be running at localhost:3334. Feel free to serve it with nginx or any other reverse proxy.

About

A Nostr Team Relay with additional controls for kinds, blossom media mirroring

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published