Skip to content

hzrd149/primal-server

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Logo

Overview

Primal Server includes caching, membership, discovery and media caching services for Nostr. It connects to the specified set of relays, collects all events in real time, stores them locally, and makes them available to nostr clients through a web socket-based API.

Usage

Setup database server:

nix develop -c sh -c '$setup_postgres $PWD/var/pg $PWD/var/pgdata'

Setup pg_primal (Primal database extension):

nix develop -c sh -c '$setup_pg_primal'

Setup other database extensions:

nix develop -c sh -c '$setup_pg_extensions'

Start database in the background:

nix develop -c sh -c '$start_postgres'

Initialize database schema:

nix develop -c sh -c '$init_postgres_schema'

Start the Primal server:

nix develop -c sh -c '$start_primal_server'

Finally, open any Primal application and on network settings screen connect to cache server at:

ws://127.0.0.1:8801

Enjoy self-hosted Nostr cache server.

API requests

Read app_*.jl for list of all supported arguments.

Examples:

["REQ", "amelx49c18", {"cache": ["net_stats"]}]
["CLOSE", "amelx49c18"]

["REQ", "p0xren2axa", {"cache": ["feed", {"pubkey": "64-hex digits of pubkey id"}]}]

["REQ", "vqvv4vc6us", {"cache": ["thread_view", {"event_id": "64-hex digits of event id"}]}]

["REQ", "ay4if6pykg", {"cache": ["user_infos", {"pubkeys": ["64-hex digits of pubkey id"]}]}]

["REQ", "2t6z17orjp", {"cache": ["events", {"event_ids": ["64-hex digits of event id"]}]}]

["REQ", "1uddc0a2fv", {"cache": ["user_profile", {"pubkey": "64-hex digits of pubkey id"}]}]

About

Primal Server includes membership, discovery and media caching services for Nostr

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Julia 63.3%
  • PLpgSQL 22.6%
  • Rust 12.5%
  • C 0.9%
  • Nix 0.4%
  • Python 0.2%
  • Other 0.1%