Skip to content
/ v7chat Public

Enterprise-grade secure real-time chat platform

License

Notifications You must be signed in to change notification settings

v74all/v7chat

Repository files navigation

V7Chat Enterprise

V7Chat Logo

Enterprise-grade secure real-time chat platform

FeaturesQuick StartDeploymentSecurityAPI


Features

🔐 Security First

  • End-to-End Encryption — Signal Protocol-inspired encryption with X3DH and Double Ratchet
  • Zero-Knowledge Architecture — Server cannot read your messages
  • Perfect Forward Secrecy — Automatic key rotation protects past messages
  • JWT Authentication — RS256 tokens with device fingerprinting
  • Two-Factor Authentication — TOTP-based 2FA with backup codes
  • Enterprise Password Policy — 12+ character requirements with complexity rules

💬 Real-Time Communication

  • Instant Messaging — WebSocket-powered real-time messaging
  • Typing Indicators — See when others are typing
  • Read Receipts — Message delivery and read status
  • Reactions — Emoji reactions on messages
  • Threading — Reply to specific messages
  • Self-Destructing Messages — Disappearing messages with timer
  • Advanced Search — Full-text search across messages, users, and files
  • Message Pinning — Pin important messages in rooms

📞 Voice & Video

  • WebRTC Calls — Encrypted peer-to-peer audio/video calls
  • Screen Sharing — Share your screen during calls
  • Group Calls — Multi-party video conferences
  • Call History — Track all past calls and durations

🔔 Notifications & Presence

  • Smart Notifications — In-app, email, and push notifications
  • Presence System — Real-time online/offline/away status
  • Custom Status — Set custom status messages
  • Activity Tracking — Track user activity and engagement
  • Notification Preferences — Granular control over notification types

📁 File Sharing

  • Encrypted Uploads — Files encrypted before upload
  • Virus Scanning — ClamAV integration for malware detection
  • Image Thumbnails — Automatic thumbnail generation
  • Storage Options — Local storage or S3-compatible cloud storage

🛡️ Admin Features

  • User Management — Full user lifecycle management
  • Room Moderation — Role-based room access control
  • Audit Logging — Tamper-proof activity logs
  • Real-time Monitoring — Prometheus metrics & Grafana dashboards
  • System Analytics — Comprehensive usage statistics and insights
  • Automated Backups — Scheduled database backups with S3 support
  • Health Monitoring — Continuous health checks for all components
  • Performance Analytics — Track message volume, user engagement, and trends

⚡ Performance & Scalability

  • Redis Caching — Multi-layer caching for frequently accessed data
  • Distributed Rate Limiting — Redis-backed rate limiting
  • Connection Pooling — Optimized database connections
  • Query Optimization — Indexed queries and aggregation pipelines
  • Adaptive Rate Limiting — Dynamic rate limits based on user behavior

Quick Start

Prerequisites

  • Node.js 18+
  • MongoDB 7.0+
  • Redis 7+

Installation

# Clone the repository
git clone https://github.com/v74all/v7chat.git
cd v7chat

# Run the setup wizard
node scripts/setup-wizard.js

# Install dependencies
npm install

# Start the server
npm run dev

Docker (Recommended)

# One-command installation
sudo bash scripts/install.sh --domain your-domain.com

# Or with Docker Compose manually
cd docker
docker compose up -d

Access V7Chat at https://localhost or your configured domain.


Deployment

Docker Deployment

# Production deployment
cd docker
docker compose -f docker-compose.yml up -d

# With monitoring (Prometheus + Grafana)
docker compose --profile monitoring up -d

# View logs
docker compose logs -f v7chat

Manual Deployment

# Install dependencies
npm ci --production

# Set environment variables
cp .env.example .env
# Edit .env with your configuration

# Start with PM2
pm2 start src/server.js --name v7chat

Environment Variables

Variable Description Default
NODE_ENV Environment mode development
PORT Server port 3000
MONGODB_URI MongoDB connection string mongodb://localhost:27017/v7chat
REDIS_HOST Redis host localhost
JWT_SECRET JWT signing secret required
ENCRYPTION_KEY E2E encryption key required

See .env.example for full configuration options.


Security

End-to-End Encryption

V7Chat implements a Signal Protocol-inspired encryption system:

  1. X3DH Key Agreement — Extended Triple Diffie-Hellman for session establishment
  2. Double Ratchet — Forward secrecy with message-level key rotation
  3. AES-256-GCM — Authenticated symmetric encryption for messages
  4. Ed25519 — Digital signatures for identity verification

Authentication Flow

[Client] → Register/Login → [Server]
          ← JWT Access Token (15min) ←
          ← Refresh Token (7 days, HttpOnly cookie) ←
          
