Nostr Relay Framework -- use it to implement your own custom relay. There is an example/reference implementation at basic. Binaries for that are also available under Releases.