Skip to main content

Real-time events

Prisma Postgres comes with a built-in real-time event system (enabled by Prisma Pulse) that lets you react to changes in your database.

note

To receive real-time events, ensure that Prisma Pulse is enabled in your Prisma Postgres setup. Learn how to enable it here.

Prisma Pulse is a fully managed and robust Change Data Capture (CDC) service that provides delivery guarantees for all change events happening in your database.

Here is an example for how you can stream data changes on the User table in your application:

const stream = await prisma.user.stream()

for await (const event of stream) {
console.log('just received an event:', event)
}

Check out the database events documentation for details.