Skip to content

AnuragDubey007/nexus-realtime-chat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 

Repository files navigation

Nexus – Real-Time Chat Application

Nexus is a full-stack real-time chat application built to demonstrate live communication, secure authentication, user presence tracking, and media handling using modern web technologies.

The project focuses on correctness, security, and real-time system behavior, rather than UI-heavy features.


✨ Key Features

🔹 Real-Time Messaging

  • Instant 1-to-1 message delivery using Socket.IO
  • Typing indicators with smooth UI updates
  • Automatic message ordering during concurrent sends

🔹 Live Presence & Last Seen

  • Real-time online/offline user status
  • Accurate lastSeen timestamps persisted in MongoDB
  • Presence updates broadcast instantly across connected clients

🔹 Secure Authentication

  • JWT-based authentication stored in HTTP-only cookies
  • Protected Express routes using middleware-based authorization
  • Persistent login via session validation

🔹 Media Support

  • Profile images and inline chat media uploads via Cloudinary
  • Optimized image URLs stored securely in the database

🛠️ Tech Stack

Frontend

  • React (Vite)
  • Context API
  • React Router
  • Axios
  • Socket.IO Client
  • Tailwind CSS

Backend

  • Node.js
  • Express.js
  • MongoDB & Mongoose
  • Socket.IO
  • JWT Authentication
  • Cloudinary

🧠 Architecture Overview

  • REST APIs handle authentication, user management, and message history
  • Socket.IO powers real-time messaging, typing indicators, and presence updates
  • Server maintains a userId → socketId mapping to track active users
  • On socket disconnect, the user’s lastSeen timestamp is updated in MongoDB

🔐 Security & Design Decisions

  • HTTP-only cookies are used instead of localStorage to mitigate XSS risks
  • Authentication middleware protects all sensitive routes
  • Media uploads are offloaded to Cloudinary to reduce backend load
  • Route–controller separation improves maintainability and clarity

🚀 Running Locally

Backend

cd backend
npm install
npm run dev

About

Full-stack real-time chat application with Socket.IO, secure JWT authentication, user presence tracking, and media uploads.

Topics

Resources

Stars

Watchers

Forks

Contributors