Overview
RapidChat is a modern, real-time messaging application that brings instant communication to your fingertips. Built with cutting-edge web technologies, it offers lightning-fast message delivery, sleek user interface, and robust security features. Whether connecting with friends, family, or colleagues, RapidChat provides a seamless chat experience with real-time updates and presence indicators.
Real-Time Performance
Messages are delivered instantly using WebSocket technology (Socket.io), ensuring zero-delay communication between users. See online/offline status in real-time!
Core Features
Real-Time Communication
Instant Messaging
- Zero-Latency Delivery - Messages appear instantly with Socket.io
- Message History - Access complete conversation history
- Typing Indicators - See when someone is typing
- Read Receipts - Know when messages are seen
- Message Timestamps - Precise delivery time tracking
Media Sharing
- Image Upload - Share photos directly in chat
- File Attachments - Send documents and files
- Emoji Support - Express emotions with emojis
- Link Previews - Auto-generate previews for shared URLs
Chat Management
- Private Conversations - One-on-one secure messaging
- Search Messages - Find specific messages quickly
- Delete Messages - Remove sent messages
- Pin Important Chats - Keep important conversations at top
Beautiful Interface
Modern Design
- Clean, distraction-free chat interface
- Intuitive navigation
- Smooth animations and transitions
- Dark mode support with DaisyUI
- Mobile-responsive layout
Presence System
- Online/Offline Status - Real-time user availability
- Last Seen - When user was last active
- Active Now - See who's currently online
- Status Updates - Automatic presence detection
User Profiles
- Profile pictures and avatars
- Custom display names
- Bio and status messages
- Account settings management
Notifications
- Real-time message notifications
- Browser push notifications
- Sound alerts (customizable)
- Unread message counters
Security Features
Authentication
- Secure user registration
- Email verification
- Password encryption with bcrypt
- JWT token-based sessions
- Secure cookie storage
Privacy Controls
- End-to-end communication security
- HTTPS encryption
- Rate limiting with Arcjet
- XSS protection
- CSRF prevention
Data Protection
- Encrypted password storage
- Secure token management
- Session timeout handling
- Account recovery options
- Data validation on all inputs
Technology Stack
Frontend Technologies
React.js - Modern UI library
- Component-based architecture
- React Hooks for state management
- Custom hooks for reusability
- Optimized rendering with useMemo/useCallback
TypeScript - Type-safe development
- Static type checking
- Enhanced IDE support
- Better code documentation
- Reduced runtime errors
Tailwind CSS - Utility-first styling
- Responsive design system
- Custom theme configuration
- JIT compiler for optimal builds
- Dark mode support
DaisyUI - Tailwind component library
- Pre-built UI components
- Theme system integration
- Consistent design language
- Accessibility features
Zustand - Lightweight state management
- Minimal boilerplate
- React hooks-based API
- DevTools support
- TypeScript-friendly
Backend Technologies
Node.js - JavaScript runtime
- Non-blocking I/O
- Event-driven architecture
- High performance
- Extensive package ecosystem
Express.js - Web framework
- RESTful API design
- Middleware architecture
- Error handling
- Route management
MongoDB - NoSQL database
- Flexible document structure
- Horizontal scalability
- Rich query capabilities
- Aggregation framework
Socket.io - Real-time engine
- WebSocket communication
- Automatic reconnection
- Room support
- Event-based messaging
Security & DevOps
Arcjet - API rate limiting
- Request rate control
- Bot protection
- DDoS prevention
- Custom rules
pnpm - Fast package manager
- Efficient disk space usage
- Faster installations
- Strict dependency resolution
Git & GitHub - Version control
- Collaborative development
- Code history tracking
- Branch management
Vercel - Deployment platform
- Automatic deployments
- Global CDN
- Serverless functions
- Zero configuration
Real-Time Architecture
WebSocket Connection
When a user logs in:
- Client establishes WebSocket connection to server
- Unique socket ID assigned to user
- User marked as "online" in presence system
- Previous messages loaded from database
Message Sending
When a message is sent:
- Message validated on client
- Sent via Socket.io emit event
- Server receives and stores in MongoDB
- Server broadcasts to recipient's socket
- Recipient UI updates instantly
Presence Updates
Real-time presence tracking:
- Socket connection/disconnection triggers status updates
- "Online" status when connected
- "Offline" status when disconnected
- Last seen timestamp updated
- Status broadcast to relevant users
Typing Indicators
When user types:
- Typing event emitted to server
- Server forwards to recipient
- "is typing..." indicator shown
- Auto-clears after timeout
- No database storage required
User Experience Flow
Registration & Login
New users:
- Complete registration form with email and password
- Password hashed with bcrypt before storage
- JWT token generated upon successful login
- Token stored securely in HTTP-only cookie
- Redirected to chat dashboard
Chat Dashboard
After login, users see:
- List of conversations
- Online/offline status of contacts
- Unread message counts
- Search bar to find contacts
- Quick access to settings
Starting a Conversation
To chat with someone:
- Search for user by name or email
- Click to open conversation
- Previous messages load from history
- Real-time socket connection established
- Type and send messages instantly
Sending Messages
Message flow:
- Type in message input field
- Press Enter or click Send
- Message appears immediately (optimistic UI)
- Server confirmation received
- Recipient sees message in real-time
Media Sharing
To share images:
- Click attachment icon
- Select image from device
- Preview before sending
- Image uploaded to server
- Thumbnail generated
- Recipient can view or download
API Rate Limiting
Arcjet Protection
RapidChat uses Arcjet for intelligent rate limiting, protecting the API from abuse, spam, and DDoS attacks while ensuring legitimate users have seamless access.
Rate Limit Rules
Authentication Endpoints
- Login: 5 attempts per 15 minutes
- Registration: 3 attempts per hour
- Password reset: 3 attempts per hour
Messaging Endpoints
- Send message: 100 per minute per user
- Upload media: 10 per minute per user
- Fetch history: 30 per minute per user
General API
- Other endpoints: 200 requests per minute per IP
Protection Benefits
- DDoS Prevention - Blocks flood attacks
- Spam Reduction - Limits message spam
- Resource Protection - Prevents server overload
- Fair Usage - Ensures equal access for all users
State Management with Zustand
RapidChat uses Zustand for efficient state management:
Global State Stores
Auth Store
- currentUser
- isAuthenticated
- login()
- logout()
- updateProfile()Chat Store
- conversations
- activeChat
- messages
- setActiveChat()
- sendMessage()
- receiveMessage()UI Store
- theme (light/dark)
- notifications
- modals
- toggleTheme()Presence Store
- onlineUsers
- updatePresence()
- getUserStatus()Benefits
- Minimal boilerplate compared to Redux
- TypeScript support out of the box
- No context providers needed
- Easy to test and debug
- Excellent performance
Performance Optimizations
Use Cases
Scenario 1: Team Communication
A small team uses RapidChat for:
- Quick project updates
- Sharing screenshots and files
- Instant problem-solving
- Knowing who's available (online status)
- Keeping conversation history
Scenario 2: Customer Support
Businesses leverage RapidChat for:
- Real-time customer inquiries
- Instant support responses
- File and documentation sharing
- Conversation history review
- Support team collaboration
Scenario 3: Social Connections
Friends and family use it to:
- Stay connected across distances
- Share daily moments with photos
- Have private conversations
- See when loved ones are online
- Quick catch-ups
Frequently Asked Questions
Technical Highlights
Socket.io Event System
Client-Side Events
connect- Connection establisheddisconnect- Connection lostsend-message- Send new messagetyping- User is typingstop-typing- User stopped typing
Server-Side Events
new-message- Broadcast new messagemessage-delivered- Delivery confirmationuser-online- User came onlineuser-offline- User went offlinetyping-indicator- Forward typing status
Database Schema
Users Collection
{
_id: ObjectId
email: string
username: string
password: string (hashed)
avatar: string
bio: string
lastSeen: Date
createdAt: Date
}Messages Collection
{
_id: ObjectId
senderId: ObjectId
receiverId: ObjectId
content: string
mediaUrl: string?
isRead: boolean
timestamp: Date
}Conversations Collection
{
_id: ObjectId
participants: [ObjectId]
lastMessage: ObjectId
updatedAt: Date
}Project Structure
Getting Started
Visit RapidChat
Navigate to rapidchat.naseemkhan.dev to access the application.
Create Account
Sign up with your email and choose a secure password. Your account will be created instantly.
Start Chatting
Search for other users and start conversations. Experience real-time messaging with instant delivery!
Explore Features
Try sending messages, sharing images, and notice how online status updates in real-time.
Future Enhancements
- Group Chats - Multi-user conversations
- Voice Messages - Audio recording and playback
- Video Calls - WebRTC-based video chat
- Message Reactions - Emoji reactions to messages
- Message Editing - Edit sent messages
- Voice/Video Calls - Real-time calling
- Screen Sharing - Share screen in calls
- Message Forwarding - Forward messages to other chats
- Custom Themes - User-selectable color schemes
- Mobile Apps - Native iOS and Android apps
- Desktop App - Electron-based desktop application
- Message Encryption - End-to-end encryption
- Bot Integration - Chat bots and automation
Live Demo
Experience RapidChat's real-time messaging at rapidchat.naseemkhan.dev. Create an account and start chatting instantly!
