Go Relay Architecture for Implementing Nostr 🌾
Go to file
2024-10-27 17:04:25 -04:00
app reject by timestamp using string 2024-10-18 11:33:23 -04:00
config reject by timestamp using string 2024-10-18 11:33:23 -04:00
server Adjust event time contrainst on each event handle 2024-10-27 17:04:25 -04:00
tests configuration refactor 2024-07-30 11:27:38 -04:00
.gitignore blacklist moved to it's own yml 2024-10-16 14:07:37 -04:00
go.mod append mutelist event pubkeys to blacklist 2024-10-17 12:31:52 -04:00
go.sum append mutelist event pubkeys to blacklist 2024-10-17 12:31:52 -04:00
license first commit 2024-07-19 18:07:04 -04:00
main.go reject events based on timestamp 2024-10-18 11:22:01 -04:00
maintainers.yaml ngit maintainers added 2024-08-30 16:21:34 -04:00
readme.md readme change 2024-08-16 11:09:27 -04:00

GRAIN 🌾

Go Relay Archetecture for Implementing Nostr

GRAIN is an open-source Nostr relay implementation written in Go. This project aims to provide an efficient and configurable Nostr relay.

Features

  • Dynamic Event Handling: Capable of processing a wide range of events, categorized by type and kind, including support for event deletion as per NIP-09.
  • Configurable and Extensible: Easily customizable through configuration files, with plans for future GUI-based configuration management to streamline server adjustments.
  • Efficient Rate Limiting: Implements sophisticated rate limiting strategies to manage WebSocket messages, - events, and requests, ensuring fair resource allocation and protection against abuse.
  • Extensive Blacklist and Whitelist Functions:
    • Implements a robust blacklisting system with support for temporary and permanent bans based on content, pubkeys, or npubs.
    • Features word-based content filtering for automatic temporary or permanent bans.
    • Includes a configurable system for escalating temporary bans to permanent bans after a set number of violations.
    • Offers whitelist capabilities for pubkeys, npubs, event kinds, and domains, allowing fine-grained control over permitted content and users.
  • Flexible Event Size Management: Configurable size limits for events, with optional constraints based on - event kind, to maintain performance and prevent oversized data handling.
  • MongoDB Integration 🍃: Utilizes MongoDB for high-performance storage and management of events, ensuring data integrity and efficient query capabilities.
  • Scalable Architecture: Built with Go, leveraging its concurrency model to provide high throughput and scalability, suitable for handling large volumes of data and connections.
  • Relay Metadata Support (NIP-11): Provides relay metadata in compliance with NIP-11, allowing clients to retrieve server capabilities and administrative contact information.
  • User-Friendly Front-End: Includes a web interface that displays recent events and supports potential future enhancements like configuration management.
  • Open Source: Licensed under the MIT License, making it free to use and modify.

Prerequisites

MongoDB Server 🍃

I plan to add multiple other database types in the future (postgress, sqlite) GRAIN 🌾 leverages MongoDB for efficient storage and management of events. MongoDB, known for its high performance and scalability, is an ideal choice for handling large volumes of real-time data. GRAIN 🌾 uses MongoDB collections to store events categorized by kind and ensures quick retrieval and manipulation of these events through its robust querying capabilities.

You can get the free Community Server edition of MongoDB from the official MongoDB website: MongoDB Community Server
MongoDB provides extensive documentation and support to help you get started with installation and configuration, ensuring a smooth integration with GRAIN.

Configuration

Grain will automatically create the configurations and relay metadata files necessary if they do not already exist when you first run the program.

They are created in the root directory of Grain. You can change configurations and relay_metadata here and the server will automatically restart and use the new configurations. The relay must be restarted manually for new blacklist configurations to take effect.

Development

To contribute to GRAIN, follow these steps:

  1. Fork the repository.

  2. Make your changes.

  3. Commit your changes:

    git commit -m "Description of changes"
    
  4. Push to the repo:

    git push
    
  5. Create a Pull Request.

License

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

Acknowledgments

Special thanks to the Nostr community for their continuous support and contributions.

Feel free to reach out with any questions or issues you encounter while using GRAIN.

Open Source and made with 💜 by OceanSlim