planetary-social / cleanstr

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Node.js CI codecov

Cleanster - Nostr Content Moderation with OpenAI

Cleanster is a Google Cloud Function node application designed to filter and moderate content from Nostr using OpenAI's moderation service. With the surge in user-generated content, maintaining the quality and safety of shared data is paramount. Cleanster seamlessly takes in a pubsub feed of Nostr content, checks it, and generates Nostr events tagging the results.

Table of Contents

  1. Requirements
  2. Installation
  3. Usage
  4. Support
  5. Contributing
  6. License

Requirements

  • Google Cloud Account
  • Node.js v20+
  • OpenAI API Key
  • Nostr account

Installation

  1. Clone the Repository

    git clone https://github.com/planetary-social/cleanster.git
    cd cleanster
  2. Prerequisites

    • Install Dependencies with pnpm install

Usage

  1. Testing Setup

    • Set a NOSTR_PRIVATE_KEY environment variable with the private key of a test nostr account used to publish moderation reports.
    • Run the tests with pnpm test to ensure everything is set up correctly.
  2. Deployment to Google Cloud

    • Prepare Your Environment: Ensure the Google Cloud CLI (gcloud) is installed and configured with your account.
    • Set Environment Variables: NOSTR_PRIVATE_KEY for the reporting account private key, and OPENAI_API_CSV for your OpenAI API keys.
    • Deploy the Function: Use pnpm run deploy to upload Cleanster to Google Cloud.
    • Post-Deployment: Cleanster starts processing Nostr events and publishes moderation reports via NIP-56 on wss://relay.nos.social. You can change this relay to your own.
  3. Integration with our Nostr Relay

    • If you don't want to host your own deployment you can use our relay. Add wss://relay.nos.social to your Nostr client's relay list.
    • Content flagged by Cleanster is managed by this relay and marked as kind 1984 for prompt handling.
    • Following the Reportinator bot in your Nostr client is essential for proper integration with Cleanster's moderation reports.
    • Your client should properly process kind 1984 in a similar way that https://nos.social does.

Support

For any issues or suggestions, please open an issue or contact our support team at support@nos.social.

Contributing

We welcome contributions! To contribute, fork the repository, create a feature branch, implement your changes, commit, push to your branch, and open a pull request.

License

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

About

License:MIT License


Languages

Language:JavaScript 95.8%Language:Shell 4.2%