Skip to content
BS
Compiling experience_
Bipin Singh

Command Palette

Search anything on this site

Back to projects

Chatty: Real-Time Chat Application

A Socket.io-powered chat app securing 10K+ users.

React.jsNode.jsMongoDBExpress.jsSocket.io
50%Latency Reduced
10K+Users Secured
+40%Retention Increase
Chatty: Real-Time Chat Application cover artwork

Problem

Chat features built on polling or naive request-response patterns feel laggy and don't scale well once more than a handful of users are online at once.

Challenge

Build a real-time messaging experience that feels instant, keeps user sessions secure, and gives people enough presence information to make the app feel alive rather than static.

Architecture

Chatty uses Socket.io over a Node.js/Express backend for real-time bidirectional messaging, MongoDB for message and user persistence, JWT for stateless authentication, and a React frontend that reflects online status and new messages instantly.

React Client→ Socket.io Connection→ Express + Node.js Server→ MongoDB→ JWT Auth Middleware

Technical Decisions

Socket.io over polling

Switching from a request-response pattern to Socket.io's persistent WebSocket connections cut perceived message latency by roughly 50%.

JWT for stateless auth

JWT-based authentication let the app scale user sessions without a shared server-side session store, while still securing access for 10,000+ users.

Presence tracking as a first-class feature

Online status tracking was built into the same Socket.io connection lifecycle used for messaging, rather than as a separate polling mechanism, keeping presence updates instant.

Implementation

  • Set up a Socket.io server on Node.js/Express for real-time message delivery.
  • Modeled users and messages in MongoDB with indexes for fast conversation lookups.
  • Implemented JWT-based authentication and route protection.
  • Built a responsive React UI with live message updates and online status indicators.

Results

  • Reduced perceived messaging latency by 50% compared to a polling-based approach.
  • Secured 10,000+ users with JWT-based authentication.
  • Increased engagement by 40% through responsive UI and presence tracking.

Lessons Learned

  • Presence and online-status features are cheap to add once a persistent socket connection already exists for messaging.
  • JWT simplifies scaling authentication but requires careful handling of token expiry and refresh to avoid silently dropped connections.

Future Improvements

  • Add message delivery and read receipts.
  • Introduce horizontal scaling for Socket.io using a shared adapter for multi-server deployments.