You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10-3Lines changed: 10 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,16 +3,19 @@
3
3
A WebSocket-TCP proxy that enables PostgreSQL clients to connect to a Postgres database running in the browser. Designed to work with [PGlite](https://pglite.dev/), a lightweight embeddable Postgres that runs in WebAssembly.
4
4
5
5
This allows you to:
6
+
6
7
- Use standard PostgreSQL clients (psql, pgAdmin, [Drizzle Studio](https://orm.drizzle.team/drizzle-studio/overview), etc.) to connect to a browser-based database
7
8
- Use tools like `pg_dump` to backup your database
8
9
9
10
## How it Works
10
11
11
12
The proxy creates two servers:
13
+
12
14
1. A WebSocket server that communicates with the database instance in the browser
13
15
2. A TCP server that accepts standard PostgreSQL client connections
14
16
15
17
When a PostgreSQL client connects to the TCP server, the proxy:
18
+
16
19
1. Forwards the client's messages to the browser through WebSocket
17
20
2. Returns the browser's responses back to the client through TCP
18
21
@@ -32,16 +35,19 @@ bun add pg-browser-proxy
32
35
### 2. Start the Proxy
33
36
34
37
Using bunx:
38
+
35
39
```sh
36
40
bunx pg-browser-proxy
37
41
```
38
42
39
43
To use custom ports:
44
+
40
45
```sh
41
46
bunx pg-browser-proxy -t 5433 -w 8080
42
47
```
43
48
44
49
See all options:
50
+
45
51
```sh
46
52
bunx pg-browser-proxy -h
47
53
```
@@ -55,7 +61,7 @@ import { PGliteWorker } from "@electric-sql/pglite/worker";
0 commit comments