diff --git a/.changeset/docs-naming-consistency.md b/.changeset/docs-naming-consistency.md new file mode 100644 index 000000000..a845151cc --- /dev/null +++ b/.changeset/docs-naming-consistency.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/CONFIGURATION.md b/CONFIGURATION.md index 5a2e6b372..2f7412703 100644 --- a/CONFIGURATION.md +++ b/CONFIGURATION.md @@ -244,11 +244,11 @@ The settings below are listed in alphabetical order by name. Please keep this ta | nip77.maxEventsPerSession | Most events one session may cover. A `NEG-OPEN` whose filter matches more is rejected with `NEG-ERR blocked:` (clients should split the sync into `since`/`until` windows). The filter's `limit` is ignored, since reconciliation needs the whole set. Defaults to 100000. | | nip77.maxSessionsPerConnection | Concurrent negentropy sessions one websocket connection may hold; opening an id that is already open replaces it. Further `NEG-OPEN`s are rejected with `NEG-ERR blocked:`. Defaults to 3. | | nip77.sessionIdleTimeoutMs | A session that receives no `NEG-MSG` for this many milliseconds is closed with `NEG-ERR closed:`. Defaults to 60000. | -| paymentProcessors.lnbits.baseURL | Base URL of your Lnbits instance. | -| paymentProcessors.lnbits.callbackBaseURL | Public-facing Nostream's Lnbits Callback URL. (e.g. https://relay.your-domain.com/callbacks/lnbits) | +| paymentProcessors.lnbits.baseURL | Base URL of your LNbits instance. | +| paymentProcessors.lnbits.callbackBaseURL | Public-facing nostream's LNbits Callback URL. (e.g. https://relay.your-domain.com/callbacks/lnbits) | | paymentProcessors.lnurl.invoiceURL | [LUD-06 Pay Request](https://github.com/lnurl/luds/blob/luds/06.md) provider URL. (e.g. https://getalby.com/lnurlp/your-username) | | paymentProcessors.zebedee.baseURL | Zebedee's API base URL. | -| paymentProcessors.zebedee.callbackBaseURL | Public-facing Nostream's Zebedee Callback URL (e.g. https://relay.your-domain.com/callbacks/zebedee) | +| paymentProcessors.zebedee.callbackBaseURL | Public-facing nostream's Zebedee Callback URL (e.g. https://relay.your-domain.com/callbacks/zebedee) | | paymentProcessors.zebedee.ipWhitelist | List with Zebedee's API Production IPs. See [ZBD API Documentation](https://api-reference.zebedee.io/#c7e18276-6935-4cca-89ae-ad949efe9a6a) for more info. | | payments.enabled | Enabled payments. Defaults to false. | | payments.feeSchedules.admission[].amount | Admission fee amount in msats. | @@ -280,11 +280,11 @@ The settings below are listed in alphabetical order by name. Please keep this ta | nip05.mode | NIP-05 verification mode: `enabled` requires verification, `passive` verifies without blocking, `disabled` does nothing. Defaults to `disabled`. | | nip05.verifyExpiration | Time in milliseconds before a successful NIP-05 verification expires and needs re-checking. Defaults to 604800000 (1 week). | | nip05.verifyUpdateFrequency | Minimum interval in milliseconds between re-verification attempts for a given author. Defaults to 86400000 (24 hours). | -| paymentProcessors.lnbits.baseURL | Base URL of your Lnbits instance. | -| paymentProcessors.lnbits.callbackBaseURL | Public-facing Nostream's Lnbits Callback URL. (e.g. https://relay.your-domain.com/callbacks/lnbits) | +| paymentProcessors.lnbits.baseURL | Base URL of your LNbits instance. | +| paymentProcessors.lnbits.callbackBaseURL | Public-facing nostream's LNbits Callback URL. (e.g. https://relay.your-domain.com/callbacks/lnbits) | | paymentProcessors.lnurl.invoiceURL | [LUD-06 Pay Request](https://github.com/lnurl/luds/blob/luds/06.md) provider URL. (e.g. https://getalby.com/lnurlp/your-username) | | paymentProcessors.zebedee.baseURL | Zebedee's API base URL. | -| paymentProcessors.zebedee.callbackBaseURL | Public-facing Nostream's Zebedee Callback URL (e.g. https://relay.your-domain.com/callbacks/zebedee) | +| paymentProcessors.zebedee.callbackBaseURL | Public-facing nostream's Zebedee Callback URL (e.g. https://relay.your-domain.com/callbacks/zebedee) | | paymentProcessors.zebedee.ipWhitelist | List with Zebedee's API Production IPs. See [ZBD API Documentation](https://api-reference.zebedee.io/#c7e18276-6935-4cca-89ae-ad949efe9a6a) for more info. | | payments.enabled | Enabled payments. Defaults to false. | | payments.feeSchedules.admission[].amount | Admission fee amount in msats. | diff --git a/README.md b/README.md index 29257f5be..29f286f1a 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ GitHub release - GitHub issues + GitHub issues GitHub stars @@ -33,7 +33,7 @@

This is a [nostr](https://github.com/fiatjaf/nostr) relay, written in -Typescript. Documentation, features and guides live on the project website: +TypeScript. Documentation, features and guides live on the project website: **[nostream.dev](https://nostream.dev)**. This implementation is production-ready. See below for supported features. @@ -100,7 +100,7 @@ NIPs and MIPs with a relay-specific implementation are listed here. - PostgreSQL 14.0 - Redis - Node v24 -- Typescript +- TypeScript ### Docker setups - Docker v20.10 diff --git a/docs/OPERATIONS.md b/docs/OPERATIONS.md index c20d5ec22..f05b1d118 100644 --- a/docs/OPERATIONS.md +++ b/docs/OPERATIONS.md @@ -4,8 +4,6 @@ Running, backing up and maintaining a relay after it is set up. ## Running as a service -By default this server will run continuously until you stop it with Ctrl+C or until the system restarts. - To have it start again whenever the system restarts, install it as a systemd service. For example: ``` @@ -15,7 +13,7 @@ $ nano /etc/systemd/system/nostream.service # "/home/nostr/nostream" with the directory where you cloned the repo. [Unit] -Description=Nostr TS Relay +Description=nostream After=network.target StartLimitIntervalSec=0 diff --git a/docs/PAYMENTS.md b/docs/PAYMENTS.md index 5b7573568..1f42a850f 100644 --- a/docs/PAYMENTS.md +++ b/docs/PAYMENTS.md @@ -28,8 +28,8 @@ Each processor step ends with `nostream stop` and `nostream start`, which is the - Follow the required steps for all payments processors - On `.nostr/settings.yaml` file make the following changes: - `payments.processor` to `zebedee` - - `paymentsProcessors.zebedee.callbackBaseURL` to match your Nostream URL (e.g. `https://{YOUR_DOMAIN_HERE}/callbacks/zebedee`) - - Restart Nostream (`nostream stop` followed by `nostream start`) + - `paymentsProcessors.zebedee.callbackBaseURL` to match your nostream URL (e.g. `https://{YOUR_DOMAIN_HERE}/callbacks/zebedee`) + - Restart nostream (`nostream stop` followed by `nostream start`) - Read the in-depth guide for more information: [Set Up a Paid Nostr Relay with ZEBEDEE API](https://docs.zbdpay.com/payments/nostr/nostr-relay) 3. Nodeless @@ -47,7 +47,7 @@ Each processor step ends with `nostream stop` and `nostream start`, which is the - On your `.nostr/settings.yaml` file make the following changes: - Set `payments.processor` to `nodeless` - Set `paymentsProcessors.nodeless.storeId` to your store ID - - Restart Nostream (`nostream stop` followed by `nostream start`) + - Restart nostream (`nostream stop` followed by `nostream start`) 4. [OpenNode](https://www.opennode.com/) - Complete the step "Before you begin" @@ -62,10 +62,10 @@ Each processor step ends with `nostream stop` and `nostream start`, which is the - On your `.nostr/settings.yaml` file make the following changes: - Set `payments.processor` to `opennode` - - Set `paymentsProcessors.opennode.callbackBaseURL` to match your Nostream URL (e.g. `https://{YOUR_DOMAIN_HERE}/callbacks/opennode`) - - Restart Nostream (`nostream stop` followed by `nostream start`) + - Set `paymentsProcessors.opennode.callbackBaseURL` to match your nostream URL (e.g. `https://{YOUR_DOMAIN_HERE}/callbacks/opennode`) + - Restart nostream (`nostream stop` followed by `nostream start`) -5. [LNBITS](https://lnbits.com/) +5. [LNbits](https://lnbits.com/) - Complete the step "Before you begin" - Create a new wallet on you public LNbits instance - [Demo](https://legend.lnbits.com/) server must not be used for production @@ -79,16 +79,16 @@ Each processor step ends with `nostream stop` and `nostream start`, which is the - On your `.nostr/settings.yaml` file make the following changes: - Set `payments.processor` to `lnbits` - set `paymentsProcessors.lnbits.baseURL` to your LNbits instance URL (e.g. `https://{YOUR_LNBITS_DOMAIN_HERE}/`) - - Set `paymentsProcessors.lnbits.callbackBaseURL` to match your Nostream URL (e.g. `https://{YOUR_DOMAIN_HERE}/callbacks/lnbits`) - - Restart Nostream (`nostream stop` followed by `nostream start`) + - Set `paymentsProcessors.lnbits.callbackBaseURL` to match your nostream URL (e.g. `https://{YOUR_DOMAIN_HERE}/callbacks/lnbits`) + - Restart nostream (`nostream stop` followed by `nostream start`) -6. [Alby](https://getalby.com/), or another LNURL-pay provider that serves its callback at `/callback`. That path is a Nostream requirement, not something [LUD-06](https://github.com/lnurl/luds/blob/luds/06.md) guarantees, since a provider may advertise any callback it likes. [LNURL-verify](https://github.com/lnurl/luds/issues/182) support is also needed +6. [Alby](https://getalby.com/), or another LNURL-pay provider that serves its callback at `/callback`. That path is a nostream requirement, not something [LUD-06](https://github.com/lnurl/luds/blob/luds/06.md) guarantees, since a provider may advertise any callback it likes. [LNURL-verify](https://github.com/lnurl/luds/issues/182) support is also needed - Complete the step "Before you begin" - [Create a new account](https://getalby.com/) if you don't have an LNURL - On your `.nostr/settings.yaml` file make the following changes: - Set `payments.processor` to `lnurl` - Set `paymentsProcessors.lnurl.invoiceURL` to your LNURL-pay address up to but excluding `/callback` (e.g. `https://getalby.com/lnurlp/your-username`, with your own username) - - Restart Nostream (`nostream stop` followed by `nostream start`) + - Restart nostream (`nostream stop` followed by `nostream start`) 7. Nostr Wallet Connect (NIP-47 / NWC) - Complete the step "Before you begin" @@ -102,7 +102,7 @@ Each processor step ends with `nostream stop` and `nostream start`, which is the - On your `.nostr/settings.yaml` file make the following changes: - Set `payments.processor` to `nwc` - - Restart Nostream (`nostream stop` followed by `nostream start`) + - Restart nostream (`nostream stop` followed by `nostream start`) 8. Ensure payments are required for your public key - Visit https://{YOUR-DOMAIN}/ diff --git a/docs/REDIS.md b/docs/REDIS.md index ff0767e27..c9127f65b 100644 --- a/docs/REDIS.md +++ b/docs/REDIS.md @@ -1,17 +1,17 @@ # Redis -Nostream uses Redis as a cache layer, currently for rate limiting incoming requests. This document covers how to configure Redis to work with Nostream, including the recommended ACL-based setup for production environments. +Nostream uses Redis as a cache layer, currently for rate limiting incoming requests. This document covers how to configure Redis to work with nostream, including the recommended ACL-based setup for production environments. ## Overview Nostream uses Redis 7.0.5 (Alpine 3.16) and connects to it via the `redis` npm package (v4.5.1). Currently, Redis is used exclusively for rate limiting — throttling incoming requests from clients to prevent abuse. The Redis client is initialized as a singleton instance in `src/cache/client.ts`, meaning a single connection is shared across the entire application. This connection is wrapped by a `RedisAdapter` which exposes only the specific Redis operations -Nostream needs. +nostream needs. -Rate limiting is implemented using a sliding window strategy, which uses Redis sorted sets to track request timestamps. This allows Nostream to accurately enforce rate limits over a rolling time window rather than a fixed one, preventing clients from bursting requests at window boundaries. +Rate limiting is implemented using a sliding window strategy, which uses Redis sorted sets to track request timestamps. This allows nostream to accurately enforce rate limits over a rolling time window rather than a fixed one, preventing clients from bursting requests at window boundaries. -When Redis is temporarily unavailable, Nostream keeps serving the relay and admin HTTP endpoints and treats rate-limiter Redis failures as fail-closed (events are rejected as rate-limited when the backend cannot be consulted). Admin health degrades accordingly (`redis.ok=false`), so operators can detect and recover Redis without taking the relay offline. +When Redis is temporarily unavailable, nostream keeps serving the relay and admin HTTP endpoints and treats rate-limiter Redis failures as fail-closed (events are rejected as rate-limited when the backend cannot be consulted). Admin health degrades accordingly (`redis.ok=false`), so operators can detect and recover Redis without taking the relay offline. ## Requirements @@ -24,7 +24,7 @@ If you are using your own Redis instance instead of the one provided by Docker C ### Default Setup -By default, Nostream connects to Redis using a single password on the default user via the `--requirepass` flag. This is configured in `docker-compose.yml`: +By default, nostream connects to Redis using a single password on the default user via the `--requirepass` flag. This is configured in `docker-compose.yml`: ```yaml command: redis-server --loglevel warning --requirepass nostr_ts_relay @@ -46,7 +46,7 @@ REDIS_PASSWORD=nostr_ts_relay ### ACL Setup (Recommended) -Redis ACL (Access Control List), introduced in Redis 6.0, allows you to create restricted users that can only execute specific commands. This is recommended for production environments as it follows the principle of least privilege — Nostream only gets access to the commands it actually needs. +Redis ACL (Access Control List), introduced in Redis 6.0, allows you to create restricted users that can only execute specific commands. This is recommended for production environments as it follows the principle of least privilege — nostream only gets access to the commands it actually needs. #### Required Commands