Skip to content

Michael-HMS/OnlineLanguageBuddyFinder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌍 Language Buddy Finder

Language Buddy Finder is a comprehensive, modern web application designed to revolutionize language learning through authentic peer-to-peer communication. The platform serves as a digital bridge connecting language learners from around the world, enabling them to practice languages naturally through real-time text-based conversations with native speakers.

Unlike traditional language learning apps that rely on structured lessons and exercises, Language Buddy Finder focuses on mutual language exchange - a proven method where two people teach each other their native languages through conversation. This approach creates a win-win scenario: you help someone learn your native language while they help you learn theirs, fostering genuine cultural exchange and meaningful connections.

The application features an intelligent matching algorithm that automatically pairs users based on their language preferences where a user with a native language will be matched with someone that has this language as a target language, i.e.(someone with native language Spanish and learning language English, will be matched with someone with native language English and learning language Spanish), ensuring that every match is mutually beneficial. Once matched, users can engage in seamless, real-time chat conversations that simulate natural language practice scenarios. The platform emphasizes user experience with a beautiful, responsive interface that works flawlessly across all devices, from desktop computers to mobile phones.

Built with modern web technologies and following best practices in security and user experience, Language Buddy Finder provides a safe, efficient, and enjoyable environment for language learners to improve their skills through authentic communication. Whether you're a beginner looking to practice basic conversations or an advanced learner seeking to refine your fluency, this platform adapts to your needs and connects you with the perfect language exchange partner.

πŸ“‹ Table of Contents

✨ Features

Core Functionality

πŸ” User Authentication & Security

  • Secure Registration System: Robust signup process with comprehensive validation including email uniqueness checks, password strength requirements, and input sanitization
  • Password Security: Industry-standard password hashing using PHP's password_hash() with bcrypt algorithm, ensuring passwords are never stored in plain text
  • Session Management: Secure PHP session-based authentication that maintains user state across page requests
  • Auto-login: Automatic authentication after successful registration for seamless user onboarding
  • Protected Routes: Route guards that automatically redirect unauthenticated users to the login page

🎯 Intelligent Matching System

  • Smart Algorithm: Advanced matching logic that finds users whose native language matches your learning language, and whose learning language matches your native language
  • Mutual Exchange: Ensures every match is beneficial for both parties, creating perfect language exchange partnerships
  • Real-time Matching: Instant match results displayed immediately after login, with no waiting periods
  • Match Display: Clean, organized presentation of potential language partners with their language information clearly displayed
  • One-Click Chat: Seamless transition from match discovery to conversation initiation

πŸ’¬ Real-time Chat System

  • Instant Messaging: Fast, responsive chat interface that enables real-time communication between language partners
  • Automatic Polling: Messages are automatically refreshed every 2 seconds, ensuring users see new messages without manual page refreshes
  • Message History: Complete conversation history preserved and displayed chronologically
  • Message Differentiation: Visual distinction between your messages and your partner's messages with different styling
  • Conversation Persistence: All conversations are saved in the database, allowing users to return to previous chats at any time
  • Auto-scroll: Chat interface automatically scrolls to the latest message for optimal user experience

πŸ‘€ Profile Management

  • Comprehensive Profile: User profiles include username, email, native language, and learning language
  • Dynamic Updates: Update any profile field independently - only changed fields are processed, improving efficiency
  • Real-time Data Loading: Profile form automatically populates with current user data on page load
  • Change Detection: Smart system that detects which fields have been modified before updating
  • Validation Feedback: Immediate feedback on profile updates with clear success and error messages

πŸ”„ Conversation Management

  • Automatic Conversation Creation: New conversations are automatically created when users click "Start Chat" on a match
  • Duplicate Prevention: System checks for existing conversations before creating new ones, preventing duplicate chat threads
  • Conversation Retrieval: Existing conversations are automatically retrieved and displayed when users return to chat
  • Bidirectional Matching: Conversation lookup works regardless of which user initiated the chat (user1 or user2)

User Experience Features

