Skip to content

MUHSIN-M-P/Project-FindMyFriend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

48 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

UniSphere

A full-stack social networking platform exclusively for NIT Calicut students that helps you find friends based on shared interests and personality compatibility. Built with Flask (Python) backend and Next.js (TypeScript/React) frontend, featuring real-time chat powered by WebSockets and Redis.

🌟 Project Overview

UniSphere is a modern campus networking application designed specifically for NIT Calicut students. It combines personality matching, real-time messaging, and social features to help students connect with like-minded peers. The platform uses questionnaires to match users based on compatibility scores and provides seamless communication through an integrated chat system.

Key Features

🎯 Personality Matching System

  • Interactive questionnaire to determine user preferences and personality traits
  • Compatibility scoring algorithm to match students with similar interests
  • "Find Your Tribe" recommendations based on quiz responses
  • View potential friends' profiles with compatibility scores

πŸ’¬ Real-Time Chat System

  • WebSocket-powered messaging for instant communication
  • Redis-backed online status tracking (using Upstash Cloud)
  • Real-time typing indicators and message status (sent/delivered/read)
  • Support for text messages with emoji picker
  • Conversation history with persistent storage
  • Contact list with online/offline status indicators
  • Unread message counters

πŸ‘€ User Profiles

  • Customizable profile with bio, age, gender, hobbies
  • Profile picture support (Google OAuth integration)
  • Social media links integration (Instagram, WhatsApp, GitHub)
  • Activity feed showing user interactions
  • "Top Questions" showcase on profiles

πŸ” Authentication & Security

  • Google OAuth 2.0 integration (restricted to @nitc.ac.in emails)
  • JWT token-based authentication
  • Secure WebSocket authentication with separate token validation
  • Protected routes and API endpoints

πŸ“± Responsive UI/UX

  • Modern landing page with campus branding
  • Mobile-responsive layout
  • Bottom navigation bar for easy mobile access
  • Real-time UI updates without page refreshes
  • Smooth animations and transitions

⚑ Technical Features

  • RESTful API architecture
  • WebSocket server with connection pooling
  • Redis for distributed state management
  • PostgreSQL database with SQLAlchemy ORM
  • Database migrations with Alembic
  • Concurrent server management (Flask + WebSocket)
  • TypeScript for type-safe frontend development

πŸ—οΈ Technology Stack

Backend

  • Framework: Flask (Python)
  • Database: PostgreSQL with SQLAlchemy ORM
  • Real-time: WebSocket server (websockets library)
  • Cache/State: Redis (Upstash Cloud)
  • Authentication:
    • Google OAuth 2.0 (Authlib)
    • JWT tokens (PyJWT)
    • Flask-Login for session management
  • Migrations: Alembic
  • CORS: Flask-CORS

Frontend

  • Framework: Next.js 15 (React 19)
  • Language: TypeScript
  • Styling: Tailwind CSS
  • Icons: React Icons
  • WebSocket Client: Native WebSocket API with custom hooks

Infrastructure

  • Concurrent Execution: Runs Flask HTTP + WebSocket servers simultaneously
  • Virtual Environment: Python venv for dependency isolation
  • Package Management: npm for frontend, pip for backend

Getting Started

Prerequisites

  • Node.js and npm installed
  • Python installed
  • Git installed

