I have never had so much fun building a library then I have had building applesauce-relay. At its core it's 600 lines of RxJS observable code, which is almost completely stateless and very nuanced.
I've had to write a lot of tests to ensure it behaves correctly. But that makes me very confident it's the best JavaScript Nostr library there is.