Skip to content

akashkhedar/Echo-Frontend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

95 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Echo - Social Media Platform (Frontend)

Echo Logo

A modern, real-time social media platform built with React, featuring instant messaging, video calling, post sharing, and user connections. Echo provides a seamless social experience across all devices with a mobile-first design approach.

🌟 Key Features

πŸ” Authentication & Security

  • JWT-based authentication with automatic token refresh
  • Secure login/signup with email verification
  • Password reset functionality with email tokens
  • Protected routes and session management

πŸ’¬ Real-time Chat System

  • Instant messaging with Socket.io
  • Group and private conversations
  • Message read receipts and online status
  • Offline message notifications
  • Real-time typing indicators

πŸ“ž Video & Audio Calling

  • WebRTC-powered video calls
  • Audio-only calling option
  • Call notifications and management
  • Ice candidate exchange for peer connections

πŸ“± Social Features

  • Create and share posts with media
  • Like, comment, and interact with posts
  • Follow/unfollow users with connection management
  • User profiles with customizable information
  • Real-time activity feeds

🎨 Modern UI/UX

  • Material-UI design system
  • Responsive design (mobile-first)
  • Dark theme with custom styling
  • Smooth animations and transitions
  • 3D graphics with Three.js integration

πŸ—οΈ Technical Architecture

Core Technologies

  • React 18.3.1 - Component-based UI framework
  • Material-UI 6.5.0 - Modern design system and components
  • TanStack React Query 5.84.1 - Data fetching, caching, and synchronization
  • Socket.io Client 4.8.1 - Real-time bidirectional communication
  • React Router DOM 7.1.1 - Client-side routing and navigation
  • Axios 1.7.9 - HTTP client with interceptors and auto-retry

State Management

  • React Query for server state management and caching
  • Custom hooks for component-specific logic
  • Local state with React hooks (useState, useEffect)
  • Redux Toolkit for complex global state scenarios

Real-time Features

  • Socket.io for instant messaging and notifications
  • WebRTC for peer-to-peer video/audio calling
  • Real-time user status tracking (online/offline)

Form Handling & Validation

  • Formik 2.4.6 - Robust form state management
  • Yup 1.6.1 - Schema-based form validation
  • Material-UI form components with custom styling

Media & File Processing

  • React Player 2.16.0 - Video and audio playback
  • React Cropper 2.3.3 - Advanced image editing
  • Browser Image Compression 2.0.2 - Client-side image optimization
  • ColorThief 2.6.0 - Dominant color extraction from images

3D Graphics & Visuals

  • Three.js 0.172.0 - 3D rendering engine
  • React Three Fiber 8.17.12 - React integration for Three.js
  • React Three Drei 9.120.8 - Useful helpers and abstractions
  • Spline React 4.0.0 - 3D design tool integration

πŸ“ Project Structure

