1. Strfry Relay Bridge (fleetmesh-strfry)

fleetmesh-strfry is the high-performance relay bridge connecting a Fleetmesh node to a local or remote [strfry](https://github.com/hoytech/strfry) Nostr relay.

Fleetmesh Logo

1.1. Overview & Purpose

While Fleetmesh nodes maintain an embedded SQLite event store and direct peer-to-peer transports (Iroh QUIC, FIPS/DoD rungs), production public gateways and community nodes frequently front high-concurrency public WebSocket traffic. strfry is a C++20 Nostr relay engine backed by LMDB, capable of handling millions of concurrent subscribers and sustained write throughput.

The fleetmesh-strfry package bridges these two worlds:

  • Bi-directional Relay Synchronization: Subscribes to an active strfry relay instance over WebSockets, verifies incoming events against Fleetmesh acceptance policies, writes them to the node’s store.sqlite, and publishes the node’s egress events to strfry.

  • Queue Draining on Every Tick: Egress events that cannot be delivered immediately are queued in memory and safely drained on each node event loop tick or via explicit flush commands.

  • Deep Write Policy Enforcement: Implements the strfry write-policy plugin protocol over stdin/stdout, enforcing cryptographic signatures, clock skew limits, NIP-40 expiration, rate limits, and optional bilateral peering grant validation against the node’s grants.sqlite.

  • Bulk Data Migration (StrfryPipe): Facilitates streaming JSONL export and import between the node’s SQLite eventstore and strfry’s native LMDB database.

1.2. Package Architecture

fleetmesh-strfry relies solely on the Python standard library. It imports the node package at runtime (node.eventstore, node.grants, fleetmesh_node.keystore, node.relay, fleetmesh_node.compartment) and, through it, fleetmesh_core and fleetmesh_schema:

Module

Primary Responsibility

fleetmesh_strfry.bridge

StrfryRelayBridge: WebSocket client handling live subscription, ingestion, and queued egress publishing.

fleetmesh_strfry.policy

StrfryPolicyEngine and StrfryPluginRunner: Write-policy plugin for strfry, enforcing protocol rules and grant checks.

fleetmesh_strfry.pipe

StrfryPipe: Streaming JSONL bulk pipeline connecting strfry export/import with node event stores.

fleetmesh_strfry.plugin

StrfryBridgePlugin: Node compartment integration, enabling in-process lifecycle management and CLI verbs.

1.3. Runtime Environment

The package runs directly on the node host alongside the other Fleetmesh checkouts:

# Example PYTHONPATH setup on a deployment host
export PYTHONPATH=/opt/fleetmesh/strfry-bridge:/opt/fleetmesh/meshnode:/opt/fleetmesh/core:/opt/fleetmesh/schema

1.4. Installation

fleetmesh-strfry can be installed in editable mode or as a standard package:

cd strfry-bridge
pip install -e .

1.5. Subsystems & Documentation

Document

Description

Operational Modes & Deployment

Operational modes: in-process compartment plugin (Mode 1) and standalone service daemon (Mode 2).

Write Policy Engine & Grant Enforcement

Strfry write-policy plugin protocol, verification gates, and bilateral peering grant enforcement.

Bulk Data Synchronization (StrfryPipe)

Bulk data synchronization pipeline between SQLite eventstore and strfry LMDB.

Python API Reference (fleetmesh_strfry)

Python API reference with autodoc documentation for all modules.