A web app that tracks your mood during focus sessions. Record a short voice check-in at the start and end of each session. The app analyzes your emotional state using AI and shows you patterns over time.
- Voice Check-ins — Record yourself talking at the beginning and end of a focus session
- Emotion Analysis — Audio analyzed using VAD (Valence-Arousal-Dominance) deep learning model
- 3D Dashboard — Interactive visualization with live emotion timeline
- Insights & Recommendations — Focus stability metrics, emotion distribution, and AI-generated suggestions
- Session Management — Browse, filter, and search through all past sessions
moodflow/
├── web/ # Next.js 14 frontend
│ ├── app/ # Pages (dashboard, sessions, insights, login)
│ ├── components/ # React components with Framer Motion
│ ├── lib/ # Utilities (API client, analytics, recording)
│ └── prisma/ # Database schema
├── ai-service/ # FastAPI AI inference service
│ ├── app/
│ │ ├── pipelines/ # ML inference pipelines
│ │ ├── routes/ # FastAPI endpoints
│ │ ├── cache/ # Model caching system
│ │ └── utils/ # Audio preprocessing
│ └── scripts/ # Management scripts
└── docker-compose.yml # PostgreSQL + MinIO
| Layer | Technologies |
|---|---|
| Frontend | Next.js 14, React 18, TypeScript, Tailwind CSS, Framer Motion |
| 3D / Visual | Three.js, React Three Fiber |
| Backend | Next.js API Routes |
| Database | PostgreSQL + Prisma ORM |
| File Storage | MinIO (S3-compatible) |
| AI Service | FastAPI, PyTorch, Transformers, Whisper, Wav2Vec2 |
MoodFlow is a modern web application that helps users track their emotional well-being during work sessions. Through voice check-ins and AI-powered analysis, it provides deep insights into mood patterns, focus stability, and stress levels.
- Voice Check-ins: Record voice notes at the start and end of focus sessions
- AI-Powered Analysis: Emotion detection using VAD (Valence-Arousal-Dominance) model
- Real-time Dashboard: Live tracking of sessions, focus time, and current mood
- Insights & Trends: Weekly emotional patterns, focus stability metrics, and AI recommendations
- Session Management: Create, track, and analyze focus sessions with detailed analytics
| Component | Technology |
|---|---|
| Frontend | Next.js 14, React 18, TypeScript |
| Styling | Tailwind CSS, Framer Motion |
| 3D Graphics | Three.js, React Three Fiber |
| Backend | Next.js API Routes |
| Database | PostgreSQL with Prisma ORM |
| Storage | MinIO (S3-compatible) |
| AI Service | FastAPI, PyTorch, Transformers, Whisper |
docker-compose up -d- PostgreSQL:
localhost:5432 - MinIO API:
localhost:9000 - MinIO Console:
localhost:9001
This starts PostgreSQL (port 5432) and MinIO (ports 9000, 9001).
cd ai-service
pip install -r requirements.txt
uvicorn app.main:app --host 0.0.0.0 --port 8000cd web
npm install
cp .env.example .env.local
npm run prisma:generate
npm run prisma:migrate
npm run devcd ai-service
pip install -r requirements.txt
# Pre-warm model cache (downloads ML models)
python scripts/cache_models.py
# Start the service
uvicorn app.main:app --host 0.0.0.0 --port 8000Open http://localhost:8000/docs for API documentation.
The AI service provides emotion detection and speech-to-text transcription through REST APIs.
| Endpoint | Method | Description |
|---|---|---|
/health |
GET | Health check |
/process-checkin/ |
POST | Short audio check-in processing |
/analyze-audio/ |
POST | Long audio analysis with stress tracking |
Audio Input (16kHz mono)
↓
┌─────────────────────────┐
│ Wav2Vec2 Feature │
│ Extractor │
│ (audeering model) │
└─────────────────────────┘
↓
┌─────────────────────────┐
│ Pre-trained Wav2Vec2 │
│ Emotion Detection │
│ (VAD Regression) │
└─────────────────────────┘
↓
┌─────────────────────────┐
│ Stress Calculation │
│ + Emotion Mapping │
└─────────────────────────┘
↓
Output: { valence, arousal, dominance, stress_index, calm, stress, focus }
| Model | Purpose | Size |
|---|---|---|
audeering/wav2vec2-large-robust-12-ft-emotion-msp-dim |
Emotion detection (VAD) | ~800MB |
openai/whisper-base |
Speech-to-text transcription | ~300MB |
Models are cached locally to avoid re-downloading on every cold start:
# Pre-warm cache (run during deployment)
python scripts/cache_models.py
# Check cache status
python scripts/cache_models.py --info
# Verify cache integrity
python scripts/cache_models.py --verify# AI Service (.env)
GEMINI_API_KEY=your_api_key # For topic extraction
MODEL_CACHE_DIR=./models # Local model cache directory
USE_MODEL_CACHE=true # Enable/disable cachingcd web
npm run dev # Development server
npm run build # Production build
npm run start # Production server
npm run lint # ESLint
npm run prisma:generate # Generate Prisma client
npm run prisma:migrate # Run migrations
npm run prisma:push # Push schema (no migration history)| Variable | Default | Description |
|---|---|---|
DATABASE_URL |
postgresql://... |
PostgreSQL connection string |
AI_SERVICE_BASE_URL |
http://localhost:8000 |
AI service URL |
MINIO_ENDPOINT |
localhost |
MinIO server |
MINIO_PORT |
9000 |
MinIO port |
MINIO_ACCESS_KEY |
minio_user |
MinIO access key |
MINIO_SECRET_KEY |
minio_password |
MinIO secret key |
MINIO_BUCKET |
moodflow |
MinIO bucket name |
- User — Account info and preferences
- FocusSession — Focus session with start/end emotions and metrics
- Recording — Audio files with analysis results
- UserPreference — Per-user settings (theme, reminders, audio quality)
# Web app
cd web && npm test
# AI service
cd ai-service && pytest# Build web app
cd web && docker build -t moodflow-web .
# Build AI service
cd ai-service && docker build -t moodflow-ai .MIT
| Variable | Description | Default |
|---|---|---|
DATABASE_URL |
PostgreSQL connection string | postgresql://moodflow_user:moodflow_password@localhost:5432/moodflow_db |
MINIO_ENDPOINT |
MinIO server endpoint | localhost |
MINIO_PORT |
MinIO server port | 9000 |
MINIO_ACCESS_KEY |
MinIO access key | minio_user |
MINIO_SECRET_KEY |
MinIO secret key | minio_password |
MINIO_BUCKET |
MinIO bucket name | moodflow |
AI_SERVICE_URL |
AI service URL | http://localhost:8000 |
Create based on .env.example in the ai-service directory.
moodflow/
├── docker-compose.yml # PostgreSQL + MinIO
├── web/ # Next.js application
│ ├── app/ # App router pages
│ │ ├── api/ # API routes
│ │ ├── dashboard/ # Dashboard pages
│ │ └── login/ # Authentication
│ ├── components/ # React components
│ ├── lib/ # Utility functions
│ └── prisma/ # Database schema
├── ai-service/ # FastAPI AI service
│ ├── app/
│ │ ├── pipelines/ # Audio processing pipelines
│ │ ├── routes/ # API endpoints
│ │ └── utils/ # Utility functions
│ └── requirements.txt
└── LICENSE
| Service | Command | URL |
|---|---|---|
| PostgreSQL | docker-compose up -d postgres |
localhost:5432 |
| MinIO | docker-compose up -d minio |
localhost:9000 (API), localhost:9001 (Console) |
| AI Service | uvicorn app.main:app --host 0.0.0.0 --port 8000 |
localhost:8000 |
| Web App | npm run dev (in web/) |
localhost:3000 |
| Script | Description |
|---|---|
npm run dev |
Start development server |
npm run build |
Build for production |
npm run start |
Start production server |
npm run lint |
Run ESLint |
npm run prisma:generate |
Generate Prisma client |
npm run prisma:migrate |
Run database migrations |
npm run prisma:push |
Push schema to database |
This project is licensed under the MIT License - see the LICENSE file for details.
7fe3eba7b873f1d3c5064aece88ccc06fe2708ea