Skip to content
kushGupta-15Public

About

A full-stack language exchange platform with smart reciprocal partner matching, Stream real-time chat & WebRTC video calling, and Google Gemini AI language assistant.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

23 Commits

Folders and files

Repository files navigation

Streamify

A modern language exchange platform connecting language learners worldwide through smart reciprocal matching, real-time messaging, video calling, and Gemini AI language tools.

Live Demo React 19 Node.js MongoDB Gemini AI Stream.io Tailwind CSS


System Architecture

flowchart TB
    subgraph Client["Frontend — React 19 + Vite"]
        Pages["Pages\nLogin / SignUp / Onboarding\nHome / Friends / Chat / Call / Notifications / Settings"]
        Components["Components\nNavbar, Sidebar, FriendCard, LanguageFlag, ChatLoader, CallButton, AiAssistantModal, ThemeSelector"]
        Hooks["Hooks\nuseAuthUser, useLogin, useLogout, useSignUp"]
        Store["Store\nuseThemeStore (Zustand)"]
        APILib["lib/api.js + axios.js\nshared axios instance"]
        Pages --> Components
        Pages --> Hooks
        Pages --> Store
        Hooks --> APILib
    end

    subgraph Server["Backend — Node.js + Express"]
        Security["Security layer\nHelmet, CORS allow-list, rate limiters"]
        Routes["Routes\nauth.route / user.route / chat.route"]
        Middleware["auth.middleware.js\nJWT verification & route protection"]
        Controllers["Controllers\nauth.controller / user.controller / chat.controller"]
        Models["Models\nUser, FriendRequest (Compound Indexed)"]
        StreamLib["lib/stream.js\nStream tokens, users & channels"]
        Validation["lib/validation.js\nInput validation helpers"]
        DBLib["lib/db.js\nMongoDB connection"]

        Security --> Routes
        Routes --> Middleware
        Middleware --> Controllers
        Controllers --> Validation
        Controllers --> Models
        Controllers --> StreamLib
    end

    subgraph External["External Cloud Services"]
        Mongo[("MongoDB Atlas Database")]
        StreamAPI["Stream Chat & Video SDK (WebSockets / WebRTC)"]
        GeminiAPI["Google Gemini API\n3.8 Flash + lite-model fallback"]
        CloudinaryAPI["Cloudinary CDN (Avatar Transforms & Storage)"]
    end

    APILib -- "REST calls with httpOnly JWT cookie" --> Security
    Models --> DBLib
    DBLib --> Mongo
    StreamLib --> StreamAPI
    Controllers -- "Translation, Grammar, Icebreakers" --> GeminiAPI
    Controllers -- "Face-centered crop & upload" --> CloudinaryAPI
    Components -- "Stream Video & Chat Client SDK" --> StreamAPI
Loading

Description

Streamify is a full-stack web application designed to help language learners connect with native speakers and fellow learners. The platform features user authentication, friend matching based on language preferences, real-time messaging, and video calling capabilities. Users can create profiles with their native and target languages, discover compatible language partners, and engage in meaningful conversations to improve their language skills.

Features

  • User Authentication: Secure signup/login with JWT tokens stored in httpOnly cookies, password hashing with bcrypt, case-insensitive emails, and per-IP rate limiting
  • User Onboarding: Complete profile setup with language preferences, bio, location, and device photo uploads
  • Cloud Media Storage: Cloudinary integration for profile avatars featuring automated face-centering crop and auto-format optimization. Uploads up to 5 MB with Cloudinary configured; without it, images are stored inline and capped at 1 MB
  • Smart Reciprocal Matching: Discover language partners ranked by mutual compatibility (100% Perfect Exchange, 75% Native Speaker, 50% Study Partner, 40% Practice Partner, 15% Community Member), with real-time keyword search and language filters
  • Gemini AI Language Tools: Integrated in-chat AI assistant powered by Google's Gemini 3.8 Flash for instant translation with phonetics, grammar error checking with explanations, and contextual conversation icebreakers. Falls back automatically to lighter Gemini models when the primary model is overloaded or slow
  • Friend System: Send, accept, decline, or cancel friend requests, unfriend partners, and dismiss notices
  • Real-time Chat: Instant messaging powered by Stream Chat; channels are created on the server and only between friends
  • Video Calling: High-quality video calls using Stream Video SDK with 1-click friend call access and in-chat call notification prompts
  • Responsive Design: Mobile-friendly interface with mobile bottom navigation, DaisyUI, and Tailwind CSS
  • Automated Testing: Vitest and Node test runner covering matching algorithms, input validation, chat/call authorization, and AI request validation
  • Theme Support: Multiple UI themes for personalized experience

