Skip to content

Repository files navigation

MindBridge AI

Your 24/7 AI-powered mental health companion

Built for India Β· Powered by Custom ML Β· 100% Free

Live Demo Custom ML Model Gemini Insights Firebase License


"I didn't think an AI could make me feel heard. MindBridge was there at 2am when I had no one else to talk to."


🌟 What is MindBridge?

MindBridge is a free, AI-powered mental health support platform built specifically for India. With 150 million Indians needing mental health care but only 0.3 psychiatrists per 100,000 people, access to support is a crisis in itself.

MindBridge bridges that gap β€” providing compassionate, intelligent, 24/7 mental health support through our custom-trained ML chatbot model, advanced behavioural mood detection, clinically validated screening tools, and mood tracking β€” all completely free, completely private.

⚠️ Disclaimer: MindBridge is a support companion, not a replacement for professional mental health care. If you are in crisis, please call iCall: 9152987821.


✨ Features

πŸ€– AI Chat Support β€” Custom ML Model

The core chatbot is powered by our own in-house trained ML model, purpose-built for empathetic mental health conversations. Unlike generic LLMs, this model was trained specifically on mental health dialogue patterns to listen without judgment, validate feelings before offering advice, detect emotional distress, and provide evidence-based coping strategies. Conversation history is stored per-session in Firestore.

🧠 Behavioural Mood Detection (Novel Feature)

Our sentiment analysis engine goes beyond just text β€” it analyses how you type, not just what you type. Mood is inferred from a combination of behavioural and textual signals in real time:

  • Typing Speed β€” Rapid keystrokes may indicate agitation, anxiety, or urgency; slow typing may suggest low energy or sadness
  • Message Sending Speed β€” Frequency of sent messages within a session is tracked to detect emotional bursts or withdrawal
  • Message Length Patterns β€” Short, fragmented messages vs. lengthy outpourings are weighted as mood signals
  • Punctuation & Casing Patterns β€” Excessive punctuation, ALL CAPS, or absence of punctuation are factored into emotional state scoring
  • Response Latency β€” Time taken between receiving a reply and responding is used as a passive engagement signal
  • Text Sentiment Score β€” Traditional NLP-based sentiment scoring layered with the above behavioural features for a composite mood reading

All of this analysis runs 100% locally in the browser β€” no data ever leaves your device for sentiment processing.

🎀 Voice Mode

Full voice input and output using the Web Speech API β€” completely free, no external service needed. Speak naturally and hear MindBridge respond in a calm, measured voice.

πŸ“‹ PHQ-9 & GAD-7 Assessments (powered by Google Gemini)

Clinically validated depression and anxiety screening tools used worldwide by mental health professionals. After completing an assessment, Gemini AI interprets your specific answers and explains exactly what contributed to your score in plain, compassionate language. Gemini is used here specifically because assessment interpretation benefits from the nuanced reasoning of a frontier LLM.

πŸ“Š Mood Tracker & AI Insights (powered by Google Gemini)

Log your daily mood on a 1–10 scale, enriched with the behavioural signals captured during each session. After 7+ days, get a personalized AI insights report powered by Gemini that identifies your patterns, what affects your mood, and a concrete 5-point action plan based on your actual data. Gemini is used here to generate high-quality, context-aware narrative insights from your mood history.

πŸ“… Chat History by Date

All past conversations organised chronologically β€” just like your favourite AI chat apps. Switch between sessions, start new ones, and pick up where you left off.

πŸ›‘οΈ Trusted Contact System

On first login, users register a trusted contact (friend, parent, counsellor). This safety-first approach ensures someone who cares is always reachable in difficult moments.

πŸ”’ Privacy First

  • All data stored in Firebase Firestore with strict security rules
  • Your conversations are never used for AI training
  • No third-party analytics or data sharing
  • All sentiment analysis and behavioural mood detection runs 100% locally in JavaScript β€” no API calls, no data leaving the browser

πŸ› οΈ Tech Stack

Layer Technology Why
Frontend React 18 + Vite Fast, modern, component-based
Styling Tailwind CSS Utility-first, consistent design
Chatbot Custom Trained ML Model Purpose-built for mental health dialogue
AI Insights & Tests Google Gemini 2.5 Flash Best-in-class narrative reasoning for reports & assessments
Sentiment & Mood Pure JavaScript (Behavioural + NLP) No API calls, fully private, real-time
Auth Firebase Authentication Google-grade security, one-click login
Database Firebase Firestore Real-time, scalable, secure
Hosting Firebase Hosting Global CDN, instant deploys
Voice Web Speech API Built into Chrome, completely free

πŸš€ Getting Started

Prerequisites

Installation

1. Clone the repository

git clone https://github.com/prats010/mindbridge-v2.git
cd mindbridge-v2

2. Install dependencies

npm install

3. Set up Firebase

  • Go to Firebase Console β†’ Create project
  • Enable Google Authentication (Authentication β†’ Sign-in method β†’ Google)
  • Create a Firestore Database (start in production mode)
  • Register a Web App and copy the config

