← Back to Projects

Charcha

TypeReal-Time Chat
StackNext.js
Charcha

Overview

Charcha is a comprehensive, full-stack real-time messaging platform inspired by modern communication apps like WhatsApp and Telegram. Built entirely on a modernized MERN stack, the application prioritizes speed, security, and an engaging user experience. It goes beyond simple text chatting by offering advanced features like end-to-end message encryption, media sharing, an interactive Status system, and a secure friend request graph. The app leverages WebSockets to ensure perfect synchronization across clients with near-zero latency.

Key Features

  • ✦Real-Time Synchronization: Instant message delivery powered by Socket.io, complete with live typing indicators, read receipts, and accurate online/last-seen tracking.
  • ✦Advanced Message Interactions: Users can reply to specific messages, react to messages with emojis, and use the 'Unsend' (Delete for Everyone) feature.
  • ✦Media & File Sharing: Full support for uploading images, videos, and documents with client-side image compression to optimize bandwidth.
  • ✦Data Security & Privacy: Messages are encrypted at rest in the database using custom encryption middleware. Includes a strict friend request system.
  • ✦Ephemeral Status Updates: A WhatsApp-style status system where users can broadcast temporary updates to their connections.
  • ✦Dual Authentication: Secure login options including traditional email/password and Google OAuth integration for seamless onboarding.

Technologies Used

Next.js 16Socket.ioNode.jsMongoDBTailwind CSSCloudinaryCrypto

Project Links

Challenges & Solutions

Real-Time State Management and Scalable Socket Architecture

Keeping the UI synchronized across multiple users for messages, reactions, read receipts, and online statuses without causing excessive database queries or broadcast storms.

Optimized Socket.io Architecture

Implemented a robust Map to track online users and bound clients to personal socket rooms. This allowed targeting exact user IDs or Chat Room IDs for granular events, ensuring minimal network overhead.

Handling Heavy Media Uploads Efficiently

Users uploading large image files could slow down the application, consume excessive server bandwidth, and exhaust cloud storage limits.

Two-Step Media Optimization

Integrated browser-image-compression on the Next.js client to significantly compress images before sending. On the backend, used multer to handle data and stream optimized media directly to Cloudinary.

Securing User Privacy and Message Content

Storing plain text messages in the database poses a significant security risk if the database is ever compromised.

Custom AES Data Encryption

Developed custom encryption and decryption functions using Node's native crypto module tied to Mongoose schema middleware, automatically encrypting messages before saving and decrypting when requested.