revolution/laravel-nostr
Laravel package for working with Nostr: generate and manage keypairs, create and sign events, publish to relays, verify signatures, and handle NIP-05 identifiers. Provides facades and configuration for adding decentralized social features to Laravel apps.
Architecture fit. The package follows conventional Laravel packaging (service provider, facade, publishable config), so it slots into an existing application with almost no friction. The fit problem is at the protocol layer, not the framework layer. Nostr is a WebSocket/push protocol built around persistent relay subscriptions; Laravel's default FPM request/response lifecycle has no natural home for that. Expect the package to be genuinely useful for stateless primitives — keypair generation, event construction, Schnorr signing, signature verification, one-shot publish — and to be a poor fit for long-lived REQ subscriptions unless the host app already runs Octane/Swoole or a dedicated daemon worker. This is the single most important architectural question to settle before committing.
Integration feasibility. MIT-licensed, Composer-installable, small surface area. Installation is a non-event. The real integration work sits outside the package: relay selection and redundancy, private key custody, async worker topology, and container image changes for secp256k1 signing (native extension or pure-PHP fallback — either way, verify against the base image and confirm performance characteristics under load).
Technical risk. High, and concentrated in ecosystem validation rather than code quality. Three stars, zero dependents, and a 0.015 score mean essentially no peer review, no production evidence, and a single-maintainer bus factor. Protocol risk compounds this: NIPs evolve continuously, and a July 2025 release will lag the spec frontier. The security blast radius is not cosmetic — a defect in signature verification means accepting forged events, and a defect in key handling means irreversible identity compromise. Nostr has no practical key rotation for an established identity, which turns any custody bug into a permanent one.
Key questions to put to engineering before approval.
nostr-php, and at which pinned version? Where does the crypto boundary actually sit?nsec material to the caller?Stack fit. Best case is a Laravel 10+ application on Octane or Swoole, where a resident worker can hold relay connections. Standard FPM deployments remain viable if the publish path is fire-and-forget and subscriptions are pushed into a dedicated artisan daemon or queue-driven ingestion service. Treat the "listen to relays" capability as a separate deployable concern from day one rather than something bolted onto web requests.
Migration path. With zero dependents there is almost certainly no incumbent to migrate from, which is an advantage — no legacy contract to honor. The discipline to impose is an anti-corruption layer: define an internal NostrClient interface and implement it with a thin adapter over this package. No facade calls in domain code, no package types in public signatures. That single decision converts the vendor risk from existential into a swap cost of a few days, with raw nostr-php, a Node/nostr-tools sidecar, or your own fork as fallbacks.
Compatibility. Pin to an exact version, not a caret range. Review composer.json for PHP and Laravel version constraints and for extension requirements before they surface as a build failure. Given the bus factor, plan to vendor the source or maintain an internal fork from the first commit — retrofitting a fork after you have dependent code is significantly more expensive.
Sequencing. (1) Timeboxed spike against public relays in read-only mode to validate the protocol model and the package's ergonomics. (2) Key custody design — encrypted casts, KMS/Vault, or an external signer — ahead of any write path. (3) Signing and verification unit tests against known vectors, independent of the package's own suite. (4) Publish path to two or three relays with retry and idempotency. (5) Subscription ingestion as a separate worker. (6) Observability, backoff, and runbooks. Do not let step 4 precede step 2.
Maintenance. Assume ownership on day one. Budget a standing line item for fork maintenance, a quarterly upstream review, and a CVE/dependency triage path. A single-maintainer package with no downstream users means you are the de facto maintainer whether or not you intended to be.
Support. No commercial support and no meaningful community depth in the Laravel-adjacent corner of the Nostr ecosystem. Internal documentation is mandatory, particularly around relay behavior and key handling, because external references will be thin and stale.
Scaling. Cost scales with relay fan-out, not request volume: each relay is an independent connection, rate-limit domain, and failure surface. Event storage needs deduplication on event ID and idempotent writes. Signing is CPU-bound but cheap per event. The scaling risk is not throughput — it is subscription count growing unbounded and relay backoff logic being absent.
Failure modes to design for. Relays going dark or silently dropping events; partial propagation across relays producing an inconsistent read view; malformed or forged events reaching storage if verification is not enforced; key compromise, which is unrecoverable in practice; replay of signed events; worker crashes silently losing subscriptions with no catch-up; and rate-limit responses that the package may surface as generic transport errors.
Ramp-up. The package is small enough to learn in an afternoon. Nostr itself is not — event model, identity/keys, and NIP semantics are an unfamiliar domain for most Laravel teams. Plan for days of domain ramp-up, not hours, and staff it with someone who will own the protocol questions rather than just the integration.
Net assessment. Reasonable for a bounded pilot, internal tooling, or a read-mostly publishing integration where an outage is tolerable and the interface is properly isolated. Not appropriate, as-is, for a business-critical path with custody of a long-lived identity — that use case requires the fork, the external signer, and the verification tests before it ships.
How can I help you explore Laravel packages today?