Skip to content

Project Structure

Prathamesh Bhamare edited this page Mar 9, 2026 · 1 revision

πŸ“ Project Structure

A complete breakdown of every file and folder in MindBridge V2.


Root Directory

mindbridge-v2/
β”œβ”€β”€ .github/
β”‚   └── workflows/
β”‚       └── firebase-hosting-merge.yml  ← CI/CD auto-deploy
β”œβ”€β”€ src/                                ← All React source code
β”œβ”€β”€ .env                                ← Your secret keys (never commit)
β”œβ”€β”€ .env.example                        ← Template for .env
β”œβ”€β”€ .gitignore                          ← Files Git ignores
β”œβ”€β”€ firebase.json                       ← Firebase project config
β”œβ”€β”€ firestore.rules                     ← Firestore security rules
β”œβ”€β”€ firestore.indexes.json              ← Firestore indexes
β”œβ”€β”€ index.html                          ← HTML entry point
β”œβ”€β”€ package.json                        ← Dependencies
β”œβ”€β”€ postcss.config.js                   ← PostCSS config for Tailwind
β”œβ”€β”€ tailwind.config.js                  ← Tailwind CSS config
└── vite.config.js                      ← Vite bundler config

src/ Directory

src/
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ Navbar.jsx              ← Top navigation bar
β”‚   β”œβ”€β”€ CrisisModal.jsx         ← Emergency helpline overlay
β”‚   └── TrustedContactModal.jsx ← Onboarding safety modal
β”œβ”€β”€ pages/
β”‚   β”œβ”€β”€ LoginPage.jsx           ← Google sign-in screen
β”‚   β”œβ”€β”€ ChatPage.jsx            ← Main AI chat + history sidebar
β”‚   β”œβ”€β”€ AssessmentPage.jsx      ← PHQ-9 & GAD-7 screening
β”‚   └── DashboardPage.jsx       ← Mood chart + AI insights
β”œβ”€β”€ App.jsx                     ← Router + auth state management
β”œβ”€β”€ firebase.js                 ← All Firestore helper functions
β”œβ”€β”€ gemini.js                   ← Gemini AI integration
β”œβ”€β”€ sentiment.js                ← Local JS sentiment analysis
β”œβ”€β”€ main.jsx                    ← React entry point
└── index.css                   ← Global styles + Tailwind imports

Key Files Explained

src/firebase.js

Contains all Firestore helper functions:

  • saveMessage() β€” save a chat message
  • loadMessages() β€” load messages for a session
  • createSession() β€” create a new chat session
  • getSessions() β€” get all sessions for sidebar
  • saveAssessment() β€” save PHQ-9 or GAD-7 result
  • loadAssessments() β€” load assessment history
  • saveMoodLog() β€” log daily mood
  • loadMoodLogs() β€” load mood history for chart
  • saveUserProfile() β€” save user profile data

src/gemini.js

Contains all Gemini AI functions:

  • sendToGemini() β€” send message with history
  • interpretAssessment() β€” get AI interpretation of score
  • detectCrisis() β€” detect crisis keywords

src/sentiment.js

Pure JavaScript sentiment analysis. No API needed. Returns score (-1 to +1) and magnitude.

firestore.rules

Security rules that ensure users can only read and write their own data. Always deploy this after any changes:

firebase deploy --only firestore:rules

.github/workflows/firebase-hosting-merge.yml

The CI/CD pipeline. Runs automatically on every push to main. Installs packages, builds the app, deploys to Firebase Hosting.

Clone this wiki locally