Frontend/
β”œβ”€β”€ public/                   # Static assets and HTML template
β”‚   β”œβ”€β”€ index.html           # Main HTML file
β”‚   β”œβ”€β”€ manifest.json        # PWA manifest
β”‚   └── favicon.ico          # App icon
β”œβ”€β”€ build/                   # Production build output
β”‚   β”œβ”€β”€ static/              # Optimized assets
β”‚   └── index.html           # Production HTML
└── src/                     # Source code
    β”œβ”€β”€ components/          # Reusable UI components
    β”‚   β”œβ”€β”€ BottomNavigation/  # Mobile navigation
    β”‚   β”œβ”€β”€ Calling/           # Video call interface
    β”‚   β”œβ”€β”€ ChangePassword/    # Password management
    β”‚   β”‚   β”œβ”€β”€ ForgetPassword.js
    β”‚   β”‚   β”œβ”€β”€ UpdatePassword.js
    β”‚   β”‚   β”œβ”€β”€ ValidateToken.js
    β”‚   β”‚   └── Steps/         # Multi-step password reset
    β”‚   β”œβ”€β”€ ChatPage/          # Chat interface components
    β”‚   β”‚   β”œβ”€β”€ Chat.js        # Main chat container
    β”‚   β”‚   β”œβ”€β”€ ChatSection.js # Message display area
    β”‚   β”‚   β”œβ”€β”€ ChatInput.js   # Message input component
    β”‚   β”‚   β”œβ”€β”€ ChatList.js    # Conversation list
    β”‚   β”‚   β”œβ”€β”€ Messages.js    # Message rendering
    β”‚   β”‚   └── CallingModal.js # Call initiation modal
    β”‚   β”œβ”€β”€ LeftSidebar/       # Navigation sidebar
    β”‚   β”‚   β”œβ”€β”€ LGSidebar.js   # Large screen sidebar
    β”‚   β”‚   └── MDSidebar.js   # Medium screen sidebar
    β”‚   β”œβ”€β”€ Login/             # Authentication components
    β”‚   β”œβ”€β”€ Navbar/            # Top navigation
    β”‚   β”‚   β”œβ”€β”€ Navbar.js      # Main navigation bar
    β”‚   β”‚   β”œβ”€β”€ SearchDropdown.js
    β”‚   β”‚   └── SearchList.js
    β”‚   β”œβ”€β”€ PostPage/          # Post-related components
    β”‚   β”‚   β”œβ”€β”€ Post.js        # Main post feed
    β”‚   β”‚   β”œβ”€β”€ PostCard.js    # Individual post display
    β”‚   β”‚   β”œβ”€β”€ CommentSection.js
    β”‚   β”‚   β”œβ”€β”€ AddComment.js
    β”‚   β”‚   └── PostLoading.js # Loading skeletons
    β”‚   β”œβ”€β”€ Profile/           # User profile components
    β”‚   β”‚   β”œβ”€β”€ Profile.js     # Main profile page
    β”‚   β”‚   β”œβ”€β”€ ProfileHeader.js
    β”‚   β”‚   β”œβ”€β”€ About.js       # Profile about section
    β”‚   β”‚   β”œβ”€β”€ Connections.js # Followers/Following
    β”‚   β”‚   └── DeleteAccountModal.js
    β”‚   β”œβ”€β”€ RightSidebar/      # Quick chat sidebar
    β”‚   β”‚   β”œβ”€β”€ LGQuickChat.js # Large screen quick chat
    β”‚   β”‚   β”œβ”€β”€ MDQuickChat.js # Medium screen quick chat
    β”‚   β”‚   └── QuickMessages.js
    β”‚   β”œβ”€β”€ Signup/            # User registration
    β”‚   └── uploadPost/        # Post creation components
    β”‚       β”œβ”€β”€ UploadPost.js  # Main upload interface
    β”‚       β”œβ”€β”€ PostCreator.js # Post composition
    β”‚       β”œβ”€β”€ ImageCropper.js # Image editing
    β”‚       └── Controls.js    # Upload controls
    β”œβ”€β”€ hooks/                 # Custom React hooks
    β”‚   β”œβ”€β”€ useUser.js         # User authentication & data
    β”‚   β”œβ”€β”€ useFeedPosts.js    # Post feed management
    β”‚   β”œβ”€β”€ useChatMessages.js # Chat message handling
    β”‚   β”œβ”€β”€ useConversationList.js # Chat conversations
    β”‚   β”œβ”€β”€ useConversationSelection.js # Chat selection
    β”‚   β”œβ”€β”€ useSelectedChatUser.js # Active chat user
    β”‚   └── useConnections.js  # User relationships
    β”œβ”€β”€ utils/                 # Utility functions
    β”‚   β”œβ”€β”€ socket.js          # Socket.io configuration
    β”‚   └── webRTC.js          # WebRTC implementation
    β”œβ”€β”€ assets/                # Static assets
    β”‚   β”œβ”€β”€ Echo.png           # Main logo
    β”‚   β”œβ”€β”€ Login.jpg          # Authentication backgrounds
    β”‚   β”œβ”€β”€ ChatBG.jpeg        # Chat background
    β”‚   β”œβ”€β”€ female.jpg         # Default avatars
    β”‚   └── male.jpg
    β”œβ”€β”€ App.js                 # Main application component
    β”œβ”€β”€ App.css               # Global styles
    β”œβ”€β”€ axiosInstance.js       # HTTP client configuration
    β”œβ”€β”€ index.js               # Application entry point
    └── index.css              # Base styles

