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.
- Google Cloud Account
- Node.js v20+
- OpenAI API Key
- Nostr account
-
Clone the Repository
git clone https://github.com/planetary-social/cleanstr.git cd cleanstr
-
Prerequisites
- Install Dependencies with
pnpm install
- Install Dependencies with
-
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.
- Set a
-
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, andOPENAI_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.
- Prepare Your Environment: Ensure the Google Cloud CLI (
-
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.
- If you don't want to host your own deployment you can use our relay. Add
For any issues or suggestions, please open an issue or contact our support team at [email protected].
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.
This project is licensed under the MIT License. See the LICENSE file for details.