Home

Awesome

Nostring

Nostr relay written in Deno.

You can easily host a relay by Deno Deploy and Bit.io.

Features

Usage

Configure you environments or create a .env file. More details are below.

And then:

deno run --allow-net --allow-read --allow-env \
  https://deno.land/x/nostring/scripts/start.ts

Or you can clone this repo and start manually:

git clone https://github.com/xbol0/nostring
cd nostring
deno task start

Environment configuration

NameRequiredDescriptionDefault
DB_URLyesPostgreSQL connect URL
PORTnoHTTP server listen port9000
DB_POOL_SIZEnoDatabase client connection pool size3
RELAY_NAMEno, recommandedNIP-11 Relay namenostring
RELAY_DESCnoNIP-11 Relay desciption
ADMIN_PUBKEYno, recommandedNIP-11 Relay admin pubkey, hex encoding. Would be used for bot if enabled.
RELAY_COUNTRIESnoNIP-11 Relay countries
ENABLE_BROADCASTCHANNELnoEnable BraodcastChannel on Deno Deploy
ENABLE_ALLOW_UNKNOWN_KINDnoEnable save unknown kind events
DISABLE_NIP11noDisable handle NIP-11 request
SPAM_DETECT_PERCENTnoSetup spam filter detect percentage, 0 to disable spam filter0.5
BOT_KEYno, yes if enabled paymentBot private key, in hex encoding, if you enabled payment for relay, you should setup this
BOT_NAMEnoBot nameYou relay's name + 's bot
BOT_AVATARnoBot picturehttps://media-uploader.orzv.workers.dev/pomf2.lain.la/f/m4lnneh4.png
BOT_RELAYno, yes if enabled paymentYou bot relay list
MAX_MESSAGE_LENGTHnoMax message length per websocket send393216 -> 384KB
MAX_SUBSCRIPTIONSnoMax subscriptions per connection32
MAX_FILTERnoMax filters per REQ subscription10
MAX_LIMITnoMax limit per filter500
MAX_SUBID_LENGTHnoMax subscription id length64
MIN_PREFIXnoMin prefix for ids and authors param32
MAX_EVENT_TAGSnoMax tags per event2048
MAX_CONTENT_LENGTHnoMax content length per event102400 -> 100KB
MIN_POW_DIFFICULTYnoMin NIP-13 PoW diffieculty0
AUTH_REQUIREDnoNeed auth for access
PAYMENT_REQUIREDnoNeed pay for access
NIPSnoNIP-11 supported nips1,9,11,12,13,15,16,20,22,26,33,40,42
EVENT_RETENTIONnoNIP-11 event retention, in JSON format[{"kinds":[1,4],"time":31536000,"count":5000},{"kinds":[6,7],"count":10000},{"kinds":[0,2,3],"count":1},{"count":1000}]
EVENT_TIMESTAMP_RANGEnoNIP-22 timestamp accepted range-86400~300 -> one day ago to 5 minites later
BROADCAST_RELAYSnoEvents broadcast to other relays, seperated by comma
WHITELIST_PUBKEYSnoWhitelist pubkeys, seperated by comma
LANGUAGE_TAGSnoNIP-11 language tags
TAGSnoNIP-11 tags
POSTING_POLICYnoNIP-11 posting policy url
PAYMENT_LNURLnoPayment LNURL
FEES_ADMISSIONnoFees for admission, unit sats, eg. 1000,2000,3000
FEES_SUBSCRIPTIONnoFees for subscription, unit sats, eg. 1000/2592000,2000/31536000
FEES_PUBLICATIONnoFees for publication, unit sats, eg. 1,2,3:10,4,10000:100