Installation

  1. Clone the repository:

    git clone https://github.com/MUHSIN-M-P/Project-FindMyFriend
    cd frontend
  2. Install dependencies for the frontend:

    npm install
  3. Install dependencies for the backend (ensure you're in the project root):

    cd backend
    # Recommended: create + activate a virtual environment so installs/runs use the same Python
    python -m venv .venv
    # Windows (PowerShell): .\.venv\Scripts\Activate.ps1
    # Windows (cmd.exe):    .\.venv\Scripts\activate.bat
    # macOS/Linux:          source .venv/bin/activate
    
    python -m pip install -r requirements.txt

Available Scripts

Frontend

  • npm run frontend: Runs the Next.js frontend on port 3000.

Backend

  • npm run backend:win: Starts the Flask server on Windows using app.py.
  • npm run backend:linux: Starts the Flask server on Linux/macOS using app.py.

Full-Stack Development

  • npm run dev:win: Runs both the frontend and backend concurrently on Windows.
  • npm run dev:linux: Runs both the frontend and backend concurrently on Linux/macOS.

πŸ“‚ Project Structure

Project-FindMyFriend/
β”œβ”€β”€ backend/                    # Flask Backend
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ models/            # SQLAlchemy models (User, Message, Conversation)
β”‚   β”‚   β”œβ”€β”€ routes/            # API routes (auth, chat, websocket)
β”‚   β”‚   β”œβ”€β”€ services/          # Business logic (AuthService, ChatService)
β”‚   β”‚   β”œβ”€β”€ utils/             # Utilities (decorators, helpers)
β”‚   β”‚   └── websocket/         # WebSocket implementation
β”‚   β”‚       β”œβ”€β”€ server.py      # WebSocket server
β”‚   β”‚       β”œβ”€β”€ client.py      # Connection handler
β”‚   β”‚       β”œβ”€β”€ service.py     # WebSocket service manager
β”‚   β”‚       └── redis_manager.py # Redis operations
β”‚   β”œβ”€β”€ migrations/            # Alembic database migrations
β”‚   β”œβ”€β”€ requirements.txt       # Python dependencies
β”‚   β”œβ”€β”€ run.py                # Main application entry point
β”‚   └── alembic.ini           # Migration configuration
β”‚
β”œβ”€β”€ frontend/                  # Next.js Frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ app/              # Next.js app router
β”‚   β”‚   β”‚   β”œβ”€β”€ chat/         # Real-time chat interface
β”‚   β”‚   β”‚   β”œβ”€β”€ quiz/         # Personality quiz
β”‚   β”‚   β”‚   β”œβ”€β”€ profile/      # User profiles
β”‚   β”‚   β”‚   β”œβ”€β”€ activity/     # Activity feed
β”‚   β”‚   β”‚   β”œβ”€β”€ settings/     # User settings
β”‚   β”‚   β”‚   └── api/          # API routes (auth, chat)
β”‚   β”‚   β”œβ”€β”€ components/       # Reusable UI components
β”‚   β”‚   β”‚   β”œβ”€β”€ Chat_Components/  # Chat-specific components
β”‚   β”‚   β”‚   β”œβ”€β”€ Navbar.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ bottomBar.tsx
β”‚   β”‚   β”‚   └── Usercard.tsx
β”‚   β”‚   └── hooks/            # Custom React hooks
β”‚   β”‚       β”œβ”€β”€ useAuth.ts    # Authentication hook
β”‚   β”‚       └── useWebSocket.ts # WebSocket connection hook
β”‚   β”œβ”€β”€ public/               # Static assets
β”‚   β”‚   β”œβ”€β”€ avatars/          # User avatars
β”‚   β”‚   └── icons/            # UI icons
β”‚   β”œβ”€β”€ package.json
β”‚   └── next.config.ts        # Next.js configuration
β”‚
└── README.md

πŸ”§ Configuration

Environment Variables

Create a .env file in the backend/ directory:

# Database
DATABASE_URL=postgresql://username:password@localhost/findmyfriend

# Google OAuth
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret

# JWT Secret
SECRET_KEY=your_secret_key_for_jwt

# Redis (Upstash)
REDIS_URL=redis://default:password@host:port

# WebSocket
WEBSOCKET_HOST=0.0.0.0
WEBSOCKET_PORT=8765

# Flask
FLASK_ENV=development
FLASK_APP=run.py

πŸš€ Features in Detail

WebSocket Architecture

The application uses a sophisticated WebSocket implementation for real-time features:

  • Separate WebSocket server running on port 8765
  • Redis-powered connection management for scalability
  • JWT authentication for secure connections
  • Automatic reconnection on connection loss
  • Online status tracking with TTL-based cleanup
  • Message delivery status (sent, delivered, read)
  • Typing indicators for active conversations

Chat Features

  • Contact list with search functionality
  • Conversation threads with message history
  • Real-time message delivery
  • Emoji picker for expressive messaging
  • Unread message badges
  • Last seen status for offline users
  • Profile quick view from contact list

Matching Algorithm

  • Questionnaire-based personality assessment
  • Compatibility scoring based on shared interests
  • Best match recommendations
  • Profile discovery with filtering options

Contributing

Feel free to fork the repository and submit pull requests. For major changes, please open an issue first to discuss the proposed changes.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •