Skip to content

A TypeScript-based Express API that fetches product data from MongoDB and caches it using Redis with ioredis for high-performance and optimized response delivery.

Notifications You must be signed in to change notification settings

developersajadur/Redis-Cache-Learning

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Redis Product Cache API

An Express.js + TypeScript API that fetches product data from MongoDB and caches the result using ioredis for improved performance.
Ideal for learning Redis caching, API optimization, and working with Mongoose models.


πŸš€ Features

  • Fetches product data using Mongoose
  • Redis caching with automatic fallback
  • TypeScript, Express, and ioredis integration
  • JSON response optimization
  • Cache expires every 30 seconds

πŸ“¦ Technologies Used

  • Node.js
  • Express.js
  • TypeScript
  • MongoDB + Mongoose
  • Redis (via ioredis)

πŸ“‚ Setup Instructions

1. Clone the Repository

git clone https://github.com/developersajadur/Redis-Cache-Learning
cd Redis-Cache-Learning
  1. Install Dependencies
npm install
  1. Create .env File
PORT=5000
DATABASE_URL=your-mongodb-uri
  1. Install & Run Redis βœ… Option 1: Download Redis for Windows Download the Redis-x64-3.2.100.zip or similar

Extract it and run redis-server.exe (You can add it to PATH or run from CMD directly)

βœ… Option 2: Use Docker (Recommended)

docker run --name redis-server -p 6379:6379 -d redis
  1. Run the Project
npm run dev

πŸ›  Development Scripts Script Description npm run dev Start app in dev mode npm run build Compile TypeScript npm start Run compiled app

πŸ”— Useful Links πŸ“˜ ioredis NPM: https://www.npmjs.com/package/ioredis

🧱 Redis for Windows: https://github.com/microsoftarchive/redis/releases

πŸ“¦ Redis Docker Image: https://hub.docker.com/_/redis

About

A TypeScript-based Express API that fetches product data from MongoDB and caches it using Redis with ioredis for high-performance and optimized response delivery.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published