| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
 |  | |||
 |  | |||
 |  | |||
 |  | |||
 |  | |||
 |  | |||
 |  | |||
 |  | |||
 |  | |||
 |  | |||
 |  | |||
 |  | |||
 |  | |||
 |  | |||
 |  | |||
 |  | |||
GRAIN is a comprehensive Nostr solution that serves primarily as a powerful relay for operators who need fine-grained control, while also providing a complete Go client library for developers building Nostr applications.
Nostr is a simple, open protocol for creating censorship-resistant social networks. Users publish signed events (posts, profiles, reactions) to relays, which store and distribute them. Unlike centralized platforms, users control their identity through cryptographic keys and can freely move between relays.
GRAIN acts as one of these relays - storing events, serving them to clients, and ensuring your relay operates according to your policies. It also provides the building blocks for creating your own Nostr clients.
GRAIN now includes a full-featured Nostr client library that developers can use to build their own applications:
GRAIN includes a modern web interface that serves as both a relay dashboard and reference client implementation:
The web interface showcases the client library capabilities with:
This reference implementation serves as both a functional interface and documentation for developers using the client library.
Full documentation lives in docs/ — start at the documentation hub, organized by what you're doing:
Development Relay: wss://wheat.oslim.dev
📊 View Detailed Status & Historical Data
My development relay wheat.oslim.dev serves as the testing and demo environment for Grain. This relay helps me validate new features, test performance optimizations, and provide a platform for developers to experiment with grain. This relay routinely runs unreleased versions of grain and may contain bugs.
Wheat is a public nostr relay that anyone can write to and read from. Wheat will delete events from non whitelisted users periodically. You can add your npub to the whitelist by paying for a oslim.dev NIP05.
Status monitoring powered by Upptime
GRAIN is a zero-dependency, single-binary application. All assets (including the web interface) are embedded in the binary. On first run, it will automatically create default configuration files and a local database in the platform-appropriate data directory:
You can override the data directory using the --data-dir <path> CLI flag or the GRAIN_DATA_DIR environment variable.
Docker Installation
Build from Source
Complete Installation Guide
GRAIN uses four main configuration files with hot-reload support:
Configuration files are automatically created from embedded examples on first run. Changes to any configuration file are detected and applied automatically without requiring a restart.
📖 For detailed configuration options and examples, see Configuration Documentation
GRAIN can be imported as a Go module for building Nostr clients:
package main
import (
"context"
"fmt"
"time"
"github.com/0ceanslim/grain/client/core"
nostr "github.com/0ceanslim/grain/server/types"
)
func main() {
// The client owns a shared, outbox-routed relay pool.
client := core.NewClient(core.DefaultConfig())
ctx := context.Background()
// Read-only: fetch a user's notes from THEIR outbox relays — no signer needed.
author := "author-pubkey-hex"
notes := client.NewUserContext(author).FetchNotes(ctx, author, core.WithLimit(20))
fmt.Printf("fetched %d notes\n", len(notes))
// Publishing: attach a signer. The outbox model routes the event to your write
// relays (and any mentioned recipient's inbox) — no manual relay list needed.
signer, _ := core.NewEventSigner("your-private-key-hex")
uc := client.NewUserContext(signer.PublicKey(), core.WithSigner(signer))
note := &nostr.Event{Kind: 1, Content: "Hello Nostr!", CreatedAt: time.Now().Unix()}
results, _ := uc.SignAndPublish(ctx, note)
fmt.Printf("published to %d relays\n", len(results))
}📖 See the Client Library Guide for complete examples covering connection management, subscriptions, event building/signing, and authentication flows.
This project is Open Source and licensed under the MIT License. See the LICENSE file for details.
I welcome contributions, bug reports, and feature requests via GitHub.
Repository: https://github.com/0ceanslim/grain
Issues: https://github.com/0ceanslim/grain/issues
These guides cover setting up your development environment, code standards, testing procedures, client library usage, and contribution workflows.
made with 💦 by OceanSlim
Reliable infrastructure for the decentralized web.
| Back | FazBrowse Home | New Git URL |