2025-05-11 21:07:07 -07:00
2025-05-11 22:33:14 -07:00
2025-05-13 08:30:30 -07:00
2025-03-01 22:53:36 -08:00
2025-03-01 22:53:36 -08:00

Nostr Poster

An automated content posting bot for Nostr networks. This tool allows you to schedule regular posting of images and videos to Nostr relays, supporting both NIP-94 and Blossom upload services.

Nostr Poster

Table of Contents

Priority Order

  1. Add Bot post Feed.
  2. Pull comments from posts and allow replying from app for each bot.

To-Do List

Bot Profile Management Enhancements

  • Better Key managment.

Relay Management Improvements

  • Include relay testing functionality
  • Add a "recommended relays" quick-add option
  • Include relay status indicators

Post Scheduling and Auto-Posting Testing

  • Implement a post history view
  • Add a "test now" button that triggers an immediate post attempt

Features

  • Media Management: Upload content to either NIP-94/96 compatible servers or Blossom storage servers
  • Scheduled Posting: Configure posting intervals for automated content sharing
  • Multiple Bot Support: Manage multiple bot identities, each with their own keypair
  • Keypair Management: Create new keypairs or import existing ones
  • Relay Configuration: Configure which relays to publish to for each bot
  • Profile Management: Set up and publish bot profiles (name, bio, avatar, etc.)
  • Content Archiving: Posted content gets archived to avoid duplicate posts
  • hybrid Posting mode: Makes both kind 1 and kind 20 posts as well as doing a hybrid post that makes a post of each type.

Installation

Requirements

  • Go 1.18 or higher
  • SQLite 3

Building from Source

  1. Clone the repository:
git clone https://github.com/yourusername/nostr-poster.git
cd nostr-poster
  1. Build the application:
make build
  1. Run the application:
make run

Configuration

The application can be configured via a YAML file or environment variables. By default, the config file is located at /config.yaml.

Example Configuration

app_name: "Nostr Poster"
server_port: 8080
log_level: "info"

bot:
  keys_file: "./keys.json"
  content_dir: "./content"
  archive_dir: "./archive"
  default_interval: 60  # minutes

db:
  path: "./nostr-poster.db"

media:
  default_service: "nip94"
  nip94:
    server_url: "https://nostr.build/api/upload/nostr"
    require_auth: true
  blossom:
    server_url: "https://blossom.example.com"

relays:
  - url: "wss://relay.damus.io"
    read: true
    write: true
  - url: "wss://nostr.mutinywallet.com"
    read: true
    write: true
  - url: "wss://relay.nostr.band"
    read: true
    write: true

Usage

Set up a Bot

  1. Navigate to the web interface at http://localhost:8765 (or your configured domain)
  2. Log in with your Nostr extension (NIP-07)
  3. Create a new bot by providing a name and optional keypair
  4. Configure the posting schedule, media upload service, and relays
  5. Add content to the bot's content directory
  6. Enable the bot to start automated posting

Manual Posting

You can also trigger a post manually through the web interface

Production Deployment

Nginx Configuration

To serve Nostr Poster behind an Nginx reverse proxy with HTTPS, use the following configuration:

server {
    listen 80;
    server_name your-domain.com;

    # Redirect HTTP to HTTPS
    location / {
        return 301 https://$host$request_uri;
    }
}

server {
    listen 443 ssl;
    server_name your-domain.com;

    # SSL configuration
    ssl_certificate /path/to/your/fullchain.pem;
    ssl_certificate_key /path/to/your/privkey.pem;

    # Security headers
    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
    add_header X-Content-Type-Options nosniff;
    add_header X-Frame-Options SAMEORIGIN;

    # Proxy settings
    location / {
        proxy_pass http://localhost:8765;
        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;

        # WebSocket support (for Nostr connections)
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

        # Timeout settings for long-lived connections
        proxy_read_timeout 86400;
        proxy_send_timeout 86400;
    }
}

Make sure to replace your-domain.com with your actual domain name and update the SSL certificate paths accordingly.

Systemd Service

To run Nostr Poster as a system service that starts automatically on boot, create a systemd service file:

  1. Create a systemd service file:
sudo nano /etc/systemd/system/nostr-poster.service
  1. Add the following content:
[Unit]
Description=Nostr Poster Bot Service
After=network.target

[Service]
Type=simple
User=nostr
WorkingDirectory=/path/to/nostr-poster
ExecStart=/path/to/nostr-poster/build/bin/nostr-poster
Restart=on-failure
RestartSec=5
StandardOutput=journal
StandardError=journal
Environment=GIN_MODE=release

# Hardening measures
PrivateTmp=true
ProtectSystem=full
NoNewPrivileges=true
ProtectHome=true

[Install]
WantedBy=multi-user.target

Replace /path/to/nostr-poster with the actual path to your installation, and nostr with the user you want to run the service as.

  1. Enable and start the service:
sudo systemctl daemon-reload
sudo systemctl enable nostr-poster
sudo systemctl start nostr-poster
  1. Check the status of the service:
sudo systemctl status nostr-poster
  1. View logs:
sudo journalctl -u nostr-poster -f

NIPs Supported

  • NIP-01: Basic protocol flow
  • NIP-07: Browser extension authentication
  • NIP-55: Android signer application (soon TM)
  • NIP-94: File metadata
  • NIP-96: HTTP file storage
  • NIP-98: HTTP authentication

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Description
Nostr bot that posts sit to nostr
Readme 48 MiB
Languages
Go 54.9%
JavaScript 28.7%
HTML 13.9%
CSS 2%
Makefile 0.5%