📸 Visual Overview & Core Features

1. User Authentication & Profile Onboarding

A seamless and secure entry flow ensuring personalized language partner discovery right from the start.

Screen View Description
Login Screen Secure Authentication: Split-screen login interface with JWT stored in httpOnly cookies, bcrypt hashing, and rate-limited login attempts.
Sign Up Screen User Registration: Clean onboarding signup enforcing email format validation and password length checks.
Profile Onboarding Interactive Profile Setup: Mandatory profile setup for native and target learning languages, bio, city/country location, and avatar selection.

2. Smart Reciprocal Matching & Discovery

Discover partners tailored to mutual linguistic learning needs.

Screen View Description
Reciprocal Discovery Compatibility Algorithm: Partners ranked into tiered badges (100% Perfect Exchange, 75% Native Speaker, 50% Study Partner, 40% Practice Partner) for high-efficiency reciprocal exchange.
Search and Filtering Real-Time Search & Filtering: Instant client-side and backend search across partner names, bios, and locations with language category filters.

3. Social Network & Friendship Lifecycle

Robust friend management with real-time alerts.

Screen View Description
Connected Partners Language Partners Directory: View connected friends with native/learning language flags, direct 1-click Message and Video Call buttons, and unfriend controls.
Friend Notifications Social Notifications: Incoming friend requests with instant Accept or Decline actions and dismissible connection alerts.

4. Real-Time Chat & Google Gemini AI Assistant

Low-latency messaging integrated with generative language learning intelligence.

Screen View Description
Stream Chat Interface Stream Chat Messaging: Real-time conversation threads with online indicators, message bubbles, participant authorization checks, and in-chat call actions.
Gemini AI Assistant Google Gemini 3.8 Flash Assistant: In-chat AI modal providing Instant Translation with pronunciation phonetics, Grammar Diagnostics with explanations, and Contextual Icebreakers.

5. WebRTC Video Calling

Face-to-face language practice with route-level authorization.

Screen View Description
WebRTC Video Calling Stream Video Calling: High-quality WebRTC video calls with active speaker layout, floating call controls (mute, camera, emojis, screen share), and backend room authorization (/api/chat/verify-call).

6. Personalization & 32 Dynamic Themes

Full customization across light, dark, and novelty themes.

Screen View Description
Profile Settings Profile Customization: Update display name, bio, language preferences, location, and upload avatars optimized via Cloudinary face-centering transforms.
DaisyUI Theme Selector 32-Theme Dynamic Palette: Instant theme switching powered by DaisyUI (Forest, Synthwave, Cyberpunk, Luxury, Cupcake, etc.) persisted in the browser's localStorage.

Tech Stack

Frontend

  • React 19 - Modern UI library
  • Vite - Fast build tool and dev server
  • Vitest - Unit and integration testing
  • React Router - Client-side routing
  • Tailwind CSS - Utility-first CSS framework
  • DaisyUI - Component library for Tailwind
  • Stream Chat React - Real-time messaging components
  • Stream Video React SDK - Video calling functionality
  • Zustand - State management
  • React Query - Server state management
  • Axios - HTTP client

