Nytra - Devpost Submission (Track 2: Neuroscience & Mental Health)
Inspiration
Sleep is the foundational pillar of mental health, yet it is often the first casualty of burnout, anxiety, and depression. When examining the track's core problems—a severe shortage of therapists, the stigma of seeking help, and gatekept quality care—we realized that millions suffer from deteriorating mental wellness without understanding the underlying physiological causes.
Therapy is expensive and geographically bound, but our smartphones are always with us. We built Nytra to democratize mental health literacy and burnout prevention by starting where the day ends: sleep. We wanted to create an accessible, evidence-based tool that acts as a first line of defense, recognizing when users need cognitive wind-down support and when it’s time to escalate their data to a human professional.
What it does
Nytra is a holistic, AI-powered sleep and mental wellness ecosystem. It transforms the user's phone into a Command Center for cognitive health:
- Motion-Based Sleep Tracking: Passively monitors nightly rest to map out sleep and awake phases.
- AI Sleep Coach (Nytra Chat): Provides personalized, evidence-based therapeutic support and sleep hygiene literacy without the stigma of traditional therapy.
- The Sleep Lab: Modular, CBT-inspired cognitive exercises (Word Shuffler, Category Cascade, Breath-Sync Circle) designed to interrupt anxious rumination and facilitate sleep onset.
- Peer Support Community: A feed where users can share progress and streaks, fostering accountability and reducing isolation.
- Clinical Handoff: Generates highly detailed, locally rendered PDF reports.
Addressing the Ethical Question: What can AI therapy do, and what can it absolutely not replace? Nytra’s AI excels at pattern recognition, emotional triage, and delivering immediate cognitive behavioral frameworks (like the Word Shuffler) at 3 AM when human therapists are asleep. However, it cannot replace the nuanced empathy of a human professional or diagnose clinical disorders. To bridge this, Nytra generates detailed PDF clinical reports, empowering users to advocate for themselves when they finally step into a doctor's office.
How we built it
We engineered Nytra to be heavily optimized for both speed and user experience.
- Frontend: Built with Next.js 14 (App Router), React, and Tailwind CSS. We implemented a highly modular "Command Center" dashboard architecture to ensure progressive disclosure of features.
- Backend & Data: Powered by Supabase for secure session storage, user profiles, and the community feed.
- AI & Intelligence: We integrated the Anthropic API to power both the conversational Nytra Chat and the
AIInsightsCard, which derives plain-English wellness summaries from complex sleep arrays. - Analytics Engine: Custom heuristics were written in TypeScript to parse raw motion data into a realistic sleep timeline visualization. Our baseline penalty formula for sleep scoring utilizes a differential decay model: $$ S_{total} = \max \left( 0, 100 \cdot \left( \frac{D_{actual}}{D_{target}} \right) - \lambda \sum_{i=1}^{k} \ln(1 + M_i) \right) $$ Where \( D \) represents duration, \( M_i \) represents the magnitude of the \( i \)-th motion interruption, and \( \lambda \) is the variance weight.
Challenges we ran into
- Heuristic Timelines: Transforming raw threshold data into visually realistic sleep graphs required extensive tweaking to prevent the UI from looking like a barcode. We had to implement smoothing functions to ensure "awake" blips accurately reflected physiological reality.
- Client-Side PDF Generation: We wanted reports to generate instantly without sending sensitive health logs to a third-party server. Implementing
html2canvasandjsPDFrequired complex React state management to forcefully inject a temporary light-mode CSS class (.pdf-mode) right before capture, ensuring the PDF exported on a clean white background. - Z-Index and Layout Management: Integrating a persistent but unobtrusive AI chat block alongside standard bottom navigation components caused initial viewport clipping on mobile devices.
Accomplishments that we're proud of
- We successfully decoupled the stigma of mental wellness by framing it around a universally accepted metric: improving sleep.
- The Sleep Lab modules are incredibly fluid and genuinely relaxing, acting as perfect digital interventions for rumination.
- We built a complete, production-ready full-stack application with a heavily polished, icon-driven UI within the hackathon timeframe.
What we learned
We learned a tremendous amount about the intersection of behavioral science and UI/UX design. By restructuring the app's Information Architecture late in the process to prioritize native "Insights" and "Wellness" tabs, we learned that how a user discovers a mental health tool is just as important as the tool itself. We also discovered the profound utility of LLMs in parsing numerical JSON arrays into empathetic, actionable user advice.
What's next for Nytra
- Wearable Integration: Syncing with Apple HealthKit and Google Fit for heart-rate variability (HRV) continuous tracking.
- Longitudinal Burnout Modeling: Expanding the AI to detect early warning signs of chronic depression or burnout across weekly metadata.
- Therapist Dashboard: Creating a dedicated portal where users can explicitly auto-route their encrypted weekly PDF reports to a licensed human practitioner.
Built with
next.jsreacttypescripttailwind-csssupabaseanthropic-apilucide-reacthtml2canvasjspdf
Built With
- html2canvas
- jspdf
- next.js
- python
- react
- tailwind
- typescript
Log in or sign up for Devpost to join the conversation.