May 15, 2023

Introducing Pulse: Real-Time Database Change Events Made Easy

Achieve seamless real-time communication between your database and application, letting you focus on building apps while we handle the data syncs for you. Join the waitlist to be the first to get your hands on Pulse!

Table of contents

What is Pulse?

Pulse is a managed change data capture (CDC) service that captures change events from your database and delivers them instantly to your applications. With Pulse, you can quickly build real-time applications in a type-safe manner using Prisma Client.

To truly understand why we created Pulse, we must first take a moment to understand the context that led to its development. We will explore a group of example applications, examine how real-time functionality was implemented before Pulse by looking at the current technologies used by developers, and explain how Pulse addresses the challenges associated with these technologies.

Let's start with an example group of applications that would benefit from using real-time data sync functionality. In our application, we have a front-end user interface that accepts user account creation form data. When this form is submitted, we insert the data into the database.

Then, using Pulse, we can sync that new data creation into our other applications.

In this example, we have one application that sends a welcome email to the user as soon as the data is created. In the other application, we have a back-end admin user interface that logs database events as they happen.

How Pulse Works Graphic

How could you implement real-time functionality before Pulse?

Before Pulse, developers had two main approaches to implementing real-time functionality in their applications: polling and setting up change data capture themselves (e.g. using platforms such as Debezium).

Polling: Benefits and pain points

Polling is a technique used to periodically query a database for changes in order to check for updates.

Some benefits of using polling include:

  • Simple implementation
  • Ease of understanding

However, developers using polling may experience the following pain points:

  • Increased load on the database
  • Scalability difficulties as the number of requests grows
  • Latency, as updates are only detected during the next poll occurrence

Change data capture: Benefits and pain points

Change data capture (CDC) is a technique used to track and capture changes in a database enabling real-time updates. It allows applications to be informed about the modifications in the database, ensuring data consistency between multiple applications.

CDC offers a number of advantages for data management and real-time processing:

  • Robust and mature pattern to capture database change events
  • Supports a variety of databases
  • Allows for almost instantaneous updates, making it ideal for real-time data processing and analytics

However, there are certain challenges and pain points associated with using CDC:

  • Integrating it into existing infrastructure can be time-consuming and complex
  • CDC can potentially expose sensitive data changes, requiring careful attention to security and privacy controls

How Pulse improves on what exists

Pulse addresses the challenges of polling and setting up change data capture. It provides a streamlined solution for developers to implement CDC in their applications. By simplifying the integration process with your database and handling the configuration, management, and operation of CDC, Pulse eliminates the need for continuous database polling and the complexity of working with Debezium.

This allows developers to focus on building amazing real-time applications while enjoying seamless, real-time communication between their database and application.

How Pulse works

Pulse is designed to be developer-friendly and easy to integrate into your application infrastructure. You will be able to configure Pulse and connect it to your database in the Prisma Data Platform.

Once your database is Pulse-ready, you can easily integrate Pulse into your application using the subscribe() method in Prisma Client. This powerful function allows you to subscribe to real-time data changes in your database, making implementing real-time features in your application easy.

Here's an example that demonstrates how to subscribe to all database events and print them to the console:

const liveQuery = prisma.message.subscribe()
// Waiting loop that prints new events when something changes in the database
for await (const event of liveQuery) {
console.log(event.action) // 'create', 'update', 'delete'
}

You can even use different parameters to retrieve specific data from the subscribe() method, or to retrieve data before and/or after it has been created/updated:

const liveQuery = prisma.message.subscribe({
// Return update events where the filter criteria matches the "after" state
update: { after: { chatId: 'id' } },
// Return all delete change events
delete: {},
})
for await (const event of liveQuery) {
console.log(event.action) // 'create', 'delete'
}

Note: The API for using Pulse might still evolve while it's in Early Access.

Join the waitlist today!

We're thrilled to invite you to join our Early Access program for Pulse. By signing up, you'll be among the first to experience the power of real-time data streaming with Pulse, transforming the way you build and operate your applications.



Join the waitlist

Are you as excited about Pulse as we are? Share your thoughts on social media using the hashtag #PrismaPulse, and join our community Slack channel to discuss how Pulse can make a difference in your application development journey. We look forward to hearing from you!

Don’t miss the next post!

Sign up for the Prisma Newsletter

Key takeaways from the Discover Data DX virtual event

December 13, 2023

Explore the insights from the Discover Data DX virtual event held on December 7th, 2023. The event brought together industry leaders to discuss the significance and principles of the emerging Data DX category.

Prisma Accelerate now in General Availability

October 26, 2023

Now in General Availability: Dive into Prisma Accelerate, enhancing global database connections with connection pooling and edge caching for fast data access.

Support for Serverless Database Drivers in Prisma ORM Is Now in Preview

October 06, 2023

Prisma is releasing Preview support for serverless database drivers from Neon and PlanetScale. This feature allows Prisma users to leverage the existing database drivers for communication with their database without long-lived TCP connections!