2022-04-16 23:53:25 +00:00
|
|
|
# [nostr-ts-relay](https://github.com/Cameri/nostr-ts-relay)
|
|
|
|
|
2022-10-19 02:37:20 +00:00
|
|
|
<p align="center">
|
|
|
|
<a href='https://coveralls.io/github/Cameri/nostr-ts-relay?branch=main'><img src='https://coveralls.io/repos/github/Cameri/nostr-ts-relay/badge.svg?branch=main' alt='Coverage Status' /></a>
|
2022-10-19 02:49:14 +00:00
|
|
|
<a href='https://github.com/Cameri/nostr-ts-relay/actions'><img src='https://github.com/Cameri/nostr-ts-relay/actions/workflows/checks.yml/badge.svg?branch=main&event=push' alt='Build status' /></a>
|
2022-10-19 02:37:20 +00:00
|
|
|
</p>
|
|
|
|
|
2022-04-16 23:53:25 +00:00
|
|
|
This is a [nostr](https://github.com/fiatjaf/nostr) relay, written in
|
|
|
|
Typescript.
|
|
|
|
|
2022-10-17 04:35:12 +00:00
|
|
|
This implementation is production-ready. See below for supported features.
|
|
|
|
|
2022-04-16 23:53:25 +00:00
|
|
|
The project master repository is available on [GitHub](https://github.com/Cameri/nostr-ts-relay).
|
|
|
|
|
|
|
|
## Features
|
|
|
|
|
|
|
|
NIPs with a relay-specific implementation are listed here.
|
|
|
|
|
2022-08-13 06:43:32 +00:00
|
|
|
- [x] NIP-01: Basic protocol flow description
|
|
|
|
- [x] NIP-02: Contact list and petnames
|
2022-04-16 23:53:25 +00:00
|
|
|
- [ ] NIP-03: OpenTimestams Attestations for Events
|
2022-08-13 06:43:32 +00:00
|
|
|
- [x] NIP-04: Encrypted Direct Message
|
2022-08-16 04:10:00 +00:00
|
|
|
- [x] NIP-09: Event deletion
|
2022-08-08 13:04:43 +00:00
|
|
|
- [x] NIP-11: Relay information document
|
|
|
|
- [x] NIP-12: Generic tag queries
|
2022-09-22 21:47:57 +00:00
|
|
|
- [x] NIP-13: Proof of Work
|
2022-08-07 07:38:18 +00:00
|
|
|
- [x] NIP-15: End of Stored Events Notice
|
2022-08-13 06:43:32 +00:00
|
|
|
- [x] NIP-16: Event Treatment
|
2022-09-22 21:47:57 +00:00
|
|
|
- [x] NIP-22: Event `created_at` Limits
|
|
|
|
- [x] NIP-26: Delegated Event Signing (DRAFT)
|
2022-04-16 23:53:25 +00:00
|
|
|
|
2022-08-07 22:47:59 +00:00
|
|
|
## Requirements
|
|
|
|
|
|
|
|
- PostgreSQL
|
|
|
|
- Node
|
|
|
|
- Typescript
|
2022-10-17 04:35:12 +00:00
|
|
|
- Docker (optional, version 20 or higher)
|
|
|
|
|
|
|
|
## Quick Start (Docker)
|
2022-08-07 22:47:59 +00:00
|
|
|
|
2022-10-17 04:35:12 +00:00
|
|
|
```
|
|
|
|
npm run docker:compose:up
|
|
|
|
```
|
|
|
|
|
|
|
|
## Quick Start (Standalone)
|
2022-04-16 23:53:25 +00:00
|
|
|
|
2022-08-07 22:47:59 +00:00
|
|
|
Set the following environment variables:
|
|
|
|
|
|
|
|
```
|
|
|
|
DB_HOST=localhost
|
|
|
|
DB_PORT=5432
|
2022-10-17 04:35:12 +00:00
|
|
|
DB_NAME=nostr_ts_relay
|
2022-08-07 22:47:59 +00:00
|
|
|
DB_USER=postgres
|
|
|
|
DB_PASSWORD=postgres
|
|
|
|
```
|
|
|
|
|
2022-10-17 04:35:12 +00:00
|
|
|
Create `nostr_ts_relay` database:
|
2022-08-07 22:47:59 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
$ psql -h $DB_HOST -p $DB_PORT -U $DB_USER -W
|
2022-10-17 04:35:12 +00:00
|
|
|
postgres=# create database nostr_ts_relay;
|
2022-08-07 22:47:59 +00:00
|
|
|
postgres=# quit
|
|
|
|
```
|
|
|
|
|
2022-08-07 07:38:18 +00:00
|
|
|
Install dependencies:
|
|
|
|
|
|
|
|
```
|
2022-10-17 04:35:12 +00:00
|
|
|
npm install -g knex
|
2022-08-07 07:38:18 +00:00
|
|
|
npm install
|
|
|
|
```
|
|
|
|
|
2022-08-07 22:47:59 +00:00
|
|
|
Run migrations:
|
|
|
|
|
|
|
|
```
|
|
|
|
npm run db:migrate
|
|
|
|
```
|
|
|
|
|
2022-10-17 04:35:12 +00:00
|
|
|
Create ~/.nostr folder:
|
|
|
|
|
|
|
|
```
|
|
|
|
mkdir ~/.nostr
|
|
|
|
```
|
|
|
|
|
2022-08-07 07:38:18 +00:00
|
|
|
To start in development mode:
|
|
|
|
|
|
|
|
```
|
|
|
|
npm run dev
|
|
|
|
```
|
2022-04-16 23:53:25 +00:00
|
|
|
|
2022-10-17 04:35:12 +00:00
|
|
|
Or, start in production mode:
|
|
|
|
|
|
|
|
```
|
|
|
|
npm run start
|
|
|
|
```
|
|
|
|
|
2022-04-16 23:53:25 +00:00
|
|
|
## Configuration
|
|
|
|
|
2022-10-17 04:35:12 +00:00
|
|
|
You can change the default folder by setting the `NOSTR_CONFIG_DIR` environment variable to a different path.
|
|
|
|
|
|
|
|
Run nostr-ts-relay using one of the quick-start guides at least once and `~/.nostr/settings.json` will be created.
|
|
|
|
Any changes made to the settings file will be read on the next start.
|
2022-04-16 23:53:25 +00:00
|
|
|
|
|
|
|
## Dev Channel
|
|
|
|
|
|
|
|
For development discussions, please feel free to use the [Nostr Telegram Channel](https://t.me/nostr_protocol).
|
|
|
|
|
|
|
|
## License
|
|
|
|
|
|
|
|
This project is MIT licensed.
|