Backend

  • Node.js - JavaScript runtime
  • Express.js - Web application framework
  • MongoDB - NoSQL database
  • Mongoose - MongoDB object modeling
  • Cloudinary - Media asset cloud storage & transformations
  • Google Gemini API - Conversational AI language assistant (gemini-3.8-flash, with lite-model fallback)
  • Stream Chat - Chat backend service
  • JWT - Authentication tokens
  • bcryptjs - Password hashing
  • CORS - Cross-origin resource sharing (allow-listed origins only)
  • Helmet & express-rate-limit - Security headers and request rate limiting

Installation

Prerequisites

  • Node.js 20 or higher (required by React Router 7 and Vite 6)
  • MongoDB database (e.g. a free MongoDB Atlas cluster)
  • Stream.io account (for chat and video features)
  • Google Gemini API key (for the AI language tools)
  • Cloudinary account (optional, for avatar uploads larger than 1 MB)

1. Clone the repository

git clone https://github.com/kushGupta-15/Streamify.git
cd Streamify

2. Install dependencies

# Install backend dependencies
cd Backend
npm install

# Install frontend dependencies
cd ../Frontend
npm install

3. Environment Setup

Copy Backend/.env.example to Backend/.env and Frontend/.env.example to Frontend/.env, then fill in your values.

Backend Environment (.env in Backend folder)

PORT=5001
MONGO_URI=your_mongodb_connection_string
STREAM_API_KEY=your_stream_api_key
STREAM_API_SECRET=your_stream_api_secret
JWT_SECRET_KEY=a_long_random_secret
NODE_ENV=development
GEMINI_API_KEY=your_gemini_api_key

# Optional
GEMINI_MODEL=gemini-3.8-flash                     # primary Gemini model (lite models are used as fallback)
CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name  # avatar uploads via Cloudinary
CLOUDINARY_API_KEY=your_cloudinary_api_key
CLOUDINARY_API_SECRET=your_cloudinary_api_secret
CLIENT_URL=https://your-frontend.example.com      # only if the frontend is hosted on a different domain
KEEP_ALIVE_URL=https://your-app.onrender.com      # pinged every 10 minutes to stop a free Render instance from sleeping

The older names STEAM_API_KEY / STEAM_API_SECRET are still accepted for backward compatibility.

Frontend Environment (.env in Frontend folder)

VITE_STREAM_API_KEY=your_stream_api_key

4. Database Setup

Ensure your MongoDB database is running and accessible via the connection string in your backend .env file.

Usage

Development Mode

  1. Start the backend server:
cd Backend
npm run dev

The backend will run on http://localhost:5001

  1. Start the frontend development server:
cd Frontend
npm run dev

The frontend will run on http://localhost:5173

Running Automated Tests

Run both backend and frontend test suites from the root repository:

npm test

Or run individually:

  • Backend: npm test --prefix Backend (Node.js test runner)
  • Frontend: npm test --prefix Frontend (Vitest)

Production Mode

  1. Build the application:
npm run build
  1. Start the production server:
npm start

Using the Application

  1. Sign Up: Create a new account with email and password
  2. Onboarding: Complete your profile with:
    • Full name and bio
    • Native language
    • Language you want to learn
    • Location
  3. Discover: Browse recommended language partners
  4. Connect: Send friend requests to potential language partners
  5. Chat: Start conversations with your friends
  6. Video Call: Initiate video calls directly from chat

Deployment (Render)

The repository includes a render.yaml blueprint that deploys the backend and the built frontend as one web service: npm run build builds the React app, and Express serves it from Frontend/dist alongside the API.

  1. In Render, create a new Blueprint from this repository.
  2. In the service's Environment tab, set every variable marked sync: false in render.yaml (MONGO_URI, JWT_SECRET_KEY, GEMINI_API_KEY, the Stream and Cloudinary keys).
  3. Also add VITE_STREAM_API_KEY (same value as your Stream API key). It is read when the frontend is built, and Frontend/.env is not committed, so without it chat and video will not work in production.
  4. Optionally set KEEP_ALIVE_URL to your app's URL so the free instance doesn't go to sleep.
  5. In MongoDB Atlas, allow connections from Render (Network Access).

RENDER_EXTERNAL_URL is set automatically by Render and is added to the CORS allow-list.

