I recently built a demo project for the purpose of testing the usage of Redis as an activity feed of recent changes to a system. As the project this proof of concept already uses Redis in multiple capacities, we wanted to try to utilize it in this capacity to maintain the current dependency stack.
I chose to use Redis Streams for multiple reasons:
- I can set a Maximum Length of the Stream.
- I select from the last ID natively with the Stream.
- A Redis Stream is Optimized for this exact use case.
The Project Overview
The project itself is in NextJS utilizing a single API endpoint for the Redis Connection. I set up a
POST action to add a new record to the Stream and a
GET method to retrieve the latest items of the feed. A simple interface was developed to interact with the feed through the
You can check out the full concept project here: @CodeVachon/feed-testing