DEV Community

greeny bignose
greeny bignose

Posted on • Edited on

Migrating Tenant Management System From Mongodb To Redis Backend

Redis AI Challenge: Beyond the Cache

This is a submission for the Redis AI Challenge: Beyond the Cache.

cover_image: Redis Challenge with Grafana


What I Built

I built a Tenant Management System, a small but practical intranet application used to keep track of tenants in an apartment complex. It allows the community head to search for tenants and check their status quickly.

This is a live app already being used by real users. For this challenge, I refactored the backend, originally based on MongoDB, and migrated it to Redis Cloud as the primary database.

I also updated some of the application code to better take advantage of Redis’ capabilities.


Application flow

First admin need to login first using his own account on sign in page, and generate token to add operator guy who will be fill, update and search for tenant data in apartment complex. This token will be use by operator to sign up on sign up page and login inside the apps.

Next time operator wants to do their job, just sign in using his/her name and password. Operator can add tenant data, update, search based on name or tower+unit and delete it too. Admin cannot do this directly.

Every time they want to logout just refresh the browser to back to sign in page.

Demo

Default password for admin is admin with password 123456

There are one operator for test with username aa and password 123456

Test Data Used

For this project, I leveraged several real-world and simulated datasets hosted on GitHub to demonstrate and test Redis functionalities effectively:

Operator Name List:
https://github.com/hendram/appsrwbackredis/blob/master/operator-name-list.txt
Contains a list of operator names for testing Redis queries related to operators.

Resident Name List:
https://github.com/hendram/appsrwbackredis/blob/master/residents-name-list.txt
Provides resident names to simulate tenant-related Redis queries.

Timeseries Log for Name Search:
https://github.com/hendram/appsrwbackredis/blob/master/timeseries-log-namesearch.txt
A fake dataset used to demo RedisTimeSeries search queries based on tenant names.

Timeseries Log for Tower & Unit Search:
https://github.com/hendram/appsrwbackredis/blob/master/timeseries-log-towerunitsearch.txt
Demo dataset used to showcase timeseries search queries filtered by tower and unit attributes.


Redis database

Redis memory usage

RedisJson and RedisSearch Index

RedisSearch

Why Redis Cloud

True Distributed RediSearch
Fully supports distributed full-text search and secondary indexing across all cluster nodes, enabling seamless search on large, sharded datasets.

Automated High Availability and Failover
Built-in automatic failover with multi-availability zone support ensures minimal downtime without manual intervention.

Automatic Horizontal Scaling
Scales elastically with automatic sharding and re-sharding to handle growing workloads smoothly.

Managed Persistence and Backups
Provides automated backups and point-in-time recovery, protecting data with minimal effort.

Enterprise-Grade Security
Features encryption at rest and in transit, role-based access control, and secure network connectivity options.

Comprehensive Monitoring and Alerting
Integrated dashboards and alerts give real-time insight into performance and system health.

How I Used Redis Cloud

In this project, I used Redis Cloud as my primary database, not just for caching, but for real-time data storage, querying, and monitoring.

Redis Features Used:

  • 🧠 RedisJSON: Used to store structured data about each tenant — including fields like nama, tower, unit, and status.

  • 🔍 RediSearch: Enabled fast, full-text search capabilities for fields like tenant name (nama) and apartment unit (towerunit). This allows operators to search quickly even as the dataset grows.

  • 📊 RedisTimeSeries:

    I use this module to log how many records are returned by each search query (e.g., on nama or towerunit).

    Each operator’s search count result is pushed to a time series key so we can monitor activity over time.

    This gives visibility into tenant search behavior — not for performance metrics, but for tracking usage patterns.

  • 📈 Grafana Cloud Integration:

    I integrated Redis Cloud with Grafana Cloud using the Redis Data Source Plugin. This allowed me to build a live dashboard that queries RedisTimeSeries directly to show:

    • Search query volumes over time
    • Which operators are most active
    • What kind of search patterns are emerging
  • ☁️ Redis Cloud: As a managed platform, Redis Cloud made it easy to deploy without worrying about infrastructure. It includes Redis modules like RedisJSON and RediSearch out of the box, which helped me replace my previous MongoDB backend completely.


This setup proves Redis Cloud can be used as a complete real-time application backend, not just a cache — and even supports advanced observability when combined with tools like Grafana.

Top comments (0)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.