https://github.com/jayakrishnan-mk/real-time-notification-system
Real-Time-Chat-Application - built on Redis, which internally works on a Queue model for rate limiting. This system handles 500+ plus notifications per second.
https://github.com/jayakrishnan-mk/real-time-notification-system
authentication-middleware bullmq clean-architecture docker hashmap heartbeat microservice prisma pubsub queue-workers rate-limiting receipts reconnection redis retry-strategies rooms swagger websocket
Last synced: 2 months ago
JSON representation
Real-Time-Chat-Application - built on Redis, which internally works on a Queue model for rate limiting. This system handles 500+ plus notifications per second.
- Host: GitHub
- URL: https://github.com/jayakrishnan-mk/real-time-notification-system
- Owner: Jayakrishnan-mk
- License: mit
- Created: 2025-04-01T15:01:56.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2025-07-22T07:05:30.000Z (3 months ago)
- Last Synced: 2025-07-22T08:48:39.370Z (3 months ago)
- Topics: authentication-middleware, bullmq, clean-architecture, docker, hashmap, heartbeat, microservice, prisma, pubsub, queue-workers, rate-limiting, receipts, reconnection, redis, retry-strategies, rooms, swagger, websocket
- Language: TypeScript
- Homepage:
- Size: 8.41 MB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ๐ Real-Time Notification System.
A production-ready backend system to send real-time push notifications using **Node.js**, **Socket.IO**, **Redis**, **BullMQ**, and **PostgreSQL**. It supports JWT-based authentication, device-wise refresh token management, and secure token rotation.
---
## ๐ฆ Tech Stack-
- **Node.js** (Express)
- **TypeScript**
- **Socket.IO** for real-time communication
- **Redis** for Pub/Sub
- **BullMQ** for job queues
- **MySQL** with Prisma ORM
- **Swagger** for API docs
- **JWT** with Refresh Token Rotation
- **Docker** for containerization---
## ๐ง Features
- โ Real-time notification delivery using WebSocket
- โ BullMQ + Redis for background job processing
- โ Refresh token rotation with device session tracking
- โ Secure and scalable architecture
- โ Swagger UI for API testing
- โ PostgreSQL-based DB design
- โ Admin queue dashboard with authentication
- โ Socket room-based architecture for user isolation---
## ๐ Project structure
- dist
- node_modules
- prisma
- src
- -> assets
- -> config
- -> controllers
- -> dtos
- -> middleware
- -> public
- -> queues
- -> routes
- -> scripts
- -> services
- -> types
- -> utils
- -> workers
- -> ws
- -> index.ts
- -> loadEnv.ts
- .dockerignore
- .env
- .env.development
- .env.production
- .gitignore
- Dockerfile
- package-lock.json
- package.json
- readme.md
- tsconfig.json---
## ๐ผ๏ธ High-Level Architecture

---
## ๐ผ๏ธ HLD - 2

---
## ๐งฑ Database Schema

---
## ๐ Token Lifecycle Flow (JWT + Refresh Token)

---
## ๐ API Documentation
Swagger UI available at:
```
https://real-time-notification-system-production.up.railway.app/api-docs/
```
---
## ๐ Bull Dashboard (For analyzing message queue)
Dashboard available at:
```
https://real-time-notification-system-production.up.railway.app/admin/queues/
```
---
## ๐ Local Development Setup
```bash
# 1. Clone repo
git clone https://github.com/Jayakrishnan-mk/real-time-notification-system# 2. Install dependencies
npm install# 3. Start Redis & Postgres via Docker (if not already running)
# 4. Setup env
cp .env.development .env# 5. Run migrations
npx prisma migrate dev# 6. Start dev server
npm run dev
```---
## ๐ณ Running with Docker (Production Build)
Build and run using Docker:
```bash
# 1. Build Docker image
docker build -t realtime-notify .# 2. Run container
docker run -d -p 3000:3000 --env-file .env.production realtime-notify
Or if you're using Docker Compose:bash
Copy
Edit
docker-compose up --build
Make sure your .env.production is properly set up with:DATABASE_URL
REDIS_URL
JWT_SECRET
other required variables...
```---
## ๐งช Testing the Notification Flow
```bash
# You can test real-time notifications by:
- Logging in to get access/refresh tokens
- Opening WebSocket connection with userId
- Hitting /api/notifications to simulate push
```---
## ๐ Deployment
Deployed on:
- Railway (Production)---
## ๐ค Contributing
PRs and suggestions welcome! ๐
---
## ๐ License
MIT