Files
smirk-backend-core/examples/paid-relay/.env.example
T
jwinterm 9c75bc6bdd docs(examples): operator cookbook + premium-relay spec
examples/: an operator "cookbook" turning the backend's composable knobs
(registration gates, relay write policy, restore policy, feature flags) into
ready-to-run recipes per persona — personal, public-free (what the reference
instance runs), friends, paid-access, community, and paid-relay (the flagship:
free wallet + paid premium Nostr posting). Plus LEGAL_AND_OPS.md, a
not-legal-advice considerations checklist that points operators at their own
counsel and at the project's own published docs as a worked example. Recipes use
placeholders only.

docs/design/premium-relay.md: the premium-relay feature spec (reconciled to the
shipped design — dedicated premium_invoices table, transactional activate).
2026-07-02 17:57:13 -04:00

80 lines
3.1 KiB
Bash

# ── Recipe: paid-relay ───────────────────────────────────────────────────────
# Free wallet (open + PoW) PLUS a paid premium tier for GENERAL Nostr posting to
# your relay. Wallet-functional events (encrypted DMs, tips, swap coordination)
# stay FREE for registered users; premium unlocks general posting. This is the
# flagship monetization recipe — recurring revenue tied to a real service.
#
# ⚠️ Running a relay means hosting user content — read ../LEGAL_AND_OPS.md
# (DMCA designated agent + NCMEC reporting + acceptable-use + moderation).
#
# Start from ../../.env.example and apply the lines below. openssl rand -hex 32
# for each secret.
# ─────────────────────────────────────────────────────────────────────────────
SERVER_HOST=127.0.0.1
SERVER_PORT=8081
PUBLIC_API_URL=https://api.your-domain.example/api/v1
ENVIRONMENT=production
INSTANCE_ID=paid-relay-1
DATABASE_URL=postgresql:///smirk_v3_db?host=/var/run/postgresql
# Secrets (REQUIRED; openssl rand -hex 32 each).
JWT_SECRET=
SEED_FINGERPRINT_PEPPER=
REFRESH_TOKEN_PEPPER=
IP_SALT=
ALTCHA_HMAC_KEY=
ADMIN_KEY_INTEGRITY_SECRET=
# ── Free registration, PoW-gated (wallet use is always free) ──
POW_REQUIRED=true
REGISTRATION_REQUIRE_INVITE=false
REGISTRATION_REQUIRE_PAYMENT=false
# ── Relay ON, premium-post policy ──
RELAY_ENABLED=true
RELAY_MODE=bundled
RELAY_URL=wss://relay.your-domain.example
RELAY_WRITE_POLICY=premium-post
# Blunt cross-ecosystem DM spam (inbound gift-wraps from non-registered authors).
RELAY_INBOUND_POW_BITS=8
RELAY_ADMISSION_BIND=127.0.0.1:8090
# Shared-box resource governance — the relay runs beside the wallet backend + LWS.
# Also cap connections / subscriptions / ingest rate in the nostr-rs-relay config
# (see deploy/relay); move to RELAY_MODE=external on its own box if load climbs.
RELAY_MAX_EVENT_BYTES=65536
RELAY_RETENTION_DAYS=30
# ── Premium tier: tiered discount plans (id:days:amount), reusing the processor ──
PREMIUM_ENABLED=true
# Price currency: a fiat code the processor converts (so "5" = $5, paid in any coin
# your processor offers), or a specific coin (then amounts are in that coin).
PREMIUM_CURRENCY=USD
PREMIUM_PLANS=quarter:90:5,halfyear:182:9,year:365:15
# Payment processor (BTCPay-compatible; also serves xmrcheckout/wowcheckout). The
# backend only READS invoice status — it never holds funds. Invoices are paid
# directly to YOUR wallet.
PAYMENT_PROVIDER=btcpay
PAYMENT_PROVIDER_URL=https://pay.your-domain.example
PAYMENT_STORE_ID=your-store-id
PAYMENT_API_KEY=your-processor-api-key
PAYMENT_CONFIRMATIONS=1
PAYMENT_EXPIRES_MINUTES=60
# Prices on; tips parked; admin plane optional.
FEATURE_PRICES=true
FEATURE_TIPS=false
ADMIN_ENABLED=false
# Chain endpoints — see ../../.env.example (XMR/WOW LWS + daemon, GRIN_*, electrum).
XMR_LWS_URL=
XMR_LWS_ADMIN_URL=
XMR_LWS_ADMIN_KEY=
XMR_DAEMON_URL=
WOW_LWS_URL=
WOW_LWS_ADMIN_URL=
WOW_LWS_ADMIN_KEY=
WOW_DAEMON_URL=