Loading repository data…
Loading repository data…
Farruxh / repository
An AI-powered mental health companion featuring empathetic Gemini-based conversations, NLP journaling analytics, and interactive wellness resources.
MindCare is a comprehensive, state-of-the-art mental health companion proposed as our final year project designed to provide emotional support, track user wellbeing, and guide users to professional clinical help when necessary. The platform combines conversational AI with local machine learning models, structured self-assessments, persistent daily journaling, and interactive wellness resources to create a private, supportive, and data-driven emotional support system.
gemini-2.5-flash), acting as an active-listening, supportive virtual assistant.Normal, Anxiety, Stress, and Depression.improving, stable, worsening) and maps out dominant emotional state distributions.graph TD
subgraph Frontend [React Frontend client]
A[Vite + React & TypeScript] --> B[Material UI & Tailwind CSS]
A --> C[Recharts Analytics]
A --> D[React Router DOM]
end
subgraph Backend [FastAPI Backend Server]
E[FastAPI Web Framework] --> F[SQLAlchemy ORM]
E --> G[Hugging Face Transformer Pipeline]
E --> H[Google Gemini SDK]
F --> I[(PostgreSQL DB)]
end
A -- REST API Calls --> E
google-genai SDK)transformers pipeline loaded with a local text classification model (safetensors format)MindCare/
├── backend/
│ ├── alembic/ # Database migration history
│ ├── app/
│ │ ├── dependency/ # Auth dependency middleware
│ │ ├── models/ # SQLAlchemy Database Models
│ │ ├── routes/ # FastAPI API Endpoints
│ │ ├── schemas/ # Pydantic Schemas (validation)
│ │ ├── services/ # Business logic (Gemini, Inference, Assessment, etc.)
│ │ ├── db.py # DB connection initializer
│ │ ├── main.py # FastAPI main app entry point
│ │ └── settings.py # Pydantic Settings & ENV parser
│ ├── tests/ # load testing and Unit testing files
│ ├── scheduler.py # Cron/Manual script for weekly report generation
│ ├── requirements.txt # Python dependencies
│ └── pytest.ini # Test configurations
└── frontend/
├── public/ # Static assets (audios)
├── src/
│ ├── api/ # AxiosInstance for API calls
│ ├── app/
│ │ ├── components/ # Pages & shared UI components
│ │ ├── pages/ # Dashboard, Assessment, and Wellness page components
│ │ ├── context/ # AuthContext & state providers
│ │ ├── hooks/ # Custom hook for document title
│ │ ├── App.tsx # Root Component
│ │ └── AppRoutes.tsx # Client Route configurations
│ ├── styles/ # Global styles and custom CSS variables
│ └── main.tsx # Frontend entry point
├── package.json # Node dependencies & scripts
└── vite.config.ts # Vite build configurations
Navigate to the backend directory:
cd backend
Create and activate a virtual environment:
python -m venv venv
# On Windows (PowerShell):
.\venv\Scripts\Activate
# On macOS/Linux:
source venv/bin/activate
Install python packages:
pip install -r requirements.txt
Create a .env file in the root of the backend/ directory following this format:
DATABASE_URL="postgresql://<username>:<password>@localhost:5432/MindCare"
ACCESS_TOKEN_SECRET_KEY="your-jwt-access-secret"
REFRESH_TOKEN_SECRET_KEY="your-jwt-refresh-secret"
ALGORITHM="HS256"
ACCESS_TOKEN_EXPIRE_TIME=20
REFRESH_TOKEN_EXPIRE_TIME=10
MAIL_USERNAME="your-email@gmail.com"
MAIL_PASSWORD="your-email-app-password"
MAIL_FROM="your-email@gmail.com"
MAIL_SERVER="smtp.gmail.com"
MAIL_PORT=587
MAIL_STARTTLS=True
MAIL_SSL_TLS=False
CORS_ORIGIN="http://localhost:5173"
GEMINI_API_KEY="your-google-gemini-api-key"
GEMINI_MODEL="gemini-2.5-flash"
Run database migrations:
alembic upgrade head
Start the FastAPI server:
uvicorn app.main:app --reload
The backend will launch at http://localhost:8000 with Swagger docs available at http://localhost:8000/docs.
Navigate to the frontend directory:
cd ../frontend
Install Node dependencies:
npm install
Launch the Vite development server:
npm run dev
The frontend will run at http://localhost:5173.
To process user daily journals and compile weekly mental health reports, a background scheduler is provided. This analyzes diary logs created during the current calendar week (since Monday 00:00:00).
python scheduler.py
python scheduler.py --user_id <USER_ID>
(e.g., python scheduler.py --user_id 1)MindCare respects user privacy. Journal entries and self-assessment history are stored in a private database. AI assistant context analysis is computed during runtime session requests and is not permanently trained on by external large language models.