Security

  • Authentication: bcrypt-hashed passwords (never returned by the API), JWT in an httpOnly, sameSite=strict, secure (in production) cookie.
  • Rate limiting (per client IP, behind Render's proxy): 30 login/signup attempts, 40 AI requests and 300 API requests per 15 minutes.
  • Input validation: string-only credentials (blocks NoSQL operator injection), escaped search input (blocks regex DoS), ObjectId checks on route parameters, length limits on profile fields and AI input, and profile pictures restricted to https URLs or PNG/JPEG/WebP/GIF images.
  • Privacy: partner discovery only returns public profile fields; emails and friend lists are never exposed.
  • Authorization: friend requests can only be accepted/declined by their recipient; chats and 1:1 calls are only allowed between friends, and chat channels are created on the server.
  • HTTP hardening: Helmet security headers, X-Powered-By hidden, CORS limited to an allow-list, and internal error details are never sent to clients.
  • Secrets: the Gemini key is sent in a request header, never in URLs; all keys live in environment variables.

Recommended Stream setting: in the Stream dashboard, open Chat → Roles & Permissions → messaging and remove Create Channel from the user role. Channels are created by the server, so this stops clients from opening chats with non-friends by calling Stream directly.

API Endpoints

Authentication

  • POST /api/auth/signup - User registration
  • POST /api/auth/login - User login
  • POST /api/auth/logout - User logout
  • POST /api/auth/onboarding - Complete user onboarding
  • PUT /api/auth/profile - Update user profile
  • GET /api/auth/me - Get currently logged-in user (session check)

Users

All routes below require authentication.

  • GET /api/users?search=&language=&matchType= - Get recommended partners ranked by reciprocal compatibility
  • GET /api/users/friends - Get user's friends list
  • DELETE /api/users/friends/:id - Unfriend a connected user
  • POST /api/users/friend-request/:id - Send a friend request to user :id
  • PUT /api/users/friend-request/:id/accept - Accept a friend request
  • PUT /api/users/friend-request/:id/reject - Decline a friend request
  • DELETE /api/users/friend-request/:id - Cancel a pending friend request
  • GET /api/users/friend-requests - Get incoming (pending) and accepted friend requests
  • PUT /api/users/friend-requests/:id/dismiss - Dismiss an accepted connection notification
  • GET /api/users/outgoing-friend-requests - Get friend requests sent by current user (pending)

Chat, Video & AI Language Tools

  • GET /api/chat/token - Get Stream chat token
  • GET /api/chat/verify/:targetUserId - Verify friendship access before joining private chat
  • GET /api/chat/verify-call/:callId - Verify participant authorization before joining video call
  • POST /api/chat/ai-assistant - Gemini AI language assistance (translate, grammar-check, icebreakers)

Project Structure

Streamify/
├── Backend/
│   ├── src/
│   │   ├── controllers/     # Route handlers (auth, users, chat & AI)
│   │   ├── middleware/      # JWT auth middleware
│   │   ├── models/          # Mongoose models (User, FriendRequest)
│   │   ├── routes/          # API routes
│   │   ├── lib/             # DB, Stream, Cloudinary and validation helpers
│   │   └── server.js        # Express server, security middleware, static frontend
│   ├── test/                # Node test runner tests
│   ├── package.json
│   └── .env                 # not committed
├── Frontend/
│   ├── src/
│   │   ├── components/      # Reusable UI components
│   │   ├── pages/           # Page components
│   │   ├── hooks/           # Custom React hooks
│   │   ├── lib/             # API client and utilities
│   │   ├── store/           # Zustand stores
│   │   ├── constants/       # Languages, flags and themes
│   │   └── test/            # Vitest tests
│   ├── package.json
│   └── .env                 # not committed
├── docs/screenshots/        # README screenshots
├── render.yaml              # Render deployment blueprint
├── package.json             # Root scripts (build, start, test)
└── readme.md

About

A full-stack language exchange platform with smart reciprocal partner matching, Stream real-time chat & WebRTC video calling, and Google Gemini AI language assistant.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages