Varta
Varta is a real-time chat application that combines the power of global group chat with secure private messaging. Built with modern web technologies and enterprise-grade encryption, it provides a seamless communication experience with advanced security features.
Install / Use
/learn @chaubeysatyam/VartaREADME
🚀 Varta - Advanced Private & Global Chat Application
<div align="center"> <img src="https://img.shields.io/badge/Node.js-43853D?style=for-the-badge&logo=node.js&logoColor=white" alt="Node.js"> <img src="https://img.shields.io/badge/Express.js-404D59?style=for-the-badge" alt="Express.js"> <img src="https://img.shields.io/badge/Socket.io-010101?style=for-the-badge&logo=socket.io&logoColor=white" alt="Socket.io"> <img src="https://img.shields.io/badge/JavaScript-F7DF1E?style=for-the-badge&logo=javascript&logoColor=black" alt="JavaScript"> <img src="https://img.shields.io/badge/HTML5-E34F26?style=for-the-badge&logo=html5&logoColor=white" alt="HTML5"> <img src="https://img.shields.io/badge/CSS3-1572B6?style=for-the-badge&logo=css3&logoColor=white" alt="CSS3"> </div> <p align="center"> <img src="https://github.com/chaubeysatyam/Varta/blob/1e9c41ab7b5d195c32209d53fcf2d2852d9b670a/Varta/images/1.png" alt="Screenshot 1" width="420" /> <img src="https://github.com/chaubeysatyam/Varta/blob/1e9c41ab7b5d195c32209d53fcf2d2852d9b670a/Varta/images/2.png" width="420" /> <img src="https://github.com/chaubeysatyam/Varta/blob/1e9c41ab7b5d195c32209d53fcf2d2852d9b670a/Varta/images/3.png" width="420" /> </p> <p align="center"> <img src="https://github.com/chaubeysatyam/Varta/blob/1e9c41ab7b5d195c32209d53fcf2d2852d9b670a/Varta/images/4.png" alt="Screenshot 4" width="420" /> <img src="https://github.com/chaubeysatyam/Varta/blob/1e9c41ab7b5d195c32209d53fcf2d2852d9b670a/Varta/images/5.png" alt="Screenshot 5" width="420" /> <img src="https://github.com/chaubeysatyam/Varta/blob/1e9c41ab7b5d195c32209d53fcf2d2852d9b670a/Varta/images/7.png" alt="Screenshot 6" width="420" /> </p> <p align="center"> <em>A clean, modern, and powerful project — lightweight yet production ready.</em> </p>📋 Table of Contents
- Overview
- Features
- Installation
- Usage
- Architecture
- Security Features
- API Documentation
- File Structure
🌟 Overview
Varta is a real-time chat application that combines the power of global group chat with secure private messaging. Built with modern web technologies and enterprise-grade encryption, it provides a seamless communication experience with advanced security features.
Key Highlights
- 🔐 End-to-End Encryption - All messages and files are encrypted using AES-256-GCM
- 🌐 Dual Chat System - Global chat for group discussions + Private chat for one-on-one conversations
- 📱 Responsive Design - Works perfectly on desktop, tablet, and mobile devices
- 🚀 Real-time Communication - Powered by Socket.io and WebSockets
- 📁 File Sharing - Support for images, videos, documents, and more
- 👤 User Management - Profile pictures, online status, and user authentication
✨ Features
🔐 Security Features
- AES-256-GCM Encryption: Military-grade encryption for all data at rest
- JWT Authentication: Secure token-based authentication system
- Password Hashing: bcryptjs for secure password storage
- File Encryption: All uploaded files are encrypted before storage
- Secure Key Management: Automatic encryption key generation and management
💬 Chat Features
- Global Chat: Real-time group messaging with all registered users
- Private Chat: Secure one-on-one conversations
- Typing Indicators: See when someone is typing in real-time
- Online Status: Live user presence indicators
- Message History: Persistent message storage with encryption
- File Sharing: Upload and share various file types
- Image Preview: Click to view images in full-screen modal
- Message Timestamps: Precise timing for all messages
📁 File Sharing
- Supported Formats:
- Images: JPG, PNG, GIF, WebP, SVG, BMP, ICO
- Videos: MP4, AVI, MOV, WebM
- Audio: MP3, WAV, OGG
- Documents: PDF, DOC, DOCX, TXT, CSV
- Presentations: PPT, PPTX
- Archives: ZIP, RAR, 7Z, TAR
- Apps: APK files
- File Size Limit: 50MB per file
- Encrypted Storage: All files are encrypted before storage
- Preview Support: Image and video previews before sending
👤 User Management
- User Registration: Simple username/password registration
- Profile Pictures: Customizable profile pictures with encryption
- User Colors: Unique color coding for each user
- Online Status: Real-time online/offline indicators
- User Search: Search functionality in private chat
- Session Management: 30-day persistent login sessions
🎨 User Interface
- Modern Design: Clean, Discord-inspired interface
- Responsive Layout: Works on all screen sizes
- Dark Theme: Easy on the eyes with dark color scheme
- Mobile Support: Touch-friendly interface with swipe gestures
- Sidebar Navigation: Collapsible sidebar for better space usage
- Modal Windows: Full-screen image viewing
- Smooth Animations: Polished user experience
🚀 Installation
Prerequisites
- Node.js (v14 or higher)
- npm (Node Package Manager)
- Git (for cloning the repository)
Step 1: Clone the Repository
git clone https://github.com/chaubeysatyam/Varta.git
cd Varta
cd varta
Step 2: Install Dependencies
npm install
Step 3: Install Dependencies For Private Chat
cd public/private
npm install
Go Back To Root Folder (all server files):
cd ..
cd ..
🚀 Start the Servers (VERY IMPORTANT)
⚠️ YOU MUST RUN TWO SERVERS IN TWO DIFFERENT TERMINALS
Terminal 1 – Main Server
node server.js
Terminal 2 – Private Chat Server
node priserver.js
✅ Keep both terminals running while you use the project.
Step 4: Access the Application
- Global Chat: http://localhost:3000
- Private Chat: http://localhost:4000/public/private/index.html
🎯 Usage
Getting Started
- Register: Create a new account with username and password
- Login: Use your credentials to access the chat
- Global Chat: Join the main chat room to communicate with all users
- Private Chat: Click on any user to start a private conversation
Global Chat Features
- View all online users in the sidebar
- Send text messages and files
- See typing indicators from other users
- Upload and change your profile picture
- View message history
Private Chat Features
- Select any user to start a private conversation
- Send encrypted messages and files
- Delete entire conversation history
- Search for users
- Real-time typing indicators
File Sharing
- Click the paperclip icon in the message input
- Select your file (up to 50MB)
- Preview the file before sending
- Send the file - it will be encrypted and stored securely
🏗️ Architecture
Backend Architecture
┌─────────────────┐ ┌─────────────────┐
│ Global Chat │ │ Private Chat │
│ Server (3000) │ │ Server (4000) │
└─────────────────┘ └─────────────────┘
│ │
└───────────┬───────────┘
│
┌─────────────────┐
│ Encryption │
│ Layer │
└─────────────────┘
│
┌─────────────────┐
│ File Storage │
│ (Encrypted) │
└─────────────────┘
Technology Stack
- Backend: Node.js, Express.js
- Real-time: Socket.io, WebSockets
- Database: JSON files with encryption
- Authentication: JWT, bcryptjs
- Encryption: Node.js crypto module (AES-256-GCM)
- File Upload: Multer
- Frontend: Vanilla JavaScript, HTML5, CSS3
🔒 Security Features
Encryption Implementation
- Algorithm: AES-256-GCM (Galois/Counter Mode)
- Key Management: Automatic key generation and storage
- Data at Rest: All JSON files and uploaded files are encrypted
- Authentication: JWT tokens with expiration
- Password Security: bcryptjs with salt rounds
Security Measures
- Input Validation: All user inputs are validated and sanitized
- File Type Restrictions: Only allowed file types can be uploaded
- Size Limits: 50MB file size limit to prevent abuse
- Secure Headers: Proper content-type headers for file serving
- Error Handling: Secure error messages without sensitive information
📚 API Documentation
Global Chat Server (Port 3000)
Authentication Endpoints
POST /register
Content-Type: application/json
{
"username": "string",
"password": "string"
}
POST /login
Content-Type: application/json
{
"username": "string",
"password": "string"
}
File Upload Endpoints
POST /upload
Content-Type: multipart/form-data
file: [binary data]
POST /upload-profile
Content-Type: multipart/form-data
profile: [image file]
userId: "string"
Private Chat Server (Port 4000)
Authentication Endpoints
POST /register
Content-Type: application/json
{
"username": "string",
"password": "string"
}
POST /login
Content-Type: application/json
{
"username": "string",
"password": "string"
}
User Management
GET /users
Returns: Array of users with online status
File Operations
POST /upload
Content-Type: multipart/form-data
file: [binary data]
POST /upload-profile-pic
Content-Type: multipart/form-data
profilePic: [image file]
username: "string"
Conversation Management
POST /delete-conversation
Content-Type: application/json
{
"from": "string",
"to": "string"
}
📁 File Structure
Varta/
├── 📁 public/ # Frontend files
│ ├── 📁 private/ # Private chat frontend
│ │ ├── index.html # Private chat HTML
│ │ ├── script.js # Private chat JavaScript
│ │ ├── pristyles.css # Pri
