Skip to content

feat: add PGlite as a client-side database implementation#541

Draft
Copilot wants to merge 2 commits intomasterfrom
copilot/add-pglite
Draft

feat: add PGlite as a client-side database implementation#541
Copilot wants to merge 2 commits intomasterfrom
copilot/add-pglite

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 4, 2026

Adds PGlite — a WASM-compiled PostgreSQL running entirely in the browser with IndexedDB persistence — as a new benchmark implementation alongside the existing pouchdb, rxdb, watermelondb, etc.

New project: projects/pglite

  • database.service.ts — bootstraps PGlite('idb://chat-db'), creates users/messages tables with indexes, and wires up PostgreSQL NOTIFY/LISTEN triggers for reactive change propagation
  • app.logic.ts — implements LogicInterface via parameterized SQL queries; uses ILIKE for search, ON CONFLICT DO NOTHING for idempotent inserts, trigger-driven Subject<void> observables to re-run queries on data changes
// Change feed via pg NOTIFY triggers + PGlite's listen()
await db.listen('messages_change', () => messagesSubject.next());

// Reactive query pattern
this.db.messages$.pipe(
    startWith(undefined),
    switchMap(async () => db.query(`SELECT ... WHERE ... ORDER BY "createdAt" DESC LIMIT 1`, [id1, id2]))
)

Config / tooling

  • Added @electric-sql/pglite@0.4.3 dependency
  • Registered pglite project in angular.json (mirrors pouchdb config)
  • Added build:pglite, dev:pglite, start:pglite, client:pglite, test:pglite, analyze:pglite scripts to package.json

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • mapbox-node-binary.s3.amazonaws.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/client-side-databases/client-side-databases/node_modules/.bin/node-pre-gyp install --fallback-to-build down/node_modules/.bin/node-gyp-build-test (dns block)
  • package.cli.amplify.aws
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node ./lib/install.js -o Release/obj.target/sqlite3/gen/sqlite-autoconf-3310100/sqlite3.o (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Add pglite support to the project feat: add PGlite as a client-side database implementation Apr 4, 2026
Copilot AI requested a review from pubkey April 4, 2026 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants