/pgress

Native PostgreSQL JavaScript client library for web browsers

Primary LanguageTypeScriptMIT LicenseMIT

pgress

Introduction

‘Native’ PostgreSQL client in JavaScript for direct connection via WebSocket. This API hasn’t been locked down. The code probably has major bugs. Exposing your PostgreSQL database to the Internet can be a really bad idea.

var conn = new pg.PGState("ws://myserver/postgres-ws", "mydb", "myuser", "SomePassword");

await conn.connect();

var nowTime = await conn.simpleQuery("select now();");
console.log("time is:", nowTime);

Caveats

  • Only use this if you know what you’re doing.
  • Only supports client-side MD5 password hashes.
  • Requires a WebSocket proxy (e.g. websockify) between the browser and PostgreSQL.
  • Should be used with TLS/SSL over unprotected networks.