.well-known/relay — Peer Auto-Discovery Standard

July 13, 20262 minutes

Introduction

In a federated network, peers need a way to discover each other. While you can manually configure peer URLs via environment variables or configuration files, a more scalable approach is auto-discovery using a standard well-known URI.

Relay implements /.well-known/relay following the pattern established by RFC 8615 — Well-Known Uniform Resource Identifiers. This allows any Relay instance to publish its capabilities, protocol version, and peer list in a machine-readable format.

The Well-Known URI Standard

RFC 8615 defines a path prefix /.well-known/ that hosts can use to publish machine-readable metadata. This is the same mechanism used by:

  • /.well-known/acme-challenge/ — Let’s Encrypt / ACME TLS certificates
  • /.well-known/change-password — Password change URLs
  • /.well-known/webfinger — WebFinger for ActivityPub and OStatus

Relay extends this pattern with /.well-known/relay.

Endpoint

GET /.well-known/relay

Returns a JSON document describing this relay node.

Example response:

{
  "version": "0.2.0",
  "protocol": "relay-federated",
  "node_url": "https://relay.example.com",
  "features": {
    "instances": true,
    "guestbook": true,
    "security": true
  },
  "capabilities": [
    "instance_directory",
    "health_monitoring",
    "guestbook_federation",
    "security_intelligence"
  ],
  "peers": [
    "https://relay2.example.com",
    "https://relay3.example.com"
  ]
}

Fields

FieldTypeDescription
versionstringRelay protocol version
protocolstringAlways relay-federated
node_urlstring (optional)This node’s public URL
featuresobjectFeature flags enabled on this node
capabilitiesarrayList of supported protocol capabilities
peersarray (optional)Known peer relay URLs

Usage in Relay

The .well-known/relay endpoint is served automatically by the API server. When a relay starts and has peers configured via --peers or RELAY_PEERS, it will attempt to fetch /.well-known/relay from each peer to discover their capabilities and their own peer lists (gossip propagation).

This enables a gossip-based discovery model:

  1. Node A knows about Node B
  2. Node A fetches /.well-known/relay from Node B
  3. Node B’s response includes its own peers (C, D, E)
  4. Node A now knows about C, D, and E
  5. Repeat — the network discovers itself organically

Self-Discovery

You can query your own relay’s well-known endpoint:

curl http://localhost:3000/.well-known/relay

Or from another machine on the network:

curl http://192.168.1.140:3099/.well-known/relay

Future Extensions

The .well-known/relay document is designed to be extensible. Future versions may include:

  • public_key — Cryptographic identity for authenticated peer connections
  • supported_transports — WebSocket, QUIC, WebRTC
  • location — Geo-location hint for latency-aware peer selection
  • trust_score — Reputation metrics for anti-spam