πŸš€ Getting Started

Prerequisites

  • Node.js 16+ and npm/yarn
  • Backend API server running
  • Modern web browser with WebRTC support

Installation

  1. Clone the repository

    git clone https://github.com/akashkhedar/Echo-Frontend.git
    cd Echo-Frontend
  2. Install dependencies

    npm install
  3. Environment Configuration The app automatically switches between environments:

    • Development: http://localhost:5000/api
    • Production: https://api.echo.linkpc.net/api
  4. Start development server

    npm start

    Opens http://localhost:3000 in your browser.

Available Scripts

  • npm start - Run development server with hot reload
  • npm run build - Build optimized production bundle
  • npm test - Run Jest test suite
  • npm run eject - Eject from Create React App (irreversible)

🌐 API Integration

Axios Configuration

  • Environment-based URLs with automatic switching
  • Token refresh mechanism for expired JWTs
  • Request/Response interceptors for error handling
  • Credentials inclusion for authentication

Socket.io Configuration

  • Auto-reconnection with exponential backoff
  • Room management for chat conversations
  • Event-based communication for real-time features
  • Transport fallbacks (WebSocket β†’ Polling)

πŸ“± Component Architecture

Layout System

  • HomeLayout.js - Main application wrapper with navigation
  • Responsive Grid - CSS Grid for adaptive layouts
  • Breakpoint Management - Mobile, tablet, desktop optimizations

Feature Modules

Authentication Flow

  • Multi-step registration with email verification
  • Password reset workflow with token validation
  • Session persistence with automatic refresh
  • Protected route guards for authenticated areas

Real-time Chat

  • Conversation management with pagination
  • Message encryption/decryption utilities
  • File upload integration with progress tracking
  • Typing indicators and read receipts

Social Features

  • Infinite scroll post feed with virtual scrolling
  • Optimistic updates for instant user feedback
  • Image upload with client-side compression
  • User search with debounced API calls

Video Calling System

  • WebRTC peer connections with STUN/TURN servers
  • Call signaling through Socket.io
  • Media device management (camera/microphone)
  • Call state management with cleanup

🎨 Styling & Theming

Material-UI Integration

  • Custom theme with brand colors and typography
  • Responsive breakpoints for all screen sizes
  • Component overrides for consistent styling
  • Emotion styling for dynamic styles

CSS Architecture

  • Component-scoped styles with CSS modules
  • Global theme variables for consistency
  • Mobile-first responsive design
  • Performance-optimized animations

πŸ”§ Custom Hooks

Data Management Hooks

  • useUser - Authentication state and user data
  • useFeedPosts - Post feed with infinite scroll and caching
  • useChatMessages - Chat messages with real-time updates
  • useConversationList - Chat conversations with user status

UI State Hooks

  • useConversationSelection - Chat conversation selection
  • useSelectedChatUser - Active chat user management
  • useConnections - User follow/unfollow relationships

WebRTC Hooks

  • Custom WebRTC management for call initialization
  • Media stream handling for camera/microphone
  • Peer connection lifecycle management

πŸš€ Performance Optimizations

React Query Strategies

  • Intelligent caching with stale-while-revalidate
  • Background refetching for fresh data
  • Optimistic updates for instant UI feedback
  • Query invalidation on mutations

Code Splitting & Lazy Loading

  • Route-based code splitting for smaller bundles
  • Component lazy loading with React.lazy
  • Dynamic imports for third-party libraries

