Mahdi.Kh
September 18, 2026
Using Debezium, we read data changes from the primary database and put them on RabbitMQ, and finally build an indexer service that processes the messages placed on RabbitMQ and indexes the data on Typesense.
In this part, we use a small prebuilt blog management service and implement fast search on this project using CDC.
Our service is a simple blog that gives us the ability to create, delete, and edit content. This project uses Golang as the backend language and PostgreSQL as the primary database. Using CDC, we can read data changes from the blog table and store these changes in the typesense database.
You can see and download the project's final source code on GitHub. To run the project, first go to the project folder using the terminal, and then run the project with Docker using the command below:
And finally, you can shut down the project using the command below:
If you're not familiar with Docker or haven't installed it, it's best to install Docker first, and this will also be a good opportunity to get a bit familiar with Docker.
And if you have make on your system, you can use the commands below inside the project folder to start up and shut down the services:
Before we start implementing, let's look at the final structure of what we want to have.
Overall, we'll use the following tools to build our project:
We use PostgreSQL as the primary database for storing and maintaining content.
We use the Typesense database to full-text index the content for use in search. This way, our application can search the desired content very quickly and provide the results to our application's users.
We use RabbitMQ as a queue. This way, we put changes made on the primary database into this queue, and then, by processing the messages in the queue, we update the data on Typesense.
This way, we'll index all the data on Typesense instantly, without putting any load on our primary database.
We use Debezium to read PostgreSQL's logs and turn those logs into messages on RabbitMQ. This way, the changes we make to data in PostgreSQL are stored as messages inside RabbitMQ.
We build an indexer application that reads the messages written to RabbitMQ and, based on these messages, indexes and updates the data on Typesense.
Our main application, whose responsibilities are split into two main parts:
Dashboard-related functionality for managing blog posts, which stores and updates data on the primary database (PostgreSQL, in this case).
General functionality, including the home page, post detail pages, and searching content, which reads and displays data from Typesense.
The overall shape of our application will be as follows:
To set up Debezium on Postgres, according to the documentation, we need to go through the following steps:
To do this, we can create a file with a conf extension at /etc/postgresql/. For example, I'll create this file named postgresql.conf at /etc/postgresql/postgresql.conf.
Then we put the following settings inside it:
To run debezium, we use debezium-server, and following the documentation, we configure it for connecting to RabbitMQ and reading PostgreSQL's logs. All of these settings can also be done using environment variables. We pass the following environment variables to debezium-server:
After Debezium runs, we should be able to see, in the RabbitMQ dashboard, the messages that are sent to RabbitMQ.
In the chart above, we can see that in a short time window, 60 messages per second were sent to RabbitMQ. Next, we'll build a service that processes these messages and indexes the result on Typesense.
Note: If you're using the project created in our GitHub repo, after running the project you can go to http://localhost:15672/ and log in with the username admin and the password admin123.
This service is responsible for processing the messages that Debezium writes onto RabbitMQ. Processing each message consists of creating, editing, or deleting an index entry.
If the user creates new content, that content is placed as a message on RabbitMQ, and then the indexer service processes this message and creates a new index entry on Typesense.
If the user edits existing content, that edit is placed as a message on RabbitMQ, and then the indexer service processes this message and updates the current indexed content on Typesense.
And finally, if content is deleted, by processing the message placed on RabbitMQ, the index entry corresponding to that message is removed from typesense.
Based on the code above, depending on the type of message placed on RabbitMQ, we create, edit, or delete the index entry in Typesense. You can see the complete code on GitHub.
By running the indexer service, the data should get indexed in Typesense, and you can see the result in the typesense dashboard.
For example, in the image we can see that 290 items have been indexed in the posts collection.
Then, our main application can search through the indexed data and show the results to users:
Note: If you're using the project created in our GitHub repo, after running the project you can go to http://localhost:8085/ to see the blog service.
In the image above, whatever we search for in the search box, if it exists, the list of related posts will be shown to us.
Previous part: Indexing Data With Maxwell on Typesense to Build a Fast Search Service | CDC Pipeline