[Client] → API Request + Bearer Token → [Server]
          ← Response ←
          
[Client] → Refresh Token → [Server]
          ← New Access Token ←

Security Headers

All responses include:

  • Strict-Transport-Security — HSTS with preload
  • Content-Security-Policy — Strict CSP
  • X-Content-Type-Options — nosniff
  • X-Frame-Options — DENY
  • Referrer-Policy — strict-origin-when-cross-origin

API

Authentication

# Register
POST /api/auth/register
{
  "username": "johndoe",
  "email": "john@example.com",
  "password": "SecureP@ss123!"
}

# Login
POST /api/auth/login
{
  "email": "john@example.com",
  "password": "SecureP@ss123!"
}

# Logout
POST /api/auth/logout

# Refresh Token
POST /api/auth/refresh

Notifications

# Get notifications
GET /api/notifications?limit=50&unreadOnly=true

# Mark as read
PUT /api/notifications/:notificationId/read

# Mark all as read
PUT /api/notifications/read-all

# Clear all notifications
DELETE /api/notifications

Search

# Universal search
GET /api/search?q=keyword&type=all

# Search messages
GET /api/search/messages?q=keyword&roomId=...&dateFrom=...

# Get search suggestions
GET /api/search/suggestions?q=key

# Clear search history
DELETE /api/search/history

Presence

# Get user presence
GET /api/presence/:userId

# Update status
PUT /api/presence/status
{
  "status": "away",
  "customMessage": "In a meeting"
}

# Get bulk presence
GET /api/presence/bulk?userIds=id1,id2,id3

Analytics

# Get user analytics
GET /api/analytics/user?period=30

# Get room analytics
GET /api/analytics/room/:roomId?period=7

# Get system analytics (admin only)
GET /api/analytics/system?period=30

# Get engagement report
GET /api/analytics/engagement?period=7

Rooms

# Get user's rooms
GET /api/rooms

# Create room
POST /api/rooms
{
  "name": "Team Chat",
  "type": "private",
  "encrypted": true
}

# Get messages
GET /api/rooms/:roomId/messages?limit=50

WebSocket Events

// Connect with authentication
const socket = io({
  auth: { token: accessToken }
});

// Send message
socket.emit('message:send', {
  roomId: '...',
  content: 'encrypted content',
  encryption: { iv: '...', authTag: '...' }
});

// Receive message
socket.on('message:new', (data) => {
  console.log(data.message);
});

// Typing indicator
socket.emit('message:typing', { roomId: '...' });

// Call signaling
socket.emit('call:offer', { targetUserId: '...', offer: rtcOffer });

Development

Project Structure

v7chat/
├── src/
│   ├── admin/          # Admin controllers & operations
│   ├── analytics/      # Analytics & reporting
│   ├── auth/           # Authentication & authorization
│   ├── backup/         # Backup & restore services
│   ├── cache/          # Caching layer
│   ├── config/         # Configuration management
│   ├── crypto/         # E2E encryption modules
│   ├── database/       # MongoDB & Redis connections
│   ├── files/          # File upload & management
│   ├── messaging/      # Socket.IO handlers
│   ├── middleware/     # Express middleware & rate limiting
│   ├── models/         # Mongoose models
│   ├── monitoring/     # Logging, metrics & health checks
│   ├── notifications/  # Notification service
│   ├── presence/       # Presence & activity tracking
│   ├── rooms/          # Room management
│   ├── search/         # Search functionality
│   ├── users/          # User management
│   ├── utils/          # Utilities (email, etc.)
│   ├── validators/     # Input validation
│   ├── webrtc/         # WebRTC call management
│   └── server.js       # Main entry point
├── public/             # Static files & client JS
├── docker/             # Docker configuration
├── scripts/            # Installation & setup
└── backups/            # Automated backups directory

Code Style

# Lint code
npm run lint

# Auto-fix issues
npm run lint:fix

# Format with Prettier
npm run format

Monitoring

Prometheus Metrics

Available at /metrics:

  • v7chat_http_requests_total — Total HTTP requests
  • v7chat_active_connections — WebSocket connections
  • v7chat_messages_sent_total — Messages sent
  • v7chat_auth_attempts_total — Auth attempts by result

Grafana Dashboards

Access Grafana at http://localhost:3001 (default: admin/admin).

Pre-configured dashboards:

  • System Overview
  • Real-time Connections
  • Message Analytics
  • Security Events

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing)
  5. Open a Pull Request

License

MIT License — see LICENSE for details.


V7Chat Enterprise by V7LTHRONYX

About

Enterprise-grade secure real-time chat platform

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published