4. Create your .env file

Copy .env.example to .env and fill in your values:

cp .env.example .env
VITE_GEMINI_API_KEY=your_gemini_api_key_here

VITE_FIREBASE_API_KEY=your_firebase_api_key
VITE_FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com
VITE_FIREBASE_PROJECT_ID=your-project-id
VITE_FIREBASE_STORAGE_BUCKET=your-project.appspot.com
VITE_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
VITE_FIREBASE_APP_ID=your_app_id

5. Deploy Firestore security rules

npm install -g firebase-tools
firebase login
firebase use --add
firebase deploy --only firestore:rules

6. Run the app

npm run dev

Open http://localhost:5173 πŸŽ‰


πŸ“¦ Deployment

# Build the app
npm run build

# Deploy to Firebase Hosting
firebase deploy --only hosting

# Your live URL:
# https://your-project-id.web.app

πŸ“ Project Structure

mindbridge-v2/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ Navbar.jsx                  # Navigation bar
β”‚   β”‚   β”œβ”€β”€ CrisisModal.jsx             # Emergency helpline overlay
β”‚   β”‚   └── TrustedContactModal.jsx     # Onboarding safety modal
β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”œβ”€β”€ LoginPage.jsx               # Google sign-in
β”‚   β”‚   β”œβ”€β”€ ChatPage.jsx                # Main AI chat + history sidebar
β”‚   β”‚   β”œβ”€β”€ AssessmentPage.jsx          # PHQ-9 & GAD-7 screening (Gemini-interpreted)
β”‚   β”‚   └── DashboardPage.jsx           # Mood chart + Gemini AI insights
β”‚   β”œβ”€β”€ firebase.js                     # Firestore helpers
β”‚   β”œβ”€β”€ mlModel.js                      # Custom ML chatbot model integration
β”‚   β”œβ”€β”€ gemini.js                       # Gemini AI integration (insights & assessments only)
β”‚   β”œβ”€β”€ sentiment.js                    # Local behavioural + NLP sentiment engine
β”‚   β”œβ”€β”€ App.jsx                         # Router + auth state
β”‚   └── main.jsx                        # Entry point
β”œβ”€β”€ firestore.rules                     # Firestore security rules
β”œβ”€β”€ firebase.json                       # Firebase config
β”œβ”€β”€ .env.example                        # Environment variables template
└── package.json

🧠 How the Chatbot Works

MindBridge's core chat experience is driven by our custom-trained ML model, fine-tuned specifically for mental health support conversations. The model is designed to:

  1. Always acknowledge feelings before offering advice
  2. Use the user's name for personalisation
  3. Keep responses concise and conversational (3–4 sentences)
  4. Ask one thoughtful follow-up question per response
  5. Detect signs of distress and escalate to crisis resources
  6. Never diagnose β€” only reflect and support

Conversation history is passed to the model in full so it maintains context across a session.

Google Gemini is used exclusively for: (1) generating personalised insights reports from mood history data, and (2) interpreting PHQ-9 & GAD-7 assessment results in compassionate, plain language.


πŸ“‘ How Behavioural Mood Detection Works

The sentiment engine captures passive behavioural signals alongside text content to build a richer emotional picture:

Signal What It Detects
Typing speed (WPM) Agitation, urgency, anxiety vs. low energy
Message sending frequency Emotional bursts, withdrawal, engagement level
Message length Fragmented thinking vs. emotional overflow
Punctuation & casing Frustration, distress, or emotional flatness
Response latency Passive engagement or hesitance
NLP sentiment score Base positive / negative / neutral text polarity

These signals are combined into a composite mood score that informs the dashboard and, over time, feeds into the AI insights report. Everything runs locally β€” zero network calls.


🩺 Mental Health Screenings

Tool Purpose Score Range
PHQ-9 Depression screening 0–27
GAD-7 Anxiety screening 0–21

Both are WHO-validated tools used globally by clinical professionals. MindBridge uses them for screening only β€” results are interpreted by Gemini AI with compassion and context, not cold clinical language.


πŸ†˜ Crisis Resources (India)

Organisation Number Hours
iCall 9152987821 Mon–Sat, 8am–10pm
Vandrevala Foundation 1860-2662-345 24/7
NIMHANS 080-46110007 24/7
AASRA 9820466627 24/7

🀝 Contributing

Contributions are welcome. Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“„ License

Distributed under the MIT License. See LICENSE for more information.


πŸ‘¨β€πŸ’» Built By

Prathamesh & Team β€” Built with purpose for the Google Cloud AI Hackathon

🀝 Contributors

Prem β€” Contributed to UI Designing

Mental health support should be accessible to everyone, everywhere, at any hour. MindBridge is our step toward making that real.


If this project helped you or someone you know, please give it a ⭐

Made with ❀️ in India · Powered by Custom ML + Google Gemini · Built for the 150 million

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages