Skip to content

voidgod888/Connect-sphere-

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

32 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

ConnectSphere Banner

๐ŸŒ ConnectSphere

Connect with the World Through Next-Generation Video Chat

A modern, feature-rich video chat platform that brings people together across continents, cultures, and languages.

React TypeScript Node.js Socket.io

๐Ÿš€ Quick Start โ€ข โœจ Features โ€ข ๐Ÿ“– Documentation โ€ข ๐Ÿ› ๏ธ API Reference


๐ŸŽฏ What is ConnectSphere?

ConnectSphere is a next-generation video chat platform designed to connect people from around the world through secure, real-time video communication. Built with cutting-edge web technologies, it offers a comprehensive suite of features including smart matching, gamification, premium subscriptions, and robust safety controls.

Perfect for:

  • ๐Ÿค Making new friends across the globe

  • ๐Ÿ—ฃ๏ธ Practicing foreign languages with native speakers

  • ๐ŸŒ Exploring different cultures and perspectives

  • ๐ŸŽฎ Meeting people who share your interests

  • ๐Ÿ“š Learning and cultural exchange

  • ๐ŸŽฅ HD Video Chat - Real-time peer-to-peer video streaming

  • ๐ŸŽฎ Smart Matching - Partner matching based on interests, language, and preferences

  • ๐Ÿ”“ No Login Required - Start chatting instantly without creating an account

  • ๐ŸŽ 100% Free - All features are completely free with no subscriptions or paywalls

  • ๐Ÿ›ก๏ธ Safety First - Comprehensive moderation, reporting, and teen safety features

  • ๐ŸŒ Global Reach - Connect with users from around the world

  • โšก Optimized - Adaptive bitrate streaming and connection quality monitoring

  • ๐Ÿ”’ Anonymous - Chat privately without revealing your identity


โœจ Features

๐ŸŽฏ Intelligent Matching System

  • Interest-Based Matching - Select up to 5 interests for better connections
  • Language Preferences - Match with users who speak your languages
  • Age Range Filter - Connect with users in your preferred age range (13+)
  • Country Filtering - Match by country or go global
  • Queue Statistics - Real-time queue status and estimated wait times
  • Safe Mode - Match only with verified users

Interest-Based Matching

  • Select up to 5 interests from 18+ categories
  • Gaming, Music, Sports, Movies, Art, Technology, and more
  • Backend algorithm pairs users with shared interests
  • Better conversations through common ground

Language Preferences

  • Choose up to 3 languages you speak
  • 17+ language options available
  • Match with users who speak common languages
  • Break down language barriers naturally

Advanced Filtering

  • Age Range: Filter by age (13-99) with dual slider
  • Country Filter: Match by country or go global
  • Safe Mode: Match only with verified users (Premium)
  • Queue Statistics: See active users, wait times, and your position

๐ŸŽ All Features Are Free

  • HD Video Quality - High-quality video streaming for everyone
  • Unlimited Skips - Skip as many times as you want
  • Custom Username - Set your own unique username
  • Advanced Filters - Age range, interests, languages, and country filters
  • No Ads - Completely ad-free experience
  • Priority Matching - Fast matching for all users
  • No Hidden Costs - Everything is free forever Smart Queue
  • Real-time queue position tracking
  • Estimated wait time calculation
  • Active users breakdown by region
  • Live connection status indicator

๐Ÿ† Gamification & Engagement

Statistics Dashboard

  • ๐Ÿ“Š Total chats completed
  • โฑ๏ธ Total time spent chatting
  • ๐ŸŒ Countries connected (with list)
  • ๐Ÿ”ฅ Current & longest streaks
  • โญ Average rating (1-5 stars)
  • ๐Ÿ… Global rank position

Achievement System Unlock 8 built-in achievements:

  • ๐ŸŽ‰ First Contact - Complete first chat
  • ๐ŸŒ Globe Trotter - Chat with 50 countries
  • ๐Ÿฆ‰ Night Owl - 100 chats after midnight
  • ๐Ÿ—ฃ๏ธ Polyglot - Chat in 5 languages

Leaderboard

  • ๐Ÿ† Global top 100 rankings
  • ๐Ÿฅ‡๐Ÿฅˆ๐Ÿฅ‰ Medals for top 3 users
  • โญ Star ratings for top performers
  • ๐ŸŽฏ Track your rank progress
  • ๐Ÿ”„ Real-time rank updates

More Achievements

  • โฑ๏ธ Marathon Chatter - 1-hour chat
  • ๐Ÿฆ‹ Social Butterfly - 100 chats
  • ๐Ÿ”ฅ Streak Master - 7-day streak
  • โญ Highly Rated - 50 five-star ratings

๐ŸŽจ User Experience Excellence

5 Beautiful Themes

  • ๐ŸŒ™ Dark - Classic dark mode (default)
  • โ˜€๏ธ Light - Bright and clean
  • ๐ŸŒŠ Ocean - Calming blue gradients
  • ๐Ÿ”ฎ Purple - Vibrant purple tones
  • ๐ŸŒฒ Forest - Natural green hues

Advanced Settings

  • Connection Quality presets (Auto/High/Medium/Low)
  • 4-level Profanity Filter (Off/Low/Medium/High)
  • Minimum chat duration (0-60 seconds)
  • Auto-skip mismatch toggle
  • Typing indicator visibility

Keyboard Shortcuts

  • Ctrl + Enter - Find next partner
  • Esc - Stop current chat
  • M - Toggle microphone
  • C - Toggle camera
  • Ctrl + S - Open settings
  • Ctrl + K - Show shortcuts
  • R - Report user

Connection Monitoring

  • Real-time quality indicator
  • Latency, bandwidth, packet loss metrics
  • Network diagnostics tool
  • Connection optimization tips

๐Ÿ’Ž Premium & Monetization

๐Ÿ†“ Free ๐Ÿ’Ž Premium ($4.99/mo) ๐Ÿ‘‘ VIP ($9.99/mo)

โœ… Basic matching
โœ… Standard video quality
โœ… Text chat
โœ… Basic filters
โœ… 5 themes
โš ๏ธ 5 skips/hour
โš ๏ธ Contains ads

โœ… All Free features
โœ… HD video quality
โœ… Advanced filters
โœ… Unlimited skips
โœ… No ads
โœ… Priority matching
โœ… Custom username
๐ŸŽ 500 bonus coins

โœ… All Premium features
โœ… 4K video quality
โœ… Profile boost
โœ… Exclusive VIP badge
โœ… Verified users only
โœ… Chat history backup
โœ… Virtual gifts
โœ… Priority support
๐ŸŽ 1200 bonus coins

Virtual Currency System

  • ๐Ÿ’ฐ Earn coins through daily logins and achievements
  • ๐Ÿ›’ Purchase coin packages ($0.99 - $14.99)
  • ๐Ÿš€ Spend on profile boosts (100 coins = 24hr boost)
  • ๐ŸŽ Buy virtual gifts for chat partners
  • ๐Ÿ“œ Complete transaction history

๐Ÿ›ก๏ธ Safety & Security

Enhanced Reporting 6 detailed report categories:

  • ๐Ÿšซ Inappropriate Content (nudity, sexual)
  • ๐Ÿ˜  Harassment (bullying, threats)
  • ๐Ÿ“ง Spam (unwanted advertising)
  • ๐Ÿ‘ถ Underage User (under 13)
  • โš ๏ธ Violence (threats, dangerous behavior)
  • โ“ Other (TOS violations)

Features:

  • Detailed 500-character descriptions
  • Auto-block reported users
  • Report history tracking
  • False report penalties
  • Priority review for teen reports (<1hr)

Teen Safety Mode (Ages 13+)

  • ๐Ÿ‘ฅ Age-appropriate matching (max 2-3 year gap)
  • โฑ๏ธ Session time limits (30-60 min by age)
  • ๐Ÿ“… Daily usage limits (2-4 hours by age)
  • ๐Ÿ›ก๏ธ Enhanced safety guidelines
  • ๐Ÿšจ Priority report review
  • ๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘ง Parental controls ready

Additional Protection

  • ๐Ÿคฌ 4-level profanity filter
  • โœ… User verification system
  • ๐Ÿ”’ Safe mode for verified users only
  • ๐Ÿšซ Comprehensive block system
  • ๐Ÿ” Secure authentication (Google/Apple)

โšก Performance & Optimization

  • Adaptive Bitrate Streaming - Auto-adjusts video quality (240p-1080p) based on connection
  • Connection Quality Monitoring - Real-time latency, bandwidth, packet loss, and jitter tracking
  • Bandwidth Saver Mode - Reduce data usage by up to 60% (perfect for mobile)
  • Network Diagnostics - Built-in speed tests and connection recommendations
  • Device Optimization - Auto-detect and optimize for mobile/low-end devices
  • Quality Presets - High (720p/1080p), Medium (480p), Low (240p)

๐Ÿ“‹ Prerequisites

Before you begin, ensure you have the following installed and configured:

Required

  • โœ… Node.js 18+ (includes npm)
  • โœ… Modern Browser with WebRTC support (Chrome, Firefox, Edge, Safari)
  • โœ… Camera & Microphone (for video chat)

Optional (for Authentication)

  • ๐Ÿ”‘ Google OAuth 2.0 Credentials - Get credentials

  • ๐ŸŽ Apple Developer Account - Sign in with Apple setup

  • Node.js 18+ (for both frontend and backend)

  • npm or yarn package manager

  • Camera and Microphone (for video chat functionality)

  • HTTPS (required for camera/microphone access in browsers)

  • Modern Browser with WebRTC support (Chrome, Firefox, Edge, Safari)

Note: You can use mock authentication for local development without OAuth credentials.


๐Ÿš€ Quick Start

1๏ธโƒฃ Clone & Install Dependencies

# Clone the repository
git clone <repository-url>
cd connectsphere

# Install frontend dependencies
npm install

# Install backend dependencies
cd server
npm install
cd ..

2๏ธโƒฃ Configure Environment Variables

Frontend - Create .env in project root:

VITE_API_URL=http://localhost:3001/api
VITE_WS_URL=http://localhost:3001
VITE_GOOGLE_CLIENT_ID=your_google_client_id
VITE_APPLE_CLIENT_ID=com.your.bundle.id

Backend - Create server/.env:

PORT=3001
CLIENT_URL=http://localhost:3000
GOOGLE_CLIENT_ID=your_google_client_id_here
APPLE_CLIENT_ID=com.your.bundle.id
ALLOW_MOCK_AUTH=true  # Set to false in production
DATABASE_PATH=./data/connectsphere.db

Development Tip: Set ALLOW_MOCK_AUTH=true to bypass OAuth during development.

3๏ธโƒฃ Start the Application

Option A: Two Terminal Windows

# Terminal 1 - Backend Server
cd server
npm run dev
# Server runs on http://localhost:3001

# Terminal 2 - Frontend (in new terminal)
npm run dev
# App runs on http://localhost:3000

Option B: One-Command Start (requires concurrently)

npm install -g concurrently
concurrently "cd server && npm run dev" "npm run dev"

4๏ธโƒฃ Access the Application

5๏ธโƒฃ (Optional) Android Termux Setup

For running on Android devices using Termux:

connectsphere/
โ”œโ”€โ”€ components/              # React UI components
โ”‚   โ”œโ”€โ”€ AchievementBadge.tsx
โ”‚   โ”œโ”€โ”€ AdvancedSettingsPanel.tsx
โ”‚   โ”œโ”€โ”€ AgeVerification.tsx
โ”‚   โ”œโ”€โ”€ BandwidthSaverMode.tsx
โ”‚   โ”œโ”€โ”€ ChatHistory.tsx
โ”‚   โ”œโ”€โ”€ ChatInput.tsx
โ”‚   โ”œโ”€โ”€ ChatScreen.tsx
โ”‚   โ”œโ”€โ”€ ConnectionQualityIndicator.tsx
โ”‚   โ”œโ”€โ”€ Controls.tsx
โ”‚   โ”œโ”€โ”€ EnhancedReportModal.tsx
โ”‚   โ”œโ”€โ”€ InterestSelector.tsx
โ”‚   โ”œโ”€โ”€ KeyboardShortcutsPanel.tsx
โ”‚   โ”œโ”€โ”€ LanguageSelector.tsx
โ”‚   โ”œโ”€โ”€ LeaderboardPanel.tsx
โ”‚   โ”œโ”€โ”€ LoginScreen.tsx
โ”‚   โ”œโ”€โ”€ NetworkDiagnostics.tsx
โ”‚   โ”œโ”€โ”€ QueueStatsDisplay.tsx
โ”‚   โ”œโ”€โ”€ SettingsScreen.tsx
โ”‚   โ”œโ”€โ”€ StatsPanel.tsx
โ”‚   โ”œโ”€โ”€ TeenSafetyMode.tsx
โ”‚   โ”œโ”€โ”€ ThemeSelector.tsx
โ”‚   โ”œโ”€โ”€ Toast.tsx
โ”‚   โ””โ”€โ”€ VideoPlayer.tsx
โ”œโ”€โ”€ services/               # Frontend services
โ”‚   โ”œโ”€โ”€ api.ts             # REST API client
โ”‚   โ”œโ”€โ”€ connectionOptimization.ts
โ”‚   โ”œโ”€โ”€ socketService.ts   # WebSocket client
โ”‚   โ”œโ”€โ”€ yoloService.ts     # Gender detection service
โ”‚   โ””โ”€โ”€ yolo.worker.ts     # Web Worker for ML
โ”œโ”€โ”€ server/                # Backend server
โ”‚   โ”œโ”€โ”€ database/
โ”‚   โ”‚   โ””โ”€โ”€ db.js          # SQLite database & queries
โ”‚   โ”œโ”€โ”€ middleware/
โ”‚   โ”‚   โ”œโ”€โ”€ auth.js        # Authentication middleware
โ”‚   โ”‚   โ””โ”€โ”€ teenSafety.js  # Teen safety middleware
โ”‚   โ”œโ”€โ”€ routes/
โ”‚   โ”‚   โ”œโ”€โ”€ auth.js        # Authentication endpoints
โ”‚   โ”‚   โ”œโ”€โ”€ settings.js    # User settings
โ”‚   โ”‚   โ”œโ”€โ”€ stats.js       # Statistics & leaderboard
โ”‚   โ”‚   โ””โ”€โ”€ users.js       # User management
โ”‚   โ”œโ”€โ”€ services/
โ”‚   โ”‚   โ”œโ”€โ”€ appleAuth.js   # Apple authentication
โ”‚   โ”‚   โ””โ”€โ”€ matching.js    # Partner matching algorithm
โ”‚   โ”œโ”€โ”€ socket/
โ”‚   โ”‚   โ””โ”€โ”€ socketHandler.js # WebSocket handlers
โ”‚   โ””โ”€โ”€ index.js           # Express server entry point
โ”œโ”€โ”€ App.tsx                 # Main React component
โ”œโ”€โ”€ index.tsx              # React DOM entry point
โ”œโ”€โ”€ types.ts               # TypeScript definitions
โ”œโ”€โ”€ constants.ts           # App constants
โ””โ”€โ”€ vite.config.ts         # Vite configuration
```bash
# Install Node.js in Termux
pkg install nodejs

# Run the full stack
cd /workspace && npm install && cd server && npm install && cd .. && \
echo "PORT=3001" > server/.env && \
echo "CLIENT_URL=http://localhost:3000" >> server/.env && \
echo "ALLOW_MOCK_AUTH=true" >> server/.env && \
(cd server && npm start &) && sleep 3 && npm run dev

๐Ÿ“ Project Architecture

๐Ÿ—๏ธ High-Level Structure

connectsphere/
โ”œโ”€โ”€ ๐Ÿ“ฑ Frontend (React + TypeScript)
โ”‚   โ”œโ”€โ”€ components/          # UI components
โ”‚   โ”œโ”€โ”€ services/            # API & WebSocket services
โ”‚   โ”œโ”€โ”€ types.ts             # TypeScript definitions
โ”‚   โ”œโ”€โ”€ constants.ts         # App constants
โ”‚   โ””โ”€โ”€ App.tsx              # Main app component
โ”‚
โ”œโ”€โ”€ ๐Ÿ”ง Backend (Node.js + Express)
โ”‚   โ”œโ”€โ”€ server/
โ”‚   โ”‚   โ”œโ”€โ”€ routes/          # API endpoints
โ”‚   โ”‚   โ”œโ”€โ”€ services/        # Business logic
โ”‚   โ”‚   โ”œโ”€โ”€ middleware/      # Auth & validation
โ”‚   โ”‚   โ”œโ”€โ”€ socket/          # WebSocket handlers
โ”‚   โ”‚   โ”œโ”€โ”€ database/        # SQLite database
โ”‚   โ”‚   โ””โ”€โ”€ index.js         # Server entry point
โ”‚
โ””โ”€โ”€ ๐Ÿ“š Documentation
    โ”œโ”€โ”€ README.md            # This file
    โ”œโ”€โ”€ FEATURES_ADDED.md    # Feature documentation
    โ”œโ”€โ”€ QUICK_START.md       # Integration guide
    โ””โ”€โ”€ TEEN_SAFETY.md       # Safety features guide

๐Ÿ“ฆ Component Organization

components/
โ”œโ”€โ”€ ๐ŸŽฏ Matching & Discovery
โ”‚   โ”œโ”€โ”€ InterestSelector.tsx       # Interest tag selection
โ”‚   โ”œโ”€โ”€ LanguageSelector.tsx       # Language preferences
โ”‚   โ””โ”€โ”€ QueueStatsDisplay.tsx      # Queue statistics
โ”‚
โ”œโ”€โ”€ ๐Ÿ† Gamification
โ”‚   โ”œโ”€โ”€ StatsPanel.tsx             # User statistics dashboard
โ”‚   โ”œโ”€โ”€ AchievementBadge.tsx       # Achievement display
โ”‚   โ””โ”€โ”€ LeaderboardPanel.tsx       # Global leaderboard
โ”‚
โ”œโ”€โ”€ ๐ŸŽจ User Experience
โ”‚   โ”œโ”€โ”€ ThemeSelector.tsx          # Theme switcher
โ”‚   โ”œโ”€โ”€ AdvancedSettingsPanel.tsx  # Advanced settings
โ”‚   โ”œโ”€โ”€ KeyboardShortcutsPanel.tsx # Keyboard shortcuts
โ”‚   โ””โ”€โ”€ Toast.tsx                  # Toast notifications
โ”‚
โ”œโ”€โ”€ ๐Ÿ’Ž Premium
โ”‚   โ””โ”€โ”€ PremiumModal.tsx           # Subscription management
โ”‚
โ”œโ”€โ”€ ๐Ÿ›ก๏ธ Security
โ”‚   โ”œโ”€โ”€ EnhancedReportModal.tsx    # User reporting
โ”‚   โ”œโ”€โ”€ TeenSafetyMode.tsx         # Teen safety features
โ”‚   โ””โ”€โ”€ AgeVerification.tsx        # Age verification
โ”‚
โ”œโ”€โ”€ โšก Performance
โ”‚   โ”œโ”€โ”€ ConnectionQualityIndicator.tsx  # Quality monitoring
โ”‚   โ”œโ”€โ”€ BandwidthSaverMode.tsx          # Data optimization
โ”‚   โ””โ”€โ”€ NetworkDiagnostics.tsx          # Network testing
โ”‚
โ””โ”€โ”€ ๐Ÿ’ฌ Chat
    โ”œโ”€โ”€ ChatScreen.tsx             # Main chat interface
    โ”œโ”€โ”€ ChatInput.tsx              # Message input
    โ”œโ”€โ”€ ChatHistory.tsx            # Message history
    โ”œโ”€โ”€ VideoPlayer.tsx            # Video display
    โ””โ”€โ”€ Controls.tsx               # Video controls

๐Ÿ—„๏ธ Database Schema

9 Core Tables:

  • users - User accounts and profiles
  • user_settings - Advanced preferences
  • user_interests - Interest tags
  • user_languages - Language preferences
  • user_stats - Gamification statistics
  • achievements - Achievement definitions
  • user_achievements - User progress
  • ratings - User ratings after chats
  • transactions - Premium purchases & coins

๐Ÿ› ๏ธ API Reference

๐Ÿ” Authentication Endpoints

Method Endpoint Description Auth Required
POST /api/auth/google Google OAuth authentication No
POST /api/auth/apple Sign in with Apple No
POST /api/auth/mock Mock authentication (dev only) No
POST /api/auth/logout Logout and invalidate session Yes
GET /api/auth/verify Verify session token Yes

๐Ÿ‘ค User Endpoints

Method Endpoint Description Auth Required
GET /api/users/me Get current user profile Yes
PUT /api/users/me Update user profile Yes

Stats Endpoints (Optional)

๐Ÿ“Š Statistics Endpoints

Method Endpoint Description Auth Required
GET /api/stats/me Get user statistics Yes
GET /api/stats/leaderboard Get global leaderboard (top 100) Yes
POST /api/stats/rate Rate a chat partner (1-5 stars) Yes

๐Ÿ’Ž Premium Endpoints

Method Endpoint Description Auth Required
POST /api/premium/upgrade Upgrade subscription tier Yes
POST /api/premium/coins/purchase Purchase coin package Yes
POST /api/premium/boost Activate profile boost (100 coins) Yes
POST /api/premium/username Set custom username Yes (Premium)
GET /api/premium/transactions Get transaction history Yes

โš™๏ธ Settings Endpoints

Method Endpoint Description Auth Required
GET /api/settings/me Get all user settings Yes
PUT /api/settings/advanced Update advanced settings Yes
PUT /api/settings/interests Update interest tags (max 5) Yes
PUT /api/settings/languages Update languages (max 3) Yes

Settings Endpoints

๐Ÿ”Œ WebSocket Events

Client โ†’ Server Events

// Authentication
socket.emit('authenticate', { token: 'jwt_token_here' });

// Matching Queue
socket.emit('join-queue', { interests, languages, ageRange, country });
socket.emit('leave-queue');

// Chat
socket.emit('send-message', { message: 'Hello!', recipientId: 'user_id' });
socket.emit('end-match');
socket.emit('report-user', { userId, category, description });

// WebRTC Signaling
socket.emit('offer', { offer, target: 'user_id' });
socket.emit('answer', { answer, target: 'user_id' });
socket.emit('ice-candidate', { candidate, target: 'user_id' });

Server โ†’ Client Events

// Matching
socket.on('match-found', (partnerData) => { /* ... */ });
socket.on('match-ended', (reason) => { /* ... */ });

// Chat
socket.on('new-message', (message) => { /* ... */ });
socket.on('partner-typing', (isTyping) => { /* ... */ });

// WebRTC Signaling
socket.on('offer', (data) => { /* ... */ });
socket.on('answer', (data) => { /* ... */ });
socket.on('ice-candidate', (data) => { /* ... */ });

// System
socket.on('error', (error) => { /* ... */ });

๐Ÿ—๏ธ Technology Stack

Frontend Technologies

Technology Version Purpose
React 19.2.0 UI framework with modern hooks
TypeScript 5.8.2 Type-safe development
Vite 6.2.0 Lightning-fast build tool & dev server
Socket.io Client 4.5.4 Real-time WebSocket communication
Lucide React 0.552.0 Beautiful, customizable icons
Tailwind CSS - Utility-first CSS framework

Backend Technologies

Technology Purpose
Node.js 18+ JavaScript runtime environment
Express Fast, minimalist web framework
Socket.io Real-time bidirectional event-based communication
SQLite (better-sqlite3) Lightweight, serverless database
Google Auth Library OAuth 2.0 authentication
JOSE JWT handling for Apple Sign-In
Helmet Security middleware for Express
Express Rate Limit API rate limiting protection

Communication Protocols

  • WebSocket (Socket.io) - Real-time signaling and chat messages
  • WebRTC - Peer-to-peer video/audio streaming (signaling layer complete)
  • REST API - HTTP endpoints for data operations

๐Ÿ“– Documentation

๐Ÿ“š Additional Guides

๐ŸŽ“ Learning Resources

Getting Started:

  1. Read this README to understand the architecture
  2. Check QUICK_START.md for integration examples
  3. Review FEATURES_ADDED.md for detailed feature documentation
  4. Explore the codebase starting with App.tsx

Understanding the Flow:

  1. User authenticates via Google/Apple OAuth
  2. Socket connection established with JWT token
  3. User joins queue with preferences (interests, languages, age, country)
  4. Backend matching algorithm finds compatible partner
  5. WebRTC signaling establishes peer-to-peer video connection
  6. Users chat with text and video
  7. After chat, users can rate each other and unlock achievements

โš™๏ธ Configuration

๐ŸŒ Environment Variables Reference

Frontend Configuration (.env)

# API Configuration
VITE_API_URL=http://localhost:3001/api
VITE_WS_URL=http://localhost:3001

# Google OAuth
VITE_GOOGLE_CLIENT_ID=123456789.apps.googleusercontent.com

# Apple Sign In
VITE_APPLE_CLIENT_ID=com.yourcompany.connectsphere
VITE_APPLE_REDIRECT_URI=http://localhost:3000/auth/apple/callback
VITE_APPLE_SCOPE=name email  # Optional: space-separated scopes

Backend Configuration (server/.env)

# Server Configuration
PORT=3001
NODE_ENV=development  # or 'production'

# CORS Configuration
CLIENT_URL=http://localhost:3000
# Optional: Multiple allowed origins (comma-separated)
CLIENT_URLS=http://localhost:3000,https://connectsphere.com

# Authentication
GOOGLE_CLIENT_ID=123456789.apps.googleusercontent.com
APPLE_CLIENT_ID=com.yourcompany.connectsphere
# Optional: Multiple Apple client IDs (comma-separated)
APPLE_CLIENT_IDS=com.yourcompany.connectsphere,com.yourcompany.connectsphere.web

# Development
ALLOW_MOCK_AUTH=false  # Set to 'true' only for local testing without OAuth

# Database
DATABASE_PATH=./data/connectsphere.db  # Relative or absolute path

๐Ÿ”ง Advanced Configuration

Rate Limiting (modify in server/index.js):

const limiter = rateLimit({
  windowMs: 15 * 60 * 1000, // 15 minutes
  max: 100, // Limit each IP to 100 requests per windowMs
});

Session Configuration:

// JWT token expiration (default: 7 days)
const TOKEN_EXPIRATION = '7d';

WebRTC Configuration (modify in frontend):

const iceServers = [
  { urls: 'stun:stun.l.google.com:19302' },
  // Add TURN servers for production
];

๐Ÿ›ก๏ธ Security Best Practices

โœ… Built-in Security Features

  • โœ”๏ธ Helmet.js - Sets secure HTTP headers
  • โœ”๏ธ Rate Limiting - Prevents API abuse (100 req/15min per IP)
  • โœ”๏ธ JWT Authentication - Secure session tokens
  • โœ”๏ธ CORS Protection - Configurable allowed origins
  • โœ”๏ธ Input Validation - Server-side validation on all inputs
  • โœ”๏ธ SQL Injection Protection - Parameterized queries only
  • โœ”๏ธ XSS Protection - Content sanitization
  • โœ”๏ธ HTTPS Ready - Designed for secure deployment
  • โœ”๏ธ Teen Safety - Age-appropriate protections and time limits

๐Ÿ”’ Production Security Checklist

Before deploying to production:

  • Disable mock authentication (ALLOW_MOCK_AUTH=false)
  • Configure proper CORS origins (no wildcards)
  • Enable HTTPS/TLS (required for WebRTC)
  • Set up TURN servers for NAT traversal
  • Configure rate limiting thresholds appropriately
  • Implement CSRF protection
  • Set secure cookie flags (httpOnly, secure, sameSite)
  • Add logging and monitoring (Winston, Sentry)
  • Implement input sanitization everywhere
  • Set up automated security scanning
  • Configure database backups
  • Review and update dependencies regularly
  • Implement admin dashboard for moderation
  • Set up payment processing securely (PCI compliance)

๐Ÿ› Troubleshooting

๐Ÿ“น Camera/Microphone Issues

Problem: Camera or microphone not working

Solutions:

  • โœ… Ensure you're using HTTPS (or localhost for development)
  • โœ… Check browser permissions - grant camera/microphone access
  • โœ… Verify devices aren't being used by another application
  • โœ… Try a different browser (Chrome recommended)
  • โœ… Check device drivers are up to date
  • โœ… Test on https://www.webrtc-experiment.com/DetectRTC/

๐Ÿ”Œ Connection Issues

Problem: Socket connection failed / Cannot connect to server

Solutions:

  • โœ… Verify backend server is running (http://localhost:3001/api/health)
  • โœ… Check VITE_WS_URL in frontend .env file
  • โœ… Ensure firewall allows port 3001
  • โœ… Verify CORS configuration in server/.env
  • โœ… Check browser console for specific error messages
  • โœ… Try disabling VPN or proxy

๐Ÿ—„๏ธ Database Errors

Problem: Database connection/query failures

Solutions:

  • โœ… Ensure server/data/ directory exists (create if missing)
  • โœ… Check file permissions on database file
  • โœ… Verify SQLite is properly installed
  • โœ… Try deleting database file to reset: rm server/data/connectsphere.db โš ๏ธ (data loss)
  • โœ… Check database path in server/.env

๐Ÿ”จ Build Errors

Problem: Build fails or dependencies won't install

Solutions:

  • โœ… Clear node_modules: rm -rf node_modules package-lock.json && npm install
  • โœ… Verify Node.js version: node --version (must be 18+)
  • โœ… Check all environment variables are set correctly
  • โœ… Look for port conflicts: lsof -i :3000 or lsof -i :3001
  • โœ… Try cleaning Vite cache: rm -rf node_modules/.vite
  • โœ… Update npm: npm install -g npm@latest

๐Ÿ” Authentication Problems

Problem: Login fails or auth errors

Solutions:

  • โœ… Verify Google/Apple OAuth credentials are correct
  • โœ… Check OAuth redirect URIs match your domain exactly
  • โœ… Ensure ALLOW_MOCK_AUTH=true is set for development without OAuth
  • โœ… Check browser console and network tab for detailed errors
  • โœ… Verify JWT token is being sent in requests
  • โœ… Clear browser cookies and local storage

โšก Performance Issues

Problem: Slow performance or high latency

Solutions:

  • โœ… Enable Bandwidth Saver Mode
  • โœ… Lower video quality in Connection Quality settings
  • โœ… Run Network Diagnostics to test your connection
  • โœ… Close unnecessary browser tabs and applications
  • โœ… Check CPU usage - video processing is intensive
  • โœ… Ensure adequate internet bandwidth (min 1 Mbps recommended)

๐Ÿ“ Development Notes

โš ๏ธ Current Limitations

  1. Video Streaming

    • Currently uses sample video files for demonstration
    • WebRTC signaling layer is fully implemented
    • Peer-to-peer video streaming needs final integration
    • STUN/TURN servers required for production NAT traversal
  2. Gender Detection

    • Uses COCO-SSD object detection model as simulation
    • Production deployment requires specialized gender detection ML model
    • Current implementation is for demonstration purposes
  3. Database

    • SQLite used for development and small deployments
    • Consider PostgreSQL or MySQL for high-scale production
    • Current schema supports thousands of concurrent users
    • Implement connection pooling for production
  4. Payment Processing

    • Premium subscriptions and coin purchases currently simulated
    • Requires integration with Stripe, PayPal, or similar
    • Webhooks needed for subscription management

๐Ÿš€ Production Deployment Checklist

Infrastructure

  • Set up production server (VPS, cloud instance, etc.)
  • Configure HTTPS with valid SSL certificate (Let's Encrypt)
  • Set up reverse proxy (Nginx, Apache)
  • Configure firewall rules and security groups
  • Set up CDN for static assets (CloudFlare, AWS CloudFront)
  • Configure load balancing if needed

WebRTC & Media

  • Complete WebRTC peer-to-peer video implementation
  • Configure STUN servers (free: Google STUN)
  • Set up TURN servers for NAT traversal (coturn, Twilio)
  • Test video quality across different networks
  • Implement reconnection logic for dropped connections

Database & Storage

  • Migrate to PostgreSQL/MySQL for production
  • Set up automated database backups (daily minimum)
  • Configure database replication for high availability
  • Implement database connection pooling
  • Set up monitoring and alerting

Machine Learning

  • Integrate real gender detection model
  • Set up ML model serving (TensorFlow Serving, ONNX Runtime)
  • Implement model versioning and A/B testing
  • Add content moderation AI (inappropriate content detection)

Monitoring & Logging

  • Set up application logging (Winston, Pino)
  • Configure error tracking (Sentry, Rollbar)
  • Implement analytics (Google Analytics, Mixpanel)
  • Set up uptime monitoring (UptimeRobot, Pingdom)
  • Configure performance monitoring (New Relic, Datadog)
  • Set up log aggregation (ELK stack, Splunk)

Security

  • Implement CSRF protection
  • Add comprehensive input validation and sanitization
  • Set up Web Application Firewall (WAF)
  • Configure DDoS protection
  • Implement session management best practices
  • Add security headers (already using Helmet, review config)
  • Set up vulnerability scanning
  • Conduct security audit and penetration testing

Payment & Compliance

  • Integrate payment processor (Stripe, PayPal, Braintree)
  • Implement subscription webhooks and management
  • Add invoice generation and email delivery
  • Ensure PCI DSS compliance for payment handling
  • Implement refund and cancellation workflows
  • Set up payment failure retry logic

Content & Moderation

  • Implement admin dashboard for moderation
  • Set up automated content filtering
  • Create moderation queue and workflows
  • Implement user appeal system
  • Add automated ban/timeout system
  • Create trust & safety team processes

Legal & Compliance

  • Add Terms of Service
  • Add Privacy Policy
  • Implement GDPR compliance (EU users)
  • Add COPPA compliance (users under 13, if applicable)
  • Implement user data export functionality
  • Add account deletion functionality
  • Set up abuse reporting to authorities system

Performance

  • Optimize database queries with proper indexing
  • Implement Redis for session storage and caching
  • Set up database query caching
  • Optimize frontend bundle size (code splitting)
  • Implement lazy loading for images and components
  • Set up browser caching headers
  • Optimize video encoding and compression

๐Ÿค Contributing

We welcome contributions from the community! Here's how you can help make ConnectSphere better:

๐ŸŒŸ Ways to Contribute

  • ๐Ÿ› Report Bugs - Open an issue with detailed reproduction steps
  • โœจ Suggest Features - Share your ideas for new features
  • ๐Ÿ“ Improve Documentation - Help make our docs clearer
  • ๐Ÿ”ง Submit Pull Requests - Fix bugs or add new features
  • ๐ŸŒ Translations - Help translate the app to other languages
  • ๐ŸŽจ Design - Contribute UI/UX improvements

๐Ÿ“‹ Contribution Guidelines

  1. Fork the Repository

    git clone https://github.com/yourusername/connectsphere.git
    cd connectsphere
  2. Create a Feature Branch

    git checkout -b feature/amazing-feature
    # or
    git checkout -b bugfix/fix-issue-123
  3. Make Your Changes

    • Follow existing code style and conventions
    • Add TypeScript types for all new code
    • Write clear, descriptive commit messages
    • Add comments for complex logic
  4. Test Your Changes

    • Test locally with npm run dev
    • Verify both frontend and backend work correctly
    • Test on multiple browsers if UI changes
    • Ensure no console errors or warnings
  5. Commit Your Changes

    git add .
    git commit -m "Add amazing feature: description of what it does"
  6. Push and Create Pull Request

    git push origin feature/amazing-feature

    Then open a Pull Request on GitHub with:

    • Clear description of changes
    • Screenshots/videos for UI changes
    • Link to related issues
    • Testing instructions

๐Ÿ“ Code Standards

TypeScript Best Practices:

// โœ… Good: Properly typed function
const calculateStats = (userId: string): UserStats => {
  // Implementation
};

// โŒ Bad: Using 'any' type
const calculateStats = (userId: any): any => {
  // Implementation
};

React Best Practices:

  • โœ… Use functional components with hooks
  • โœ… Keep components small and focused (< 200 lines)
  • โœ… Extract reusable logic into custom hooks
  • โœ… Use meaningful component and variable names
  • โœ… Implement proper error boundaries
  • โœ… Memoize expensive computations with useMemo
  • โœ… Use useCallback for callback props

Component Structure:

// โœ… Good structure
import React, { useState, useEffect } from 'react';
import { SomeType } from '../types';

interface MyComponentProps {
  userId: string;
  onClose: () => void;
}

export const MyComponent: React.FC<MyComponentProps> = ({ userId, onClose }) => {
  // Hooks at the top
  const [data, setData] = useState<SomeType | null>(null);
  
  // Effects
  useEffect(() => {
    // Effect logic
  }, [userId]);
  
  // Event handlers
  const handleClick = () => {
    // Handler logic
  };
  
  // Render
  return (
    <div className="component-container">
      {/* JSX */}
    </div>
  );
};

Commit Message Format:

# Format: <type>: <description>

feat: Add user profile boost feature
fix: Resolve socket disconnection issue
docs: Update API documentation
style: Format code with prettier
refactor: Simplify matching algorithm
test: Add tests for rating system
chore: Update dependencies

๐Ÿ› Bug Reports

When reporting bugs, please include:

  1. Description - Clear description of the bug
  2. Steps to Reproduce - Detailed steps to recreate the issue
  3. Expected Behavior - What should happen
  4. Actual Behavior - What actually happens
  5. Screenshots/Videos - Visual proof of the bug
  6. Environment - Browser, OS, Node.js version
  7. Console Errors - Any error messages from console

๐Ÿ“Š Project Statistics

๐ŸŽ‰ Project Highlights

Metric Count
๐Ÿ“ฆ Total Components 25+ React components
๐Ÿ”Œ API Endpoints 20+ REST endpoints
๐Ÿ”„ WebSocket Events 15+ real-time events
๐Ÿ—„๏ธ Database Tables 9 normalized tables
๐ŸŽฏ Features 50+ user-facing features
๐Ÿ† Achievements 8 built-in achievements
๐ŸŽจ Themes 5 beautiful themes
๐ŸŒ Languages 17+ language options
๐ŸŽฎ Interests 18+ interest categories
๐Ÿ’Ž Subscription Tiers 3 tiers (Free, Premium, VIP)

๐Ÿ“„ License

This project is part of the ConnectSphere application. All rights reserved.

For licensing inquiries, please contact the project maintainers.


๐Ÿ™ Acknowledgments

๐Ÿ› ๏ธ Built With

React
React
TypeScript
TypeScript
Node.js
Node.js
Socket.io
Socket.io

๐Ÿ’™ Special Thanks

  • React Team - For the amazing UI framework
  • Socket.io Team - For real-time communication
  • Tailwind CSS - For the utility-first CSS framework
  • Lucide Icons - For beautiful, consistent icons
  • Vite Team - For lightning-fast development experience
  • All Contributors - Thank you for making ConnectSphere better!

๐ŸŒŸ Inspiration

ConnectSphere was built to bring people together across geographical, cultural, and linguistic boundaries. We believe in the power of human connection and the potential of technology to make the world a smaller, more connected place.


๐Ÿš€ Ready to Connect the World?

Built with โค๏ธ using React, TypeScript, Node.js, and Socket.io

โฌ† Back to Top


View Project โ€ข Report Bug โ€ข Request Feature

Last Updated: November 2025

About

Fjdjc

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages