MindMirror × Luna — Performance-First Mental Health

Inspiration

IIT Delhi is a pressure cooker. We observed a recurring paradox: students often realize they are burnt out only after a physical or mental breakdown. While the campus wellness center is excellent, a 3-week waitlist means critical moments of stress often go unsupported. We were inspired by the Luna Ring to bridge this gap. What if your body could tell you it's struggling before your mind even registers it? We wanted to build the "Check Engine" light for the human mind, specifically tailored for the high-performance, high-stress environment of elite engineering students.

What it does

MindMirror × Luna is a biometric-aware self-reflection companion. It syncs with the Luna Ring to monitor physiological markers of stress:

  • Heart Rate Variability (HRV): Tracking the autonomic nervous system's recovery.
  • Sleep Architecture: Monitoring deep sleep deficits that lead to emotional dysregulation.
  • Readiness & Stress Scores: Real-time biometrics.

When MindMirror detects a physiological stress arc (e.g., a 7-day decline in HRV), it proactively opens a conversation. Using Cognitive Behavioral Therapy (CBT) frameworks, it helps students identify specific IITD-centric patterns like Impostor Syndrome, Rank Anxiety, or the Comparison Spiral. It doesn't just "chat"—it reflects biometrics back to the user to ground their emotional state in physical reality.

How we built it

We utilized a modern, scalable Turborepo monorepo architecture:

  • Frontend: Next.js 14 with a "Medical-Premium" UI theme. We used framer-motion for smooth, calming transitions and recharts for biometric visualization.
  • Backend: A robust NestJS API serving as the orchestration layer for inference and data processing.
  • AI Engine: Powered by Groq using the Llama-3.3-70b-versatile model. Groq's low-latency inference was critical for making the "mirror" feel instantaneous and alive.
  • Data Layer: We built a biometric contextualizer that translates raw Luna data into natural language context for the LLM.
  • Safety: Implemented strict guardrails and an "Escalation Layer" that triggers a hard-stop and displays campus wellness contacts if crisis language is detected.

$$ \text{Stress Index} \approx \frac{1}{\text{HRV}_{\text{rolling_avg}}} \times \Delta\text{Sleep_Deficit} $$

Challenges we ran into

  • Prompt Injection & Guardrails: Ensuring the AI stays strictly within the "Mirror" persona and doesn't attempt to diagnose or stray into off-topic conversations was a significant engineering feat in prompt design.
  • Windows Environment Hurdles: We faced some initial "path-length" and binary resolution issues with pnpm on Windows (specifically with napi-postinstall), which we resolved by implementing a custom --ignore-scripts and manual rebuild workflow.
  • CORS & Isolation: Managing cross-origin communication between a standalone Next.js frontend and a NestJS API within Docker containers required fine-tuning the security headers to ensure local development matched the production environment.

Accomplishments that we're proud of

  • Groq Integration: Achieving sub-500ms response times for complex CBT-based pattern detection.
  • The "Mirror" Logic: Successfully building a system that can detect Specific cognitive distortions rather than just giving generic advice.
  • UI/UX: Creating a theme that feels professional and calming, moving away from the "cartoonish" look often found in entry-level health apps.

What we learned

We learned that AI in mental health is most effective when it is grounded in biometrics. Purely text-based journals are hard to maintain, but when an app says, "Hey, your HRV dropped 15% today, I notice your body is under stress—want to talk about what's on your mind?", it dramatically lowers the barrier to entry for self-reflection. We also deepened our knowledge of Turborepo management and high-efficiency Docker containerization for full-stack apps.

What's next for MindMirror

  • Real Luna API Integration: Moving from our highly accurate mock data to the live Luna Cloud API.
  • Pattern Over Time: Building a long-term "Mind Map" that shows a student which weeks of the semester (e.g., Minor 1 vs. Major) trigger specific cognitive distortions.
  • Peer Support Loops: A safe, anonymous way for students with similar "Mind Patterns" to realize they aren't alone, fostering a healthier campus culture.

Built With

  • across
  • and-shadcn/ui.-animations-&-visuals:-framer-motion-(for-fluid-ui-transitions)-&-recharts-(for-biometric-data-visualization).-backend:-nestjs-(node.js-framework)-for-robust-api-orchestration-and-dto-validation.-biometrics:-luna-ring-biometric-profiles-(hrv
  • aws/ec2
  • core-architecture:-turborepo-(build-system)-&-pnpm-(workspace-management).-ai-&-inference:-groq-cloud-api-utilizing-meta-llama-3.3-70b-for-ultra-low-latency-cbt-pattern-parsing.-frontend:-next.js-14-(app-router)
  • deployment.
  • entire
  • for
  • interfaces
  • react
  • readiness-data-context).-devops-&-deployment:-docker-&-docker-compose-for-containerized-environments
  • safety:
  • shared
  • sleep
  • tailwind-css
  • the
  • type
  • typescript
Share this project:

Updates