This is not the first time someone has gotten PG running in a browser though. Here's another approach:
https://github.com/oguimbal/pg-mem