@prisma/extension-pulse
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

Pulse Prisma Client extension

This is the package for the Prisma Client extension that enables usage of Prisma Pulse.

What is Prisma Pulse?

Prisma Pulse is a managed Change Data Capture (CDC) service that makes it easy to react to changes in your databases with type-safe model streams.

It enables developers to build real-time apps by streaming database changes into their application in a type-safe way — with just a few lines of code:

// 1. Subscribe to all changes on the `User` table
const stream = await prisma.user.stream();

// 2. Wait for changes to happen in the DB so that new events arrive
for await (let event of stream) {
  // 3. Do something with an event, e.g. log the its details to the terminal
  console.log(`Something happened in the database: `, event);
}

Here is an overview of the main features Prisma Pulse provides:

  • Type-safe reactions to database changes
  • Delivery guarantees for events: "at least once" and in the "right order"
  • Resumable event streams in case your server goes down
  • Unidirectional data flow via Change Data Capture (CDC)
  • Great DX integrated with usage of Prisma ORM (easy setup, development and maintenance)
  • Compatibility with your existing database
  • Insights dashboard, so you can view and understand all database events captured by Pulse

Get started

Get started with Prisma Pulse by following the instructions in the docs.

If you want to learn more about Pulse, you can also check out these resoures:

Important

The Prisma Pulse extension offers separate implementations tailored for various runtimes, such as Node.js and Cloudflare Workers. If you're using bundler moduleResolution in your TSConfig, you must also explicitly set customConditions to either node or workerd depending on your target runtime. This will instruct TypeScript to match the correct type definitions of the Prisma Pulse extension, as well as any other packages that expose multiple entrypoints.

// tsconfig.json
{
  "compilerOptions": {
    // ...other options
    "target": "es2022",
    "moduleResolution": "bundler",
    "customConditions": ["workerd"] // or "node"
  }
}

Resources

Readme

Keywords

none

Package Sidebar

Install

npm i @prisma/extension-pulse

Weekly Downloads

3,873

Version

1.2.0

License

none

Unpacked Size

97.7 kB

Total Files

40

Last publish

Collaborators

  • pirix-gh
  • prismabot