1# @effect/sql-pglite
2
3An Effect SQL client for [PGlite](https://pglite.dev), a WASM build of PostgreSQL that runs in the browser, Node.js, and Bun.
4
5## Installation
6
7```sh
8npm install effect @effect/sql-pglite
9```
10
11## Links
12
13- [Website](https://effect.website): documentation, guides, and news.
14- [Reference](https://effect.website/docs/v4/api/sql-pglite): API documentation for this package.
15- [Discord](https://discord.gg/effect-ts): ask questions, share what you're building, and talk to the core team.
16- [Community](https://effect.website/community-hub): meetups and events, or bring Effect to your own.
17- [Issues](https://github.com/Effect-TS/effect/issues): bug reports and feature requests.
18
19## Let's talk
20
21Whether your team is considering Effect, rolling it out, or already running it in production, we'd love to hear from you: what you're building, what works, and what you need from Effect next.
22
23- **Talk to the maintainers.** Introduce your team on [Discord](https://discord.gg/effect-ts) or email [contact@effectful.co](mailto:contact@effectful.co). We're happy to connect privately on Slack or Discord for feedback and help with adoption.
24- **Production support.** We're exploring how to better support teams running Effect in production. If your organization has specific support needs, let's discuss them.
25- **Adoption help.** Our [adoption partners](https://effect.website/adoption-partners) offer implementation, consulting, team extension, training, and commercial support.
26
27## LISTEN / NOTIFY
28
29`listen` is a scoped subscription that returns after the listener is installed.
30It exposes notifications through a queue and keeps the subscription active for
31the surrounding scope:
32
33```ts
34import { PgliteClient } from "@effect/sql-pglite"
35import { Effect, Queue } from "effect"
36
37const program = Effect.gen(function*() {
38 const sql = yield* PgliteClient.PgliteClient
39 const notifications = yield* sql.listen("events")
40
41 yield* sql.notify("events", "ready")
42 return yield* Queue.take(notifications)
43})
44```