GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - AnkitRajCode/Redis-JS: Hands-on Node.js + Express playground exploring Redis patterns: strings, TTL/OTP, JSON vs Hash, list queues, and BullMQ background jobs.

BranchesTags
Open more actions menu

Latest commit

 

History

14 Commits
14 Commits

Folders and files

NameName
Last commit message
Last commit date
docs
docs
 
 
src
src
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
docker-compose.yml
docker-compose.yml
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 

Repository files navigation

Redis JavaScript API

Small Express API demonstrating Redis-backed banner storage and MongoDB connectivity checks.

Features

  • Manage a banner message in Redis
  • Generate and verify OTPs with Redis TTL
  • Store and fetch user profiles as Redis JSON string or Redis hash
  • Check Redis connectivity
  • Check MongoDB connectivity using Mongoose
  • Local development with Docker Compose (Redis + MongoDB)

Tech Stack

  • Node.js (ES modules)
  • Express
  • ioredis
  • Mongoose
  • Docker Compose (Redis + MongoDB)

Project Structure

src/
	index.js      # app bootstrap and non-banner routes
	banner.js     # /banner router and handlers
	otp-ttl.js    # /otp router and handlers
	jsonVsHash.js # /user router for JSON vs Hash storage
	queue.js      # /emails-queue router (Redis list queue)
	bullMQ/       # BullMQ queue, producer router, and worker
		queue.js    # emails queue definition + Redis connection
		api.js      # /bullmq producer router
		worker.js   # background worker (job consumer)
	pub-sub/      # Redis Pub/Sub notifications
		api.js      # /notifications publisher router
		subscriber.js # channel subscriber (listener)
docs/           # per-topic documentation
docker-compose.yml
package.json

Documentation

Each topic has its own detailed guide with concepts, endpoints, and test commands:

  • Banner (Redis String)
  • OTP with TTL (Redis Expiry)
  • User Profile: JSON vs Hash
  • Email Queue (Redis List)
  • BullMQ Job Queue (Producer + Worker)
  • Pub/Sub Notifications
  • Health / Connectivity

Prerequisites

  • Node.js 18+
  • npm
  • Docker Desktop (or Docker Engine + Compose)

Setup

  1. Install dependencies:
npm install
  1. Start Redis and MongoDB:
docker compose up -d
  1. Run the API:
npm run dev

This uses nodemon, so the server auto-restarts when files change.

For normal runtime (without auto-reload):

npm start

Server runs at http://localhost:3000.

NPM Scripts

  • npm run dev: development mode with nodemon
  • npm start: run with Node.js (no file watching)
  • npm run worker: start the BullMQ worker (job consumer) as a separate process
  • npm run sub: start the Pub/Sub subscriber (listener) as a separate process

Environment Variables

Optional environment variables:

  • REDIS_URL (default: redis://localhost:6379)
  • MONGO_URI (default: mongodb://localhost:27017/JS_redis)

Example:

REDIS_URL=redis://localhost:6379
MONGO_URI=mongodb://localhost:27017/JS_redis

API Endpoints & Test Commands

See the per-topic guides in the Documentation section above - each includes full endpoint references and curl test commands.

Stop Local Services

docker compose down

About

Hands-on Node.js + Express playground exploring Redis patterns: strings, TTL/OTP, JSON vs Hash, list queues, and BullMQ background jobs.

Topics

bullmqcachingdocker-composeexpressioredisjavascriptjob-queuelearning-by-doinglearning-projectmongodbnodejsredisrest-apittl

Resources

Readme
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.