-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
136 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,37 @@ | ||
# What is PGlite | ||
|
||
PGlite is a WASM Postgres build packaged into a TypeScript/JavaScript client library that enables you to run Postgres in the browser, Node.js and Bun, with no need to install any other dependencies. It's under 3mb gzipped, and has support for many [Postgres extensions](../extensions/), including [pgvector](../extensions/#pgvector). | ||
PGlite is a WASM Postgres build packaged into a TypeScript/JavaScript client library, that enables you to run Postgres in the browser, Node.js and Bun, with no need to install any other dependencies. It's under 3mb Gzipped, and has support for many [Postgres extensions](../extensions/), including [pgvector](../extensions/#pgvector). | ||
|
||
Unlike previous "Postgres in the browser" projects, PGlite does not use a Linux virtual machine - it is simply Postgres in WASM. | ||
Getting started with PGlite is simple: just install and import the NPM package, then create your embedded database: | ||
|
||
It's being developed by [ElectricSQL](https://electric-sql.com/) for our use case of embedding into applications, either locally or at the edge, allowing users to sync a subset of their Postgres database. | ||
```js | ||
import { PGlite } from "@electric-sql/pglite"; | ||
|
||
However, there are many more use cases for PGlite beyond it's use as an embedded application databases: | ||
const db = new PGlite(); | ||
await db.query("select 'Hello world' as message;"); | ||
// -> { rows: [ { message: "Hello world" } ] } | ||
``` | ||
|
||
- Unit and CI testing<br> | ||
PGlite is very fast to start and tare down, perfect for unit tests, you can a unique fresh Postgres for each test. | ||
It can be used as an ephemeral in-memory database, or with persistence either to the file system (Node/Bun), or indexedDB (Browser). | ||
|
||
- Local development<br> | ||
You can use PGlite as an alternative to a full local Postgres for local development, masivly simplifyinf your development environmant. | ||
Unlike previous "Postgres in the browser" projects, PGlite does not use a Linux virtual machine - it is simply Postgres in WASM. | ||
|
||
- Remote development, or local web containers<br> | ||
As PGlite is so light weight it can be easily embedded into remote containerised development environments, or in-browser [web containers](https://webcontainers.io). | ||
It's being developed by [ElectricSQL](https://electric-sql.com/) for our use case of embedding into applications, either locally or at the edge, allowing users to sync a subset of their Postgres database. | ||
|
||
- On-device or edge AI and RAG<br> | ||
PGlite has full support for [pgvector](../extensions/#pgvector), enabling a local or edge retrieval augmented generation (RAG) workflow. | ||
However, there are many more use cases for PGlite beyond its use as an embedded application database: | ||
|
||
We are very keen to establish PGlite as an open source, and open contribution, project, working to build a community around it to develop its capabilities for all use cases. | ||
- **Unit and CI testing**<br> | ||
PGlite is very fast to start and tear down. It's perfect for unit tests - you can have a unique fresh Postgres for each test. | ||
|
||
Getting started with PGlite is super easy, just install and import the NPM package, then create a your embded database: | ||
- **Local development**<br> | ||
You can use PGlite as an alternative to a full local Postgres for development; simplifying your development environments. | ||
|
||
```js | ||
import { PGlite } from "@electric-sql/pglite"; | ||
- **Remote development, or local web containers**<br> | ||
As PGlite is so lightweight it can be easily embedded into remote containerised development environments, or in-browser [web containers](https://webcontainers.io). | ||
|
||
const db = new PGlite(); | ||
await db.query("select 'Hello world' as message;"); | ||
// -> { rows: [ { message: "Hello world" } ] } | ||
``` | ||
- **On-device or edge AI and RAG**<br> | ||
PGlite has full support for [pgvector](../extensions/#pgvector), enabling a local or edge retrieval augmented generation (RAG) workflow. | ||
|
||
It can be used as an ephemeral in-memory database, or with persistence either to the file system (Node/Bun) or indexedDB (Browser). | ||
We are very keen to establish PGlite both as an open source, and open contribution, project, working to build a community around it, so as to develop its capabilities for all use cases. | ||
|
||
Read more in our [getting started guide](./index.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.