Build real-time notifications
Build real-time notifications for background jobs using Cloudflare Workflows, Durable Objects, RPC, and WebSockets.
Build real-time notifications
Learn how to enable real-time updates in a React app for asynchronous background jobs using:
What you’ll build
By the end of this course, you’ll have a React app that shows real-time status updates for background jobs. Behind the scenes, the background jobs are implemented using Cloudflare Workflows and real-time messages are coordinated using Durable Objects. This includes:
- A Worker to handle HTTP and WebSocket requests
- Cloudflare Workflows to run durable stepped jobs
- A Durable Object to handle publishing status updates
- React app that receives updates over a WebSocket
In this specific example, you’ll be building real-time updates around an AI powered blog post generation workflow. However, since the focus of this course is specifically on implementing real-time updates, you won’t be implementing the blog post generation itself. Instead, you build the individual steps and simulate the work being done by waiting for a few seconds on each step.
Prerequisites
To follow along, you’ll need the following:
- Git
- Node.js 22+
- pnpm 11.9 or newer
- A Cloudflare account
With your Cloudflare account, you’ll need access to Workers, Workflows, and Durable Objects for the final deployment.
Optionally, you’ll need an AI coding agent if you’d like to follow the agentic learning flow.
Exercises
- 00.Interview: Tell your agent what you already know about background jobs and which parts of the project you want to explore.✓
- 01.Set up the app: Get the starter Workers app running on your machine✓
- 02.Create a workflow: Build a Workflow that runs a background job in steps✓
- 03.Start a workflow: Add API endpoints to start background jobs and check their progress✓
- 04.Create a Durable Object: Give each job a place to track and share its progress.✓
- 05.Handle WebSocket connections: Send job progress to connected browsers over WebSockets✓
- 06.Connect the browser: Show live job progress in the app using WebSocket updates✓
- 07.Deploy the app: Deploy your app to Cloudflare and verify real-time progress on the live URL.✓
Paste this into your agent
Copied! Now paste it into your agent. No agent yet? Here's how to get one.