PGlite is fantastic. I use it for my in-browser PostgreSQL server for development. It implements the PG protocol on the server; when clients connect, we forward queries to the user's browser, which runs PGlite under the hood.
The result is a PG server that fully lives in your browser: https://dbfor.dev
PGlite is embedded so you can't really connect to PGlite using the PG clients. Dbfor.dev runs the PG protocol in the server and use Websockets & PGlite so any PG client can connect to your browser using PG protocol.
The hard work is done by PGlite and we use PGlite, it just enables PGlite to be accessible from everywhere.
The result is a PG server that fully lives in your browser: https://dbfor.dev