Image & Media Optimization

  • Client-side image compression before upload
  • Responsive image loading with srcset
  • Lazy loading for images and videos
  • Progressive JPEG support

πŸ”’ Security Implementation

Authentication Security

  • JWT token management with secure storage
  • Automatic token refresh before expiration
  • CSRF protection with SameSite cookies
  • XSS prevention with input sanitization

Data Protection

  • Input validation with Yup schemas
  • API request sanitization
  • Secure WebRTC with STUN servers
  • Content Security Policy headers

πŸ“± Progressive Web App Features

PWA Implementation

  • Service Worker for offline functionality
  • App manifest for install prompts
  • Push notifications for chat messages
  • Background sync for offline actions

Mobile Optimization

  • Touch-friendly interfaces with proper tap targets
  • Swipe gestures for navigation
  • Viewport optimization for all devices
  • Battery-efficient animations and updates

🌟 Advanced Features

3D Graphics Integration

  • Three.js scenes for interactive elements
  • Spline design integration for 3D models
  • Performance monitoring for 3D rendering
  • Fallbacks for low-performance devices

Real-time Notifications

  • Toast notification system with Notistack
  • In-app notification center
  • Sound alerts for messages and calls
  • Push notification API integration

Advanced UI Components

  • Virtual scrolling for large lists
  • Infinite scroll with intersection observer
  • Drag and drop file uploads
  • Advanced image cropping with multiple aspect ratios

πŸ§ͺ Testing Strategy

Testing Setup

  • Jest for unit and integration tests
  • React Testing Library for component testing
  • User event simulation for interaction testing
  • Mock service worker for API mocking

Test Coverage

  • Component rendering and behavior
  • Custom hooks functionality
  • API integration testing
  • WebRTC connection testing

πŸ“¦ Build & Deployment

Production Build Process

npm run build
  • Bundle optimization with tree shaking
  • Asset optimization (images, fonts, etc.)
  • Source maps for debugging
  • Performance budgets enforcement

Deployment Options

  • Static hosting (Netlify, Vercel, GitHub Pages)
  • CDN distribution for global performance
  • Docker containerization for consistent deployment
  • CI/CD pipeline integration with GitHub Actions

Environment Management

  • Automatic environment detection
  • API endpoint configuration
  • Feature flag management
  • Environment-specific optimizations

πŸ”§ Development Tools

Code Quality

  • ESLint for code linting
  • Prettier for code formatting
  • Husky for git hooks
  • Lint-staged for pre-commit checks

Development Experience

  • Hot reload for instant feedback
  • Error boundaries for graceful error handling
  • Development tools integration
  • Browser extension compatibility

🀝 Contributing

Development Setup

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Install dependencies (npm install)
  4. Make your changes
  5. Run tests (npm test)
  6. Commit changes (git commit -m 'Add amazing feature')
  7. Push to branch (git push origin feature/amazing-feature)
  8. Open a Pull Request

Code Style Guidelines

  • Follow ESLint configuration
  • Use TypeScript for new components
  • Write comprehensive tests
  • Document complex logic

πŸ“‹ Dependencies

Production Dependencies

{
  "@emotion/react": "^11.14.0",
  "@emotion/styled": "^11.14.0",
  "@mui/icons-material": "^6.3.1",
  "@mui/material": "^6.5.0",
  "@tanstack/react-query": "^5.84.1",
  "axios": "^1.7.9",
  "formik": "^2.4.6",
  "react": "^18.3.1",
  "react-router-dom": "^7.1.1",
  "socket.io-client": "^4.8.1",
  "three": "^0.172.0",
  "yup": "^1.6.1"
}

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ”— Related Projects

πŸ“ž Support & Contact

Getting Help

Maintainer


Built with ❀️ using React, Material-UI, and modern web technologies.

Echo - Where social connections come alive! 🌟

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages