A small realtime coaching feed application built using:
- Node.js
- Express.js
- MongoDB
- Redis
- Socket.IO
- Next.js
The application allows admins to create coaching feed updates and instantly broadcast them to all connected users in realtime without refreshing the page.
- REST APIs using Express.js
- MongoDB database integration
- Redis caching for feed fetching
- Socket.IO realtime updates
- Cache invalidation handling
- Error handling
- Next.js frontend
- Home page to display feeds
- Admin page to add feeds
- Live realtime updates
- Loading and error states
- Socket reconnect handling
- Duplicate socket listener prevention
- Scalable architecture structure
- Next.js
- React
- TailwindCSS
- socket.io-client
- Node.js
- Express.js
- MongoDB + Mongoose
- Redis
- Socket.IO
project/
│
├── backend/
│ ├── controllers/
│ ├── models/
│ ├── redis/
│ ├── routes/
│ ├── socket/
│ ├── server.js
│ └── .env
│
├── frontend/
│ ├── app/
│ │ ├── page.tsx
│ │ └── admin/
│ │ └── page.tsx
│ │
│ ├── components/
│ └── package.json
│
└── README.mdFrontend
↓
GET /feed
↓
Check Redis Cache
↓
Cache Hit? → Return Cached Data
↓
Cache Miss? → Fetch MongoDB
↓
Save Result To Redis
↓
Return ResponseAdmin Page
↓
POST /feed
↓
Save Feed To MongoDB
↓
Delete Redis Cache
↓
Emit Socket Event
↓
Connected Clients Receive Update
↓
Frontend Updates Instantlygit clone <repo-url>cd backendnpm installPORT=5000
MONGO_URI=mongodb://127.0.0.1:27017/syncupnpm run devMake sure Redis server is running locally.
Default Redis port:
6379cd frontendnpm installnpm run devnew-feed