> ## Documentation Index
> Fetch the complete documentation index at: https://ngquct-docs-fix-500-query-results.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# PGlite

> Connect to a PGlite database over its socket server using the PostgreSQL wire protocol

[PGlite](https://pglite.dev) is PostgreSQL 17 compiled to WebAssembly, and it runs inside a JavaScript process instead of listening on a socket of its own. Nothing can reach it until you start `@electric-sql/pglite-socket` yourself. After that the connection is ordinary [PostgreSQL](/databases/postgresql), served by the same driver, with the same introspection, DDL, and EXPLAIN, and nothing extra to install.

<Frame caption="The PGlite connection form pointed at a running socket server">
  <img className="block dark:hidden" src="https://mintcdn.com/ngquct-docs-fix-500-query-results/HJY892UtvXUv1PFn/images/pglite-connection-form.png?fit=max&auto=format&n=HJY892UtvXUv1PFn&q=85&s=03f716c66d15a81e7c3754c6032708f7" alt="PGlite connection form" width="1560" height="960" data-path="images/pglite-connection-form.png" />

  <img className="hidden dark:block" src="https://mintcdn.com/ngquct-docs-fix-500-query-results/HJY892UtvXUv1PFn/images/pglite-connection-form-dark.png?fit=max&auto=format&n=HJY892UtvXUv1PFn&q=85&s=43c9e011e3a39ddafc65d973698e72d6" alt="PGlite connection form" width="1560" height="960" data-path="images/pglite-connection-form-dark.png" />
</Frame>

## Start the socket server

It listens on `127.0.0.1:5432` unless `--port` says otherwise. Leave it running for as long as the connection is open.

```bash theme={null}
# In-memory database, gone when the server stops
npx @electric-sql/pglite-socket

# Persist to a data directory
npx @electric-sql/pglite-socket --db=./my-pgdata
```

## Connection settings

| Field        | Default     | Notes                                                  |
| ------------ | ----------- | ------------------------------------------------------ |
| **Host**     | `127.0.0.1` | The socket server binds loopback IPv4, not `localhost` |
| **Port**     | `5432`      | Match the server's `--port`                            |
| **Database** | `postgres`  | The single database PGlite exposes                     |
| **Username** | `postgres`  | Trust auth; any username connects                      |

The socket server never checks a password, so the form has no password field, and it has no TLS, so SSL Mode is fixed to Disabled. Fill in the form and click **Save & Connect**.

## Connection URL

```text theme={null}
pglite://postgres@127.0.0.1:5432/postgres
```

See [Connection URL Reference](/connections/urls) for all parameters.

## What you get

Real PostgreSQL 17, so `pg_catalog` and `information_schema` are complete: table and view definitions, indexes, foreign keys, structure editing, and the visual `EXPLAIN` and `EXPLAIN ANALYZE` plan tree all behave as they do on a server. The default schema is `public`, and `postgres` is the only entry in the `Cmd+K` database list.

## Limitations

* One connection at a time. A second client, or a second TablePro window on the same server, is refused: close the other one first.
* No cross-database tabs. A tab bound to a database the connection is not on refuses to run and names that database instead of guessing.
* Cancel has no effect. `Cmd+.` returns without stopping anything and the query runs to completion, so keep exploratory queries small.
* No TLS. SSL Mode is fixed to Disabled, and the SSH, Cloudflare Tunnel, and SOCKS panes do not apply.

## Troubleshooting

**Can't reach a PGlite socket server**: nothing is listening at that address. Start it with `npx @electric-sql/pglite-socket`, and check the host is `127.0.0.1` rather than `localhost`, which can resolve to IPv6 first.

**Too many connections**: something else is already talking to the socket server. Close that client and connect again.