🎨 Modern & Beautiful Interface

  • Gradient Design: Eye-catching gradient backgrounds (purple to violet) that create a modern, professional appearance
  • Card-based Layout: Clean card designs for forms and content areas with subtle shadows and rounded corners
  • Smooth Animations: CSS animations including fade-in effects, slide transitions, and hover states that enhance interactivity
  • Visual Hierarchy: Clear typography and spacing that guides users through the interface naturally
  • Color-coded Elements: Green accent color (#4caf50) used consistently for primary actions and branding

πŸ“± Responsive Design

  • Mobile-First Approach: Designed to work perfectly on mobile devices with touch-friendly interface elements
  • Flexible Layouts: CSS Grid and Flexbox ensure content adapts beautifully to any screen size
  • Breakpoint Optimization: Specific styling adjustments for tablets and desktops to maximize usability
  • Touch Interactions: Optimized button sizes and spacing for mobile touch interactions

βœ… Comprehensive Error Handling

  • User-Friendly Messages: All error messages are written in plain language, avoiding technical jargon
  • Visual Error Display: Errors are displayed in styled containers with warning icons and red color coding
  • Context-Specific Errors: Different error messages for different scenarios (validation errors, server errors, network errors)
  • Success Feedback: Clear success messages with checkmark icons and green styling for positive actions
  • Auto-dismiss: Error messages can be cleared by user interaction (typing in form fields)

πŸ” Input Validation

  • Client-side Validation: Instant feedback on form inputs before submission, improving user experience
  • Server-side Validation: Comprehensive validation on the backend to ensure data integrity and security
  • Field-specific Rules: Different validation rules for different fields (email format, password length, username constraints)
  • Real-time Feedback: Validation errors appear as users interact with form fields
  • Prevention of Invalid Submissions: Forms cannot be submitted until all validation requirements are met

⏳ Loading States & Feedback

  • Visual Indicators: Loading spinners and disabled states during asynchronous operations
  • Button State Changes: Submit buttons show "Loading..." or "Processing..." text during operations
  • Form Disabling: Forms are disabled during submission to prevent duplicate requests
  • Progress Feedback: Users always know when the system is processing their requests

🎯 Accessibility Features

  • Semantic HTML: Proper use of HTML5 semantic elements for better screen reader support
  • Form Labels: All form inputs have associated labels for accessibility
  • Keyboard Navigation: Full keyboard navigation support throughout the application
  • ARIA Attributes: Proper labeling and roles for interactive elements
  • Color Contrast: Sufficient color contrast ratios for text readability

Technical Features

πŸ— Architecture & Code Quality

  • MVC Pattern: Clean separation of concerns with Controllers (business logic), Views (presentation), and Models (data)
  • RESTful API Design: JSON-based API endpoints following REST principles
  • Modular Structure: Well-organized file structure that makes the codebase maintainable and scalable
  • Code Reusability: Shared components and styles reduce code duplication
  • Error Logging: Comprehensive error handling with proper logging mechanisms

πŸ”’ Security Implementation

  • SQL Injection Prevention: All database queries use PDO prepared statements
  • XSS Protection: All user-generated content is escaped using htmlspecialchars()
  • Password Security: Bcrypt hashing with cost factor for password storage
  • Session Security: Secure session management with proper configuration
  • Input Sanitization: All user inputs are trimmed and validated before processing
  • CSRF Protection: Session-based request validation (ready for token-based enhancement)

⚑ Performance Optimizations

  • Efficient Database Queries: Optimized SQL queries with proper indexing
  • Minimal Page Reloads: AJAX-based interactions reduce full page reloads
  • Lazy Loading: Resources loaded only when needed
  • Caching Ready: Structure supports future caching implementations

πŸ›  Tech Stack

Backend

  • PHP 7.4+: Server-side scripting language
  • MySQL: Relational database management system
  • PDO: Database abstraction layer for secure database operations
  • Sessions: User authentication and state management

Frontend

  • HTML5: Semantic markup
  • CSS3: Modern styling with gradients, animations, and responsive design
  • JavaScript (Vanilla): Client-side interactivity and AJAX requests
  • Fetch API: Asynchronous HTTP requests

Architecture

  • MVC Pattern: Separation of concerns with Controllers, Views, and Models
  • RESTful API: JSON-based API endpoints for frontend communication
  • Single Page Application: Dynamic content loading without full page reloads

πŸ“¦ Prerequisites

Before you begin, ensure you have the following installed:

  • Web Server: Apache (via XAMPP, WAMP, or similar) or Nginx
  • PHP: Version 7.4 or higher
  • MySQL: Version 5.7 or higher (or MariaDB 10.2+)
  • Web Browser: Modern browser with JavaScript enabled

πŸš€ Installation

Step 1: Clone the Repository

git clone https://github.com/Michael-HMS/OnlineLanguageBuddyFinder.git
cd OnlineLanguageBuddyFinder

Step 2: Set Up Web Server

Using XAMPP (Windows/Mac/Linux)

  1. Copy the project folder to xampp/htdocs/
  2. Start Apache from XAMPP Control Panel
  3. Start MySQL (or use your existing MySQL service)

Using Other Servers

  • Place the project in your web server's document root
  • Ensure PHP and MySQL are running

Step 3: Database Setup

  1. Open phpMyAdmin or MySQL command line
  2. Import the database schema:
mysql -u root -p < database/schema.sql

Or via phpMyAdmin:

  • Navigate to http://localhost/phpmyadmin
  • Click "Import"
  • Select database/schema.sql
  • Click "Go"

Step 4: Configuration

Edit config/database.php with your database credentials:

$host = "localhost";
$db   = "language_buddy_finder";
$user = "root";           // Your MySQL username
$pass = "your_password";  // Your MySQL password

Step 5: Access the Application

Open your web browser and navigate to:

http://localhost/OnlineLanguageBuddyFinder/

πŸ—„ Database Setup

The application uses three main tables:

Users Table

  • Stores user account information
  • Fields: id, username, email, password (hashed), native_language, learning_language, status, created_at

Conversations Table

  • Manages chat conversations between users
  • Fields: id, user1_id, user2_id, created_at

Messages Table

  • Stores individual chat messages
  • Fields: id, conversation_id, sender_id, message, sent_at

βš™οΈ Configuration

Database Configuration

Edit config/database.php to match your MySQL setup:

$host = "localhost";        // Database host
$db   = "language_buddy_finder";  // Database name
$user = "root";            // Database username
$pass = "your_password";   // Database password

Application Path

If your application is not in the root directory, update all paths in:

  • index.php (CSS/JS includes)
  • View files (asset paths)
  • JavaScript files (API endpoints)

πŸ“ Project Structure

OnlineLanguageBuddyFinder/
β”‚
β”œβ”€β”€ config/
β”‚   └── database.php          # Database configuration
β”‚
β”œβ”€β”€ Controllers/               # Backend API endpoints
β”‚   β”œβ”€β”€ createConversation.php # Create/find conversations
β”‚   β”œβ”€β”€ getProfile.php         # Get user profile data
β”‚   β”œβ”€β”€ login.php              # User authentication
β”‚   β”œβ”€β”€ logout.php             # Session termination
β”‚   β”œβ”€β”€ matchUsers.php         # Find language matches
β”‚   β”œβ”€β”€ messages.php           # Retrieve chat messages
β”‚   β”œβ”€β”€ send.php               # Send chat messages
β”‚   β”œβ”€β”€ signup.php             # User registration
β”‚   └── updateProfile.php      # Update user profile
β”‚
β”œβ”€β”€ database/
β”‚   └── schema.sql             # Database schema
β”‚
β”œβ”€β”€ Views/                      # Frontend views
β”‚   β”œβ”€β”€ buddy/
β”‚   β”‚   β”œβ”€β”€ matches.js         # Matches page logic
β”‚   β”‚   └── matches.php        # Matches page view
β”‚   β”‚
β”‚   β”œβ”€β”€ chat/
β”‚   β”‚   β”œβ”€β”€ chat.css           # Chat styling
β”‚   β”‚   β”œβ”€β”€ chat.js            # Chat functionality
β”‚   β”‚   └── chat.php           # Chat interface
β”‚   β”‚
β”‚   β”œβ”€β”€ profile/
β”‚   β”‚   β”œβ”€β”€ updateProfile.js   # Profile update logic
β”‚   β”‚   └── updateProfile.php  # Profile update form
β”‚   β”‚
β”‚   β”œβ”€β”€ styles/
β”‚   β”‚   β”œβ”€β”€ auth.css           # Authentication pages styling
β”‚   β”‚   └── main.css           # Main application styling
β”‚   β”‚
β”‚   β”œβ”€β”€ login.php               # Login page
β”‚   └── signup.php              # Registration page
β”‚
β”œβ”€β”€ index.php                   # Main router and entry point
└── README.md                   # This file

πŸ’» Usage

For Users

  1. Sign Up: Create an account with your email, username, native language, and the language you want to learn
  2. Find Matches: Browse users who speak the language you're learning and want to learn your native language
  3. Start Chatting: Click "Start Chat" on any match to begin a conversation
  4. Practice Languages: Exchange messages with your language partner in real-time
  5. Update Profile: Modify your profile information anytime from the Profile page

For Developers

Adding New Features

  1. Create controller endpoints in Controllers/ for backend logic
  2. Create view files in Views/ for frontend presentation
  3. Add routes in index.php switch statement
  4. Update navigation in index.php if needed

API Integration

All API endpoints return JSON responses:

  • Success: {"status": "success", ...}
  • Error: {"status": "error", "message": "..."}

πŸ”Œ API Endpoints

Authentication

  • POST /Controllers/login.php - User login
  • POST /Controllers/signup.php - User registration
  • GET /Controllers/logout.php - User logout

User Management

  • GET /Controllers/getProfile.php - Get current user profile
  • POST /Controllers/updateProfile.php - Update user profile

Matching

  • GET /Controllers/matchUsers.php - Get language exchange matches

Conversations

  • POST /Controllers/createConversation.php - Create or retrieve conversation
  • GET /Controllers/messages.php?conversation_id=X - Get conversation messages
  • POST /Controllers/send.php - Send a message

πŸ”’ Security Features

  • Password Hashing: Uses PHP's password_hash() and password_verify() for secure password storage
  • Prepared Statements: All database queries use PDO prepared statements to prevent SQL injection
  • Session Management: Secure session-based authentication
  • Input Validation: Server-side and client-side validation
  • XSS Protection: HTML entities escaped in output using htmlspecialchars()
  • CSRF Protection: Session-based request validation (can be enhanced)
  • Error Handling: Comprehensive error handling without exposing sensitive information

🎨 Design Features

  • Modern UI: Gradient backgrounds, card-based layouts, smooth animations
  • Responsive Design: Mobile-first approach with breakpoints for tablets and desktops
  • Accessibility: Semantic HTML, proper form labels, keyboard navigation support
  • User Feedback: Loading states, success/error messages, form validation feedback
  • Consistent Styling: Unified design system across all pages

🚧 Future Enhancements

Potential improvements for future versions:

  • Real-time messaging with WebSockets
  • File/image sharing in chats
  • User profiles with avatars
  • Language proficiency levels
  • Search and filter matches
  • Email notifications
  • Mobile app version
  • Multi-language support for the interface
  • Admin dashboard
  • Reporting and moderation features
  • Video/voice call integration
  • Language learning resources

πŸ“ License

This project is open source and available under the MIT License.

πŸ‘€ Author

Michael HMS

πŸ™ Acknowledgments

  • Built with PHP, MySQL, and vanilla JavaScript
  • Inspired by language exchange platforms like HelloTalk and Tandem
  • Designed for simplicity and ease of use

Made with ❀️ for language learners worldwide

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors