Skip to content

bp0609/HearMeOut

Repository files navigation

HearMeOut: A mood journaling app

A speech-based mental health monitoring web application that helps university students track their emotional well-being through daily voice recordings. Record your mood in 30-60 seconds, get AI-powered emotion analysis, and track patterns over time.


πŸ”„ User Flow Demo

HearMeOut User Flow Demo

πŸ“± See HearMeOut in action - Complete mood tracking workflow from recording to insights


πŸ“š Documentation

  • Setup Guide - Installation and configuration instructions
  • API Documentation - Complete REST API reference with 24 endpoints covering mood entries, progress analytics, activities, settings, and audio management
  • ML Service README - ML service API documentation and emotion detection details

πŸ› οΈ Tech Stack

Frontend

  • Framework: React 18 + TypeScript + Vite
  • UI: Tailwind CSS + shadcn/ui
  • Auth: Clerk
  • Charts: Recharts
  • Speech-to-Text: Web Speech API (browser-native)

Backend

  • Framework: Node.js + Express + TypeScript
  • ORM: Prisma
  • Database: PostgreSQL 15
  • Auth: Clerk Node SDK
  • File Upload: Multer

ML Service

  • Framework: Python Flask
  • Model: wav2vec2-lg-xlsr-en-speech-emotion-recognition
  • Audio Processing: librosa, torch, transformers
  • Supported Formats: WAV, MP3, WebM, OGG

Infrastructure

  • Containerization: Docker + Docker Compose

πŸ—οΈ System Architecture

Overview

System Architecture

Detailed Architecture

Detailed System Architecture

Docker Architecture

Docker Architecture

Components

Frontend

  • React with TypeScript
  • Real-time speech-to-text using Web Speech API
  • Interactive calendar with mood visualization
  • Progress analytics with charts
  • Clerk authentication integration

Backend

  • RESTful API with Express.js
  • Prisma ORM for database operations
  • Pattern detection service for mood analysis
  • File upload handling with Multer
  • JWT-based authentication using Clerk Node SDK

ML Service

  • Flask API for emotion detection
  • Pre-trained Wav2Vec2 model
  • 8 emotion classifications
  • Confidence scoring for each emotion

Database

  • PostgreSQL with Prisma schema
  • User settings and preferences
  • Mood entries with activities
  • Pattern alerts tracking

Database Schema

API Flow

API Flows

ML Model Output

Model Output


πŸš€ Setup

Prerequisites

  • Node.js 18+ and npm
  • Python 3.10+
  • Docker and Docker Compose
  • Clerk account (free at clerk.com)

Quick Start

1. Clone repository

git clone <repository-url>
cd HearMeOut

2. Get Clerk API Keys

  • Sign up at clerk.com
  • Create a new application
  • Copy Publishable Key and Secret Key

3. Configure environment

Copy example files and update with your Clerk keys:

cp backend/.env.example backend/.env
cp frontend/.env.example frontend/.env

Update backend/.env:

DATABASE_URL="postgresql://admin:devpassword@localhost:5432/mood_journal"
CLERK_SECRET_KEY="sk_test_your_secret_key_here"  # Replace with your Clerk secret key
ML_SERVICE_URL="http://ml-service:8000"
PORT=5001

Update frontend/.env:

VITE_CLERK_PUBLISHABLE_KEY="pk_test_your_publishable_key_here"  # Replace with your Clerk publishable key
VITE_API_URL="http://localhost:5001"

4. Install dependencies

make install
# or manually: cd backend && npm install && cd ../frontend && npm install

5. Download ML Model

Download the pre-trained model from OneDrive Link and extract to ml-service/wav2vec2-lg-xlsr-en-speech-emotion-recognition/ folder.

6. Start services

# Start Docker services (PostgreSQL + ML Service)
make docker-up

# Setup database (first time only)
make db-migrate

# Start backend (Terminal 1)
cd backend && npm run dev

# Start frontend (Terminal 2)
cd frontend && npm run dev

Access the application:

Note: ML service takes 1-2 minutes to load models on first startup. Check logs: docker-compose logs -f ml-service

For detailed instructions, see SETUP.md


✨ Features

Voice-Based Mood Tracking

Record 30-60 second daily check-ins with your voice.

Recording Interface

Live Speech-to-Text

Real-time transcription of your voice using Web Speech API.

Speech-to-Text

AI Emotion Analysis

Automatic emotion detection using wav2vec2 model with confidence scores for 8 emotions.

Emotion Analysis

Interactive Calendar

Visual mood history with emoji stickers for each day.

Calendar View

Activity Tracking

Associate your moods with activities like exercise, social time, work, hobbies, and more.

Activity Selection

Progress Analytics

Comprehensive analytics with multiple visualizations:

  • Mood Distribution - Pie charts showing emotion frequency
  • Weekday Trends - See which days you feel best/worst
  • Mood Timeline - Track emotional changes over time
  • Mood-Activity Correlation - Discover which activities improve your mood

Progress Dashboard

Mood Distribution Mood Distribution Mood Distribution

Pattern Detection

Get alerts when concerning patterns emerge, such as consecutive low mood days.

Pattern Alerts

Privacy Controls & Audio Management

Complete control over your audio recordings:

  • Optional Audio Storage - Choose whether to store recordings
  • Consent Management - Clear consent process for audio storage
  • View Recordings - Access all your stored audio files
  • Playback - Listen to past recordings anytime
  • Delete Anytime - Remove individual recordings or disable storage to delete all

Privacy Settings Data History


πŸ“ Detailed User Journey

Daily Check-In Flow

  1. Home - View calendar with mood history and current streak
  2. Record - Choose language and record 30-60 second voice note
  3. Transcription - Watch live speech-to-text as you speak
  4. Processing - ML service analyzes audio and suggests emotions
  5. Select Emoji - Choose the emoji that best represents your mood
  6. Add Activities - Optionally tag activities related to your mood
  7. Complete - Entry saved and appears on calendar

Additional Features

  • Progress Tab - View mood distribution, weekday trends, timeline charts, and activity statistics
  • Pattern Alerts - Receive notifications for concerning mood patterns with helpful suggestions
  • Settings - Manage audio storage consent, reminders, intervention thresholds, and language preferences
  • Audio Library - View, playback, and manage all stored audio recordings
  • Data Management - View, edit, and delete past mood entries

πŸ”’ Privacy & Security

Audio File Handling

By default, audio files are deleted immediately after ML analysis:

  1. Audio uploaded β†’ Saved to backend/temp_audio/
  2. ML analyzes β†’ Emotion scores extracted
  3. Audio file deleted (unless storage enabled)

Optional Audio Storage:

  • Users must explicitly consent to audio storage in Settings
  • When enabled, audio files are retained and accessible via Audio Library
  • Users can view all recordings, play them back, or delete individual files
  • When storage is disabled, all stored audio is automatically deleted
  • Provides complete transparency and control over personal data

Authentication

  • Clerk manages all authentication and user sessions
  • All API endpoints validate JWT tokens
  • User data is isolated by Clerk user ID
  • Secure, privacy-first design

πŸ—‚οΈ Project Structure

HearMeOut/
β”œβ”€β”€ backend/                   # Express + TypeScript API
β”‚   β”œβ”€β”€ prisma/schema.prisma  # Database schema
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ routes/           # API endpoints (mood, progress, activities, settings, audio)
β”‚   β”‚   β”œβ”€β”€ services/         # Business logic (ML, pattern detection, Prisma)
β”‚   β”‚   β”œβ”€β”€ middleware/       # Auth, error handling, file upload
β”‚   β”‚   └── utils/            # Date utilities
β”‚   └── temp_audio/           # Temporary/stored audio files
β”‚
β”œβ”€β”€ frontend/                  # React + TypeScript + Vite
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ pages/            # Route pages
β”‚   β”‚   β”œβ”€β”€ components/       # UI components
β”‚   β”‚   β”œβ”€β”€ hooks/            # Custom hooks
β”‚   β”‚   └── lib/              # API client, utilities
β”‚   └── ...
β”‚
β”œβ”€β”€ ml-service/               # Flask + PyTorch
β”‚   β”œβ”€β”€ app.py               # Flask API
β”‚   β”œβ”€β”€ config.py            # Configuration
β”‚   └── wav2vec2-lg-xlsr-en-speech-emotion-recognition/
β”‚
β”œβ”€β”€ docker-compose.yml        # PostgreSQL + ML Service
β”œβ”€β”€ docs/                     # Documentation
β”‚   β”œβ”€β”€ SETUP.md              # Setup guide
β”‚   └── API_DOCUMENTATION.md  # API reference
└── Makefile                  # Development commands

πŸ§ͺ Development

Useful Commands

# View all commands
make help

# Setup & Installation
make install        # Install all dependencies
make docker-up      # Start Docker services
make db-migrate     # Run database migrations

# Database Management
make db-reset       # Reset database (with confirmation)

# Docker Operations
make docker-down    # Stop Docker services
make docker-logs    # View Docker logs (live)

# Testing & Utilities
make test-ml        # Test ML service
make clean          # Clean temp files and build artifacts

# Manual Commands
cd backend && npx prisma migrate dev --name migration_name  # Create new migration
docker-compose ps                                           # List running services

πŸ“„ License

MIT License - See LICENSE file for details.


Disclaimer: This is a mood tracking tool, not a diagnostic or treatment application. If you're experiencing mental health concerns, please consult a qualified mental health professional.

About

A speech-based mental health monitoring web app. Record daily mood check-ins via voice, get AI-powered emotion analysis using wav2vec2, and track patterns over time. Built with React, Node.js, Flask, and PostgreSQL.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors