diff options
| -rw-r--r-- | README.md | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..f3d961a --- /dev/null +++ b/README.md | |||
| @@ -0,0 +1,99 @@ | |||
| 1 | # nostr-grpc | ||
| 2 | |||
| 3 | A high-performance Nostr relay with gRPC and WebSocket support. | ||
| 4 | |||
| 5 | ## Features | ||
| 6 | |||
| 7 | - **gRPC-first**: Binary protobuf storage with gRPC API | ||
| 8 | - **SQLite storage**: WAL mode, optimized indexes | ||
| 9 | - **Event validation**: Signature and ID verification | ||
| 10 | - **Nostr compatible**: NIP-01 compliant | ||
| 11 | |||
| 12 | ## Quick Start | ||
| 13 | |||
| 14 | ### Build | ||
| 15 | |||
| 16 | ```bash | ||
| 17 | make build # Build relay | ||
| 18 | make build-client # Build test client | ||
| 19 | make build-all # Build both | ||
| 20 | ``` | ||
| 21 | |||
| 22 | ### Run the Relay | ||
| 23 | |||
| 24 | ```bash | ||
| 25 | ./bin/relay | ||
| 26 | # or with custom settings: | ||
| 27 | ./bin/relay -grpc-addr :50051 -db relay.db | ||
| 28 | ``` | ||
| 29 | |||
| 30 | The relay will start listening on `:50051` (gRPC). | ||
| 31 | |||
| 32 | ### Test with Client | ||
| 33 | |||
| 34 | ```bash | ||
| 35 | # In another terminal: | ||
| 36 | ./bin/testclient | ||
| 37 | |||
| 38 | # Output: | ||
| 39 | # Generated key: npub1... | ||
| 40 | # Publishing event... | ||
| 41 | # ✓ Event published successfully: abc123... | ||
| 42 | # Querying events... | ||
| 43 | # Found 1 events | ||
| 44 | # - abc123...: Hello from gRPC client! | ||
| 45 | ``` | ||
| 46 | |||
| 47 | ## gRPC API | ||
| 48 | |||
| 49 | See [proto/nostr/v1/nostr.proto](proto/nostr/v1/nostr.proto) for the full API. | ||
| 50 | |||
| 51 | ### Available RPCs | ||
| 52 | |||
| 53 | - `PublishEvent` - Publish a single event (with validation) | ||
| 54 | - `PublishBatch` - Publish multiple events | ||
| 55 | - `QueryEvents` - Query events with filters (paginated) | ||
| 56 | - `CountEvents` - Count events matching filters | ||
| 57 | - `Subscribe` - Stream events (not implemented yet) | ||
| 58 | - `Unsubscribe` - Close subscription (not implemented yet) | ||
| 59 | |||
| 60 | ## Current Status | ||
| 61 | |||
| 62 | **Phase 1: Core Relay** | ||
| 63 | - ✅ SQLite storage with binary-first design | ||
| 64 | - ✅ Event validation (ID, signature) | ||
| 65 | - ✅ gRPC publish/query API | ||
| 66 | - ⏳ Subscribe/streaming (in progress) | ||
| 67 | - ⏳ WebSocket server (planned) | ||
| 68 | |||
| 69 | ## Development | ||
| 70 | |||
| 71 | ```bash | ||
| 72 | make proto # Regenerate protobuf code | ||
| 73 | make test # Run tests | ||
| 74 | make proto-lint # Lint proto files | ||
| 75 | ``` | ||
| 76 | |||
| 77 | ## Architecture | ||
| 78 | |||
| 79 | ``` | ||
| 80 | ┌─────────────────┐ | ||
| 81 | │ gRPC Client │ | ||
| 82 | └────────┬────────┘ | ||
| 83 | │ pb.Event | ||
| 84 | ▼ | ||
| 85 | ┌─────────────────┐ | ||
| 86 | │ gRPC Handler │ ← validates using nostr.Event | ||
| 87 | │ (convert.go) │ ← generates canonical JSON | ||
| 88 | └────────┬────────┘ | ||
| 89 | │ pb.Event + canonicalJSON | ||
| 90 | ▼ | ||
| 91 | ┌─────────────────┐ | ||
| 92 | │ Storage Layer │ ← protobuf + compressed JSON | ||
| 93 | │ (SQLite) │ ← query by filter | ||
| 94 | └─────────────────┘ | ||
| 95 | ``` | ||
| 96 | |||
| 97 | ## License | ||
| 98 | |||
| 99 | MIT | ||
