upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2026-01-08 00:26:51 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2026-01-08 00:26:51 +0000
commit543d9e66dd44b70ed467c61635e6c8056fef8555 (patch)
tree99783725680e3f1d4c88699777746bc3ea9fa806 /README.md
parentc67ebe6f33bfa191f17eb0df24d3ee18092c74e1 (diff)
docs: update docs with sync and purgatory and git data sync
Diffstat (limited to 'README.md')
-rw-r--r--README.md256
1 files changed, 205 insertions, 51 deletions
diff --git a/README.md b/README.md
index 3cc1adf..3bc5be0 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,21 @@
2 2
3A [GRASP](https://gitworkshop.dev/danconwaydev.com/grasp) (Git Relays Authorized via Signed-Nostr Proofs) implementation in Rust. 3A [GRASP](https://gitworkshop.dev/danconwaydev.com/grasp) (Git Relays Authorized via Signed-Nostr Proofs) implementation in Rust.
4 4
5## What's New πŸŽ‰
6
7**Full GRASP-02 Implementation Complete!**
8
9ngit-grasp now features a sophisticated proactive sync system that automatically discovers relays, syncs events using NIP-77 negentropy, and hunts for missing git data across clone URLs. Key highlights:
10
11- ✨ **NIP-77 Negentropy**: Efficient set reconciliation with automatic REQ+EOSE fallback
12- ✨ **Intelligent Purgatory**: Auto-fetches missing git data from clone URLs (500ms for synced events, 3min for user pushes)
13- ✨ **Multi-Maintainer First-Class**: Pushed git data automatically syncs to all maintainer repositories
14- ✨ **Smart Throttling**: Respectful rate limiting (5 concurrent, 30/min per domain) with exponential backoff
15- ✨ **Live & Historic Sync**: Real-time event streaming plus daily full reconciliation
16- ✨ **Connection Health**: Exponential backoff, rate limit detection, dead relay handling
17
18See [GRASP-02 Proactive Sync](docs/explanation/grasp-02-proactive-sync.md) and [Purgatory Git Data Sync](docs/explanation/grasp-02-proactive-sync-purgatory-git-data.md) for details.
19
5## Overview 20## Overview
6 21
7`ngit-grasp` is a Rust-based implementation of the GRASP protocol, which enables decentralized Git repository hosting with Nostr-based authorization. This implementation combines: 22`ngit-grasp` is a Rust-based implementation of the GRASP protocol, which enables decentralized Git repository hosting with Nostr-based authorization. This implementation combines:
@@ -14,16 +29,26 @@ Unlike the reference implementation ([ngit-relay](https://gitworkshop.dev/npub15
14 29
15## Status 30## Status
16 31
32**Production Ready** - Full GRASP-01 and GRASP-02 implementation with comprehensive test coverage.
33
17## Key Features 34## Key Features
18 35
19- **Pure Rust Implementation**: Single binary, no external dependencies beyond Git itself 36- **Pure Rust Implementation**: Single binary, no external dependencies beyond Git itself
20- **Integrated Authorization**: Push validation happens inline during the Git receive-pack operation 37- **Integrated Authorization**: Push validation happens inline during the Git receive-pack operation
21- **GRASP-01 Compliant**: Core service requirements for Git hosting with Nostr authorization 38- **GRASP-01 Compliant**: Core service requirements for Git hosting with Nostr authorization
22- **Extensible Architecture**: Designed to support GRASP-02 (Proactive Sync) and GRASP-05 (Archive) extensions 39- **GRASP-02 Proactive Sync**: Sophisticated relay-to-relay event and git data synchronization
40 - **NIP-77 Negentropy**: Efficient set reconciliation with automatic fallback to REQ+EOSE
41 - **Live & Historic Sync**: Real-time event streaming plus catch-up for past events
42 - **Smart Throttling**: Respectful rate limiting (5 concurrent, 30/min per domain) with exponential backoff
43 - **Multi-Maintainer First-Class**: Internal sync of pushed git data across all maintainer repositories
44 - **Intelligent Purgatory**: Auto-fetches missing git data from clone URLs when events arrive first
45 - **Discovery-Driven**: Dynamically connects to relays listed in repository announcements
23- **Developer-Friendly**: Built with modern Rust async patterns using tokio and actix-web 46- **Developer-Friendly**: Built with modern Rust async patterns using tokio and actix-web
24 47
25## Architecture Highlights 48## Architecture Highlights
26 49
50### Inline Authorization (GRASP-01)
51
27The key architectural decision is **inline authorization** rather than Git hooks: 52The key architectural decision is **inline authorization** rather than Git hooks:
28 53
29- Vendored and customised `git-http-backend` crate provides low-level access to the Git protocol 54- Vendored and customised `git-http-backend` crate provides low-level access to the Git protocol
@@ -38,9 +63,50 @@ This approach provides:
38- **Tighter integration**: Shared state between Git and Nostr components 63- **Tighter integration**: Shared state between Git and Nostr components
39- **Easier testing**: Pure Rust unit and integration tests 64- **Easier testing**: Pure Rust unit and integration tests
40 65
66### Sophisticated Sync System (GRASP-02)
67
68The proactive sync implementation is production-grade with advanced features:
69
70**NIP-77 Negentropy with Intelligent Fallback:**
71
72- Attempts efficient set reconciliation via NIP-77 for full syncs
73- Automatically falls back to REQ+EOSE with pagination when negentropy unavailable
74- Combines live subscriptions (`limit:0`) with historic catch-up
75
76**Multi-Layer Filter Strategy:**
77
78- **Layer 1**: Repository announcements and maintainer lists (connection-level)
79- **Layer 2**: Events tagging repositories (a/A/q tags, batched per 100 repos)
80- **Layer 3**: Events tagging root events (e/E/q tags, batched per 100 IDs)
81
82**Connection Health Management:**
83
84- Exponential backoff for failed connections (5s β†’ 1 hour)
85- Rate limit detection with 65-second cooldown
86- Dead relay handling (24h+ failures β†’ minimal retry)
87- Quick reconnect (<15min) vs fresh start (>15min or daily)
88
89**Intelligent Purgatory with Active Git Data Hunting:**
90
91- Events without git data held in-memory for 30 minutes
92- **User events**: 3-minute delay (expect git push to follow)
93- **Synced events**: 500ms delay (batch burst arrivals, then hunt immediately)
94- Proactively fetches missing data from clone URLs every 2 minutes
95- Respectful throttling: 5 concurrent, 30 requests/min per domain
96- Round-robin fairness across repositories
97- Auto-release when data arrives, auto-expire after 30 minutes
98
99**First-Class Multi-Maintainer Support:**
100
101- Git data pushed to one maintainer's repo automatically syncs to all other maintainers
102- Shared object databases for storage efficiency (planned)
103- Seamless collaboration without manual coordination
104
105See [GRASP-02 Proactive Sync](docs/explanation/grasp-02-proactive-sync.md) for full architectural details.
106
41## GRASP Compliance 107## GRASP Compliance
42 108
43### GRASP-01 (Core Service Requirements) 109### GRASP-01 (Core Service Requirements) βœ…
44 110
45- βœ… NIP-01 compliant Nostr relay at `/` 111- βœ… NIP-01 compliant Nostr relay at `/`
46- βœ… Accepts NIP-34 repository announcements and state events 112- βœ… Accepts NIP-34 repository announcements and state events
@@ -50,12 +116,25 @@ This approach provides:
50- βœ… Support for `refs/nostr/<event-id>` for PRs 116- βœ… Support for `refs/nostr/<event-id>` for PRs
51- βœ… CORS support for web-based Git clients 117- βœ… CORS support for web-based Git clients
52- βœ… NIP-11 relay information document 118- βœ… NIP-11 relay information document
53 119- βœ… **Purgatory**: Events without git data held for 30 minutes, auto-released when data arrives
54### GRASP-02 (Proactive Sync) - Planned 120
55 121### GRASP-02 (Proactive Sync) βœ…
56- πŸ”„ Proactive event sync from listed relays 122
57- πŸ”„ Proactive Git data sync from listed clone URLs 123- βœ… **Relay Discovery**: Automatically connects to relays listed in repository announcements
58- πŸ”„ PR data fetching and serving 124- βœ… **Event Sync**: Proactive sync from discovered relays using NIP-77 negentropy with REQ+EOSE fallback
125 - Live subscriptions (`limit:0`) for real-time event streaming
126 - Historic sync with automatic pagination for large result sets
127 - Daily full reconciliation to detect drift
128 - Connection health tracking with exponential backoff
129- βœ… **Git Data Sync**: Automatic fetching of missing git data from clone URLs
130 - Smart timing: 3min delay for user events, 500ms for synced events
131 - Respectful throttling: 5 concurrent requests, 30/min per domain
132 - Round-robin fairness across repositories
133 - Exponential backoff with fresh start on new events
134- βœ… **Multi-Maintainer Support**: Pushed git data automatically synced to all maintainer repositories
135- βœ… **Comprehensive Monitoring**: Prometheus metrics for sync health, bandwidth, and relay status
136
137**See**: [GRASP-02 Proactive Sync](docs/explanation/grasp-02-proactive-sync.md) and [Purgatory Git Data Sync](docs/explanation/grasp-02-proactive-sync-purgatory-git-data.md)
59 138
60### GRASP-05 (Archive) - Planned 139### GRASP-05 (Archive) - Planned
61 140
@@ -64,53 +143,52 @@ This approach provides:
64 143
65## Roadmap 144## Roadmap
66 145
67### Purgatory 146### GRASP-02 Enhancements
68 147
69State events / PR / PR Update events without git data should be accepted with msg: "won't be served until git data arrives" or "in puratory awaiting git data" and not served by the main relay. 148**Proactive Sync Plus:**
70When the git data arrives, they get released from puratory. If git data doesn't arrive within 1 day, the events get deleted.
71 149
72This ensures the grasp serve only serves these events when it can provide the git data to support them. 150- πŸ”„ Scan read/write relays of repo/PR/Patch/Issue authors for related comments
151- πŸ”„ Stricter anti-spam mechanisms for author relay events
152- πŸ”„ Periodic scanning of relays in User Grasp Lists for announcements listing our relay
73 153
74Why this is useful: 154### Data Efficiency
75 155
761. owner submits updated state event but loses connectivity before sending the new git data. The relay causing ngit-cli to fail to clone and other clients to show a warning that the git servers state doesn't align with nostr as relays only serve the latest state event (as its addressable). 156**Git Object Deduplication:**
77 a. clients could be made more resilient if they know older versions of the state event served by a grasp server relate to the state they are currently storing.
78 b. if clients just start using grasp servers (instead of other relays) then they will always be able to find the git data related to the latest versin of the event servered by a grasp server
79 157
802. serving PR events where the git data isn't accessable isn't useful. 158- πŸ”„ Shared object database across repositories
159- πŸ”„ Use `GIT_ALTERNATE_OBJECT_DIRECTORIES` or `.git/objects/info/alternates`
160- πŸ”„ Significant storage savings for multi-maintainer repositories
81 161
82### GRASP-02 (Proactive Sync) 162### Monitoring & Observability
83 163
84- rust-nostr client websocket connection to other grasp servers listening for our repo. 164ngit-grasp exposes comprehensive Prometheus metrics at `/metrics` for:
85- negentropy catchup
86- look for missing data (from state or PR / PR update) then try and fetch from other grasp servers. for efficency look for it from other repos (ie repos of other maintainers). Do this on new state event / PR / PR update evnet and on a timer for events we know we don't have the data for.
87 165
88#### Proactive Sync + 166**Git Operations:**
89 167
90. look for announcement events on other relays / grasp servers that list our service. 168- Clone/fetch/push rates and bandwidth
91. look on read/write relays of repo / PR / Patch / Issue author to get related comments. pass through stricter anti SPAM mechanism? 169- Authorization results (accepted/rejected)
170- Top N repositories by bandwidth
92 171
93### Data effiency 172**Nostr Events:**
94 173
95dedupe git data = shared object database or (GIT_ALTERNATE_OBJECT_DIRECTORIES or .git/objects/info/alternates) 174- WebSocket connections (active, unique IPs, flagged abusers)
175- Events received, stored, rejected by kind
176- Purgatory status (events waiting for git data)
96 177
97### Monitoring 178**Sync Health (GRASP-02):**
98 179
99ngit-grasp exposes Prometheus metrics at `/metrics` for connection tracking, Git operations, and Nostr events. 180- Per-relay connection status and health states
181- Event sync rates and bandwidth
182- Git data fetch attempts and success rates
183- Domain throttling metrics
100 184
101**Configuration Options:** 185**Configuration Options:**
102 186
103| Option | CLI Flag | Environment Variable | Default | 187| Option | CLI Flag | Environment Variable | Default |
104|--------|----------|---------------------|---------| 188| -------------------------- | --------------------------------------------- | ------------------------------------------------ | ------- |
105| Metrics enabled | `--metrics-enabled` | `NGIT_METRICS_ENABLED` | `true` | 189| Metrics enabled | `--metrics-enabled` | `NGIT_METRICS_ENABLED` | `true` |
106| Connection abuse threshold | `--metrics-connection-per-ip-abuse-threshold` | `NGIT_METRICS_CONNECTION_PER_IP_ABUSE_THRESHOLD` | `10` | 190| Connection abuse threshold | `--metrics-connection-per-ip-abuse-threshold` | `NGIT_METRICS_CONNECTION_PER_IP_ABUSE_THRESHOLD` | `10` |
107| Top N repos | `--metrics-top-n-repos` | `NGIT_METRICS_TOP_N_REPOS` | `10` | 191| Top N repos | `--metrics-top-n-repos` | `NGIT_METRICS_TOP_N_REPOS` | `10` |
108
109**Key Metrics:**
110- WebSocket connections (active, unique IPs, flagged abusers)
111- Git operations (clone/fetch/push rates, bandwidth, authorization results)
112- Nostr events (received, stored, rejected by kind)
113- Top N repositories by bandwidth
114 192
115**Privacy:** IP addresses are never exposed in metrics - only aggregate counts. 193**Privacy:** IP addresses are never exposed in metrics - only aggregate counts.
116 194
@@ -154,6 +232,7 @@ This a useful feature of other git servers.
154```bash 232```bash
155# install ngit 233# install ngit
156curl -Ls https://ngit.dev/install.sh | bash 234curl -Ls https://ngit.dev/install.sh | bash
235
157# Clone the repository 236# Clone the repository
158git clone nostr://danconwaydev.com/relay.ngit.dev/ngit-grasp 237git clone nostr://danconwaydev.com/relay.ngit.dev/ngit-grasp
159cd ngit-grasp 238cd ngit-grasp
@@ -164,6 +243,8 @@ nix develop -c cargo build --release
164# Configure 243# Configure
165cp .env.example .env 244cp .env.example .env
166# Edit .env with your settings 245# Edit .env with your settings
246# Required: NGIT_DOMAIN=your-domain.com
247# Optional: NGIT_SYNC_BOOTSTRAP_RELAY_URL=wss://relay.example.com
167 248
168# Run 249# Run
169nix develop -c cargo run --release 250nix develop -c cargo run --release
@@ -172,6 +253,14 @@ nix develop -c cargo run --release
172nix develop -c cargo test --lib 253nix develop -c cargo test --lib
173``` 254```
174 255
256**What happens on startup:**
257
258- Git HTTP server starts on configured bind address
259- Nostr relay begins accepting WebSocket connections
260- If bootstrap relay configured, sync system connects and discovers repositories
261- Purgatory system activates, ready to hunt for missing git data
262- Prometheus metrics exposed at `/metrics`
263
175**Don't have Nix?** See [Getting Started Tutorial](docs/tutorials/getting-started.md) for alternative setup methods. 264**Don't have Nix?** See [Getting Started Tutorial](docs/tutorials/getting-started.md) for alternative setup methods.
176 265
177## Configuration 266## Configuration
@@ -200,6 +289,8 @@ NGIT_OWNER_NPUB=npub1... ngit-grasp --domain relay.example.com
200 289
201### Configuration Options 290### Configuration Options
202 291
292#### Core Settings
293
203| Option | CLI Flag | Environment Variable | Default | 294| Option | CLI Flag | Environment Variable | Default |
204| ----------------- | --------------------- | ------------------------ | -------------------------------------------- | 295| ----------------- | --------------------- | ------------------------ | -------------------------------------------- |
205| Domain | `--domain` | `NGIT_DOMAIN` | (required) | 296| Domain | `--domain` | `NGIT_DOMAIN` | (required) |
@@ -211,6 +302,24 @@ NGIT_OWNER_NPUB=npub1... ngit-grasp --domain relay.example.com
211| Bind address | `--bind-address` | `NGIT_BIND_ADDRESS` | `127.0.0.1:8080` | 302| Bind address | `--bind-address` | `NGIT_BIND_ADDRESS` | `127.0.0.1:8080` |
212| Database backend | `--database-backend` | `NGIT_DATABASE_BACKEND` | `lmdb` | 303| Database backend | `--database-backend` | `NGIT_DATABASE_BACKEND` | `lmdb` |
213 304
305#### GRASP-02 Sync Settings
306
307| Option | CLI Flag | Environment Variable | Default |
308| ------------------------- | --------------------------------------- | ------------------------------------------ | --------------- |
309| Bootstrap relay | `--sync-bootstrap-relay-url` | `NGIT_SYNC_BOOTSTRAP_RELAY_URL` | (optional) |
310| Base backoff | `--sync-base-backoff-secs` | `NGIT_SYNC_BASE_BACKOFF_SECS` | `5` seconds |
311| Max backoff | `--sync-max-backoff-secs` | `NGIT_SYNC_MAX_BACKOFF_SECS` | `3600` (1 hour) |
312| Disconnect check interval | `--sync-disconnect-check-interval-secs` | `NGIT_SYNC_DISCONNECT_CHECK_INTERVAL_SECS` | `60` seconds |
313| Disable negentropy | `--sync-disable-negentropy` | `NGIT_SYNC_DISABLE_NEGENTROPY` | `false` |
314| Batch window | N/A | `NGIT_SYNC_BATCH_WINDOW_MS` | `5000` ms |
315
316**Sync Notes:**
317
318- **Bootstrap relay**: Optional starting point for relay discovery. System automatically discovers additional relays from repository announcements.
319- **Backoff settings**: Controls exponential backoff for failed connections (`base * 2^(failures-1)`, capped at max).
320- **Negentropy**: Can be disabled for testing REQ+EOSE fallback behavior.
321- **Batch window**: Self-subscriber batches events for this duration before triggering sync filters.
322
214### Database Backends 323### Database Backends
215 324
216- `lmdb`: LMDB backend (default, persistent, general purpose) 325- `lmdb`: LMDB backend (default, persistent, general purpose)
@@ -227,9 +336,24 @@ export NGIT_DOMAIN=gitnostr.com
227export NGIT_OWNER_NPUB=npub1... 336export NGIT_OWNER_NPUB=npub1...
228export NGIT_BIND_ADDRESS=0.0.0.0:8080 337export NGIT_BIND_ADDRESS=0.0.0.0:8080
229export NGIT_DATABASE_BACKEND=lmdb 338export NGIT_DATABASE_BACKEND=lmdb
339
340# Optional: Enable proactive sync from a bootstrap relay
341export NGIT_SYNC_BOOTSTRAP_RELAY_URL=wss://relay.damus.io
342
343# Optional: Tune sync behavior
344export NGIT_SYNC_BASE_BACKOFF_SECS=5 # Start backoff at 5 seconds
345export NGIT_SYNC_MAX_BACKOFF_SECS=3600 # Cap backoff at 1 hour
346
230ngit-grasp 347ngit-grasp
231``` 348```
232 349
350**Production Tips:**
351
352- Set `NGIT_SYNC_BOOTSTRAP_RELAY_URL` to a well-connected relay for initial repository discovery
353- The system will automatically discover and connect to additional relays listed in repository announcements
354- Monitor sync health via Prometheus metrics at `/metrics`
355- Purgatory will automatically fetch missing git data from clone URLs
356
233### Example: Development 357### Example: Development
234 358
235```bash 359```bash
@@ -331,11 +455,11 @@ ngit-grasp/
331β”œβ”€β”€ src/ 455β”œβ”€β”€ src/
332β”‚ β”œβ”€β”€ main.rs # Entry point, server setup 456β”‚ β”œβ”€β”€ main.rs # Entry point, server setup
333β”‚ β”œβ”€β”€ lib.rs # Library exports 457β”‚ β”œβ”€β”€ lib.rs # Library exports
334β”‚ β”œβ”€β”€ config.rs # Configuration 458β”‚ β”œβ”€β”€ config.rs # Configuration (core + sync settings)
335β”‚ β”œβ”€β”€ git/ 459β”‚ β”œβ”€β”€ git/
336β”‚ β”‚ β”œβ”€β”€ mod.rs # Git module + repository operations 460β”‚ β”‚ β”œβ”€β”€ mod.rs # Git module + repository operations
337β”‚ β”‚ β”œβ”€β”€ handlers.rs # Git HTTP handlers 461β”‚ β”‚ β”œβ”€β”€ handlers.rs # Git HTTP handlers
338β”‚ β”‚ β”œβ”€β”€ authorization.rs # Push validation logic 462β”‚ β”‚ β”œβ”€β”€ authorization.rs # Push validation logic (checks DB + purgatory)
339β”‚ β”‚ β”œβ”€β”€ protocol.rs # Git protocol encoding 463β”‚ β”‚ β”œβ”€β”€ protocol.rs # Git protocol encoding
340β”‚ β”‚ └── subprocess.rs # Git subprocess management 464β”‚ β”‚ └── subprocess.rs # Git subprocess management
341β”‚ β”œβ”€β”€ nostr/ 465β”‚ β”œβ”€β”€ nostr/
@@ -348,30 +472,60 @@ ngit-grasp/
348β”‚ β”‚ β”œβ”€β”€ state.rs # State event validation + ref alignment 472β”‚ β”‚ β”œβ”€β”€ state.rs # State event validation + ref alignment
349β”‚ β”‚ β”œβ”€β”€ pr_event.rs # PR/PR Update validation 473β”‚ β”‚ β”œβ”€β”€ pr_event.rs # PR/PR Update validation
350β”‚ β”‚ └── related.rs # Forward/backward reference checking 474β”‚ β”‚ └── related.rs # Forward/backward reference checking
475β”‚ β”œβ”€β”€ sync/ # GRASP-02 Proactive Sync (relay-to-relay)
476β”‚ β”‚ β”œβ”€β”€ mod.rs # SyncManager, main loop, data structures
477β”‚ β”‚ β”œβ”€β”€ algorithms.rs # derive_relay_targets(), compute_actions()
478β”‚ β”‚ β”œβ”€β”€ filters.rs # 3-layer filter building (announcements, repos, events)
479β”‚ β”‚ β”œβ”€β”€ health.rs # RelayHealthTracker (backoff, rate limits)
480β”‚ β”‚ β”œβ”€β”€ relay_connection.rs # RelayConnection, event loop lifecycle
481β”‚ β”‚ β”œβ”€β”€ self_subscriber.rs # SelfSubscriber (batched event discovery)
482β”‚ β”‚ └── metrics.rs # SyncMetrics for Prometheus
483β”‚ β”œβ”€β”€ purgatory/ # In-memory holding area for events awaiting git data
484β”‚ β”‚ β”œβ”€β”€ mod.rs # Purgatory core (state/PR storage, 30min expiry)
485β”‚ β”‚ β”œβ”€β”€ helpers.rs # State event ref matching, PR lookup
486β”‚ β”‚ β”œβ”€β”€ processing.rs # Unified git data processing (push + sync paths)
487β”‚ β”‚ └── sync/ # Proactive git data fetching
488β”‚ β”‚ β”œβ”€β”€ mod.rs # Public API (enqueue, main loop)
489β”‚ β”‚ β”œβ”€β”€ loop.rs # Sync loop (1s interval, debounced delays)
490β”‚ β”‚ β”œβ”€β”€ functions.rs # Core sync logic (try URLs, handle results)
491β”‚ β”‚ β”œβ”€β”€ queue.rs # SyncQueue (backoff, fresh start on new events)
492β”‚ β”‚ β”œβ”€β”€ throttle.rs # DomainThrottle (5 concurrent, 30/min, round-robin)
493β”‚ β”‚ └── context.rs # SyncContext trait + mock for testing
351β”‚ β”œβ”€β”€ http/ 494β”‚ β”œβ”€β”€ http/
352β”‚ β”‚ β”œβ”€β”€ mod.rs # HTTP module 495β”‚ β”‚ β”œβ”€β”€ mod.rs # HTTP module
353β”‚ β”‚ β”œβ”€β”€ landing.rs # Landing page handler 496β”‚ β”‚ β”œβ”€β”€ landing.rs # Landing page handler
354β”‚ β”‚ └── nip11.rs # NIP-11 relay info document 497β”‚ β”‚ └── nip11.rs # NIP-11 relay info document
355β”‚ └── metrics/ 498β”‚ └── metrics/
356β”‚ β”œβ”€β”€ mod.rs # Prometheus metrics 499β”‚ β”œβ”€β”€ mod.rs # Prometheus metrics (Git, Nostr, Sync)
357β”‚ β”œβ”€β”€ bandwidth.rs # Bandwidth tracking 500β”‚ β”œβ”€β”€ bandwidth.rs # Bandwidth tracking
358β”‚ └── connection.rs # Connection tracking 501β”‚ └── connection.rs # Connection tracking
359β”œβ”€β”€ docs/ # Documentation (DiΓ‘taxis framework) 502β”œβ”€β”€ docs/ # Documentation (DiΓ‘taxis framework)
360β”œβ”€β”€ tests/ # Integration tests 503β”‚ β”œβ”€β”€ explanation/ # Architecture, decisions, GRASP-02 deep-dives
504β”‚ β”œβ”€β”€ how-to/ # Deployment, configuration guides
505β”‚ β”œβ”€β”€ tutorials/ # Getting started, first steps
506β”‚ └── reference/ # API docs, test strategy
507β”œβ”€β”€ tests/ # Integration tests (NIP-01, NIP-34, purgatory)
361β”œβ”€β”€ grasp-audit/ # Compliance audit subproject 508β”œβ”€β”€ grasp-audit/ # Compliance audit subproject
362└── README.md 509└── README.md
363``` 510```
364 511
365## Comparison with ngit-relay 512## Comparison with ngit-relay
366 513
367| Feature | ngit-relay (Go) | ngit-grasp (Rust) | 514| Feature | ngit-relay (Go) | ngit-grasp (Rust) |
368| ------------- | ----------------------------------------- | ----------------------------- | 515| ------------------- | ----------------------------------------- | ---------------------------------------------------- |
369| Language | Go | Rust | 516| Language | Go | Rust |
370| Components | nginx + git-http-backend + hooks + Khatru | Single integrated binary | 517| Components | nginx + git-http-backend + hooks + Khatru | Single integrated binary |
371| Authorization | Pre-receive Git hook | Inline during receive-pack | 518| Authorization | Pre-receive Git hook | Inline during receive-pack |
372| Deployment | Docker + supervisord | Single binary | 519| GRASP-01 | βœ… Complete | βœ… Complete |
373| Testing | Go tests + shell scripts | Rust unit + integration tests | 520| GRASP-02 Event Sync | βœ… Limited | βœ… Advanced (NIP-77 negentropy + fallback) |
374| Performance | Good | Excellent (zero-copy, async) | 521| GRASP-02 Git Sync | βœ… Basic | βœ… Automatic purgatory hunting |
522| Multi-Maintainer | βœ… Supported | βœ… First-class (auto-sync across repos) |
523| Purgatory | βœ… 24-hour expiry | βœ… 30-minute expiry + proactive git data fetching |
524| Health Tracking | Basic | Advanced (exponential backoff, rate limit detection) |
525| Deployment | Docker + supervisord | Single binary |
526| Testing | Go tests + shell scripts | Rust unit + integration tests |
527| Performance | Good | Excellent (zero-copy, async) |
528| Monitoring | Basic logs | Comprehensive Prometheus metrics |
375 529
376## Contributing 530## Contributing
377 531