Skip to content

Gossip protocol: relay-to-relay direct sync #10

Description

@theonlyhennygod

v0.0.9 — Gossip Protocol

Problem

All sync goes through the central server (hub-and-spoke). If the central server goes down, nodes cannot discover or sync from each other.

Acceptance Criteria

  • Nodes exchange peer lists during sync (GET /rpc/peers already exists)
  • SyncClient can connect directly to other self-hosted nodes
  • Event deduplication across multiple relay sources (by event ID)
  • Configurable peer relay list in sync client
  • Node health scoring (track sync reliability, uptime)
  • Fallback: if central relay is unreachable, sync with known peers
  • E2E test: 3 nodes, middle node goes down, other 2 sync directly

Files to create/modify

  • apps/api/src/lib/sync/client.ts (add multi-relay support)
  • apps/api/src/lib/sync/gossip.ts (NEW — peer discovery + direct sync)
  • apps/api/src/trpc/routers/sync.ts (return peer URLs in sync response)
  • apps/api/scripts/test-gossip.ts (NEW)

Test

bun run test:gossip

Version bump

All package.json files: 0.0.8 to 0.0.9

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions