I built a safe PostgreSQL driver for node from scratch with zero dependencies in about 1200 lines. I did this mostly because of the plumbing required to make the goto node driver tolerable to work with. In the process I made it 4-5 times faster as well. https://github.com/porsager/postgres
Very nice! I'd ditch pg-promise in a heartbeat for something simpler. I kinda dislike the tagged template literal helpers magic. I'd be more comfortable with explicit references to substituted arguments. Though it seems like I can just use the unsafe api all the time for that. The rest of the API is very nice, .stream, .cursor, notify support, all that.
I'm curious - What's the reason you don't like the tagged template literal? It's those that give you implicit safe parameters and let's you avoid doing parameter counting when writing queries.