This part integrates Redis as a caching layer for API responses in a Node.js / Express application.
The goal is to reduce database load and improve performance by serving cached data when available.
- Caches API responses using Redis.
- Reuses cached data if available instead of hitting the database.
- Supports dynamic keys based on request params.
- Easy to plug into any Express route.
- redis not available for direct installation on windows so we should use Docker
- docker pull redis -or-
- docker run -d --name redis -p 6379:6379 redis:latest
- docker exec -it my-redis redis-cli (run redis cli)
- npm install redis
- then start coding which mentioned in the "cache" branch
- in this project we use redis for
- 1- cache while request all products
- 2- cache while request one product
- 3- cache deleted when add,update,delete products
This part integrates node-cron into the project to handle scheduled background tasks
- Task scheduling using node-cron.
- Runs scheduled jobs inside your Node.js/Express app.
- Uses standard cron expressions.
- Easy to plug into any Express route.
- npm install node-cron
β β β β β
β β β β ββββ Day of the week (0 - 7) (Sunday = 0 or 7)
β β β βββββββββ Month (1 - 12)
β β ββββββββββββββ Day of the month (1 - 31)
β βββββββββββββββββββ Hour (0 - 23)
ββββββββββββββββββββββββ Minute (0 - 59)
- we use cron job to work every 1 hour on products docs see if any product has quantity less than 5
- write product data inside 'lastQProducts' file
This part integrates OpenAI API and groq to generate embeddings for your application data. The goal is to transform text into high-dimensional vectors that can be used for semantic search, recommendations, and AI-powered features.
- asking questations to AI from your app
- Generates vector embeddings using OpenAI models.
- Stores embeddings for efficient semantic search instead of simple keyword search.
- Easy to integrate into any Node.js / Express project.
- Install the OpenAI package : npm i openai
- Install groq sdk : npm i groq-sdk
- first start with basic askAI controller
- then working with embedding model to advanced AI-Query