Skip to content

planetary-social/cleanstr

Repository files navigation

Node.js CI codecov

Cleanstr - Nostr Content Moderation with OpenAI

Cleanstr 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. Cleanstr 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/cleanstr.git
    cd cleanstr
  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 Cleanstr to Google Cloud.
    • Post-Deployment: Cleanstr 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 Cleanstr 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 Cleanstr'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 [email protected].

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

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published