# aryanshravan/aroha architecture

> Architecture diagram of the GitHub repository aryanshravan/aroha, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aryanshravan/aroha
- Repository: https://github.com/aryanshravan/aroha

## Overview

AROHA is a parent-and-adolescent mental-health support platform. Parents sign in, explore learning and practice tools, or describe observed changes to receive a non-diagnostic Situation Guide; adolescents can submit a message and control what is shared with a parent. The React application routes these experiences to an Express API and user-isolated persistence, with AI services supporting observation guidance and privacy-aware bridge reports. The README documents simulator feedback, progress tracking, and resilient AI providers. Some UI and API internals were not sampled, so documented feature relationships use README evidence.

Main entry points: [`aroha-app/src/App.jsx`](https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/App.jsx) (Route and guard), [`aroha-app/server/index.js`](https://github.com/aryanshravan/aroha/blob/main/aroha-app/server/index.js) (Express API), [`aroha-app/server/services/aiService.js`](https://github.com/aryanshravan/aroha/blob/main/aroha-app/server/services/aiService.js) (AI response service), [`aroha-app/src/utils/reportStorage.js`](https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/utils/reportStorage.js) (Report storage client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_router["Route and guard<br/>[App.jsx]"]
  node_auth["Authentication state<br/>[AuthContext.jsx]"]
  node_dashboard["Dashboard shell"]
end

subgraph group_learning["Learning and practice"]
  node_learning_home["Learning library"]
  node_lesson["Interactive lessons<br/>[LessonPage.jsx]"]
  node_lesson_content["Five topic content<br/>[topic1.js]"]
  node_lesson_state[("Lesson progress<br/>[lessonStorage.js]")]
  node_simulator["Conversation simulator"]
  node_scenarios["Roleplay scenarios"]
  node_progress["Progress dashboard<br/>[Progress.jsx]"]
end

subgraph group_observation["Observation guidance"]
  node_observation["Observation conversation<br/>[WhatImSeeing.jsx]"]
  node_history_client["Session history client"]
end

subgraph group_bridge["Parent-child bridge"]
  node_child_message["Child message and sharing<br/>[ChildMessage.jsx]"]
  node_report_client["Report storage client<br/>[reportStorage.js]"]
  node_bridge_ai["Privacy-aware report AI"]
  node_reports["Parent reports<br/>[ParentReports.jsx]"]
  node_report_detail["Report detail<br/>[ReportDetail.jsx]"]
end

subgraph group_backend["API and services"]
  node_ai["AI response service<br/>[aiService.js]"]
  node_prompt["Safety instructions"]
  node_groq{{"Groq inference"}}
  node_gemini{{"Gemini fallback"}}
  node_api["Express API<br/>[index.js]"]
  node_store[("User data store<br/>[firebaseService.js]")]
end

node_parent(("Parent / guardian"))
node_teen(("Adolescent"))

node_parent -->|"opens app"| node_router
node_teen -->|"opens app"| node_router
node_router -->|"checks access"| node_auth
node_router -->|"routes pages"| node_dashboard
node_router -->|"routes to"| node_learning_home
node_router -->|"routes to"| node_observation
node_router -->|"routes to"| node_simulator
node_router -->|"routes to"| node_child_message
node_learning_home -->|"opens lessons"| node_lesson
node_lesson -->|"presents topics"| node_lesson_content
node_lesson -->|"records progress"| node_lesson_state
node_simulator -->|"loads scenarios"| node_scenarios
node_simulator -.->|"tracks practice"| node_progress
node_lesson_state -->|"supplies completion"| node_progress
node_observation -->|"saves sessions"| node_history_client
node_observation -.->|"requests guidance"| node_api
node_history_client -->|"syncs sessions"| node_api
node_api -->|"requests response"| node_ai
node_ai -->|"uses instructions"| node_prompt
node_ai -->|"calls primary"| node_groq
node_ai -.->|"falls back"| node_gemini
node_api -->|"reads and writes"| node_store
node_child_message -->|"processes sharing"| node_report_client
node_report_client -->|"submits messages"| node_api
node_api -.->|"delegates reports"| node_bridge_ai
node_bridge_ai -->|"uses AI response"| node_ai
node_report_client -.->|"persists reports"| node_store
node_reports -->|"loads reports"| node_report_client
node_report_detail -->|"loads report"| node_report_client

click node_router "https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/App.jsx"
click node_auth "https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/context/AuthContext.jsx"
click node_dashboard "https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/layouts/DashboardLayout.jsx"
click node_learning_home "https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/pages/EducateYourself.jsx"
click node_lesson "https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/pages/lessons/LessonPage.jsx"
click node_lesson_content "https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/data/topic1.js"
click node_lesson_state "https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/utils/lessonStorage.js"
click node_simulator "https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/pages/TrainingSimulator.jsx"
click node_scenarios "https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/data/simulatorQuestions.js"
click node_progress "https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/pages/Progress.jsx"
click node_observation "https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/pages/WhatImSeeing.jsx"
click node_history_client "https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/services/sessionHistoryService.js"
click node_ai "https://github.com/aryanshravan/aroha/blob/main/aroha-app/server/services/aiService.js"
click node_prompt "https://github.com/aryanshravan/aroha/blob/main/aroha-app/server/prompts/arohaSystemPrompt.js"
click node_api "https://github.com/aryanshravan/aroha/blob/main/aroha-app/server/index.js"
click node_store "https://github.com/aryanshravan/aroha/blob/main/aroha-app/server/services/firebaseService.js"
click node_child_message "https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/pages/parentchild/ChildMessage.jsx"
click node_report_client "https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/utils/reportStorage.js"
click node_bridge_ai "https://github.com/aryanshravan/aroha/blob/main/aroha-app/server/services/parentChildAiService.js"
click node_reports "https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/pages/parentchild/ParentReports.jsx"
click node_report_detail "https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/pages/parentchild/ReportDetail.jsx"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_router,node_auth,node_dashboard toneBlue
class node_learning_home,node_lesson,node_lesson_content,node_lesson_state,node_simulator,node_scenarios,node_progress toneAmber
class node_observation,node_history_client toneMint
class node_child_message,node_report_client,node_bridge_ai,node_reports,node_report_detail toneRose
class node_ai,node_prompt,node_groq,node_gemini,node_api,node_store,node_parent,node_teen toneIndigo
```

## Components

### User experience

- [Route and guard](https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/App.jsx): `aroha-app/src/App.jsx`
- [Authentication state](https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/context/AuthContext.jsx): `aroha-app/src/context/AuthContext.jsx`
- [Dashboard shell](https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/layouts/DashboardLayout.jsx): `aroha-app/src/layouts/DashboardLayout.jsx`

### Learning and practice

- [Learning library](https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/pages/EducateYourself.jsx): `aroha-app/src/pages/EducateYourself.jsx`
- [Interactive lessons](https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/pages/lessons/LessonPage.jsx): `aroha-app/src/pages/lessons/LessonPage.jsx`
- [Five topic content](https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/data/topic1.js): `aroha-app/src/data/topic1.js`
- [Lesson progress](https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/utils/lessonStorage.js): `aroha-app/src/utils/lessonStorage.js`
- [Conversation simulator](https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/pages/TrainingSimulator.jsx): `aroha-app/src/pages/TrainingSimulator.jsx`
- [Roleplay scenarios](https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/data/simulatorQuestions.js): `aroha-app/src/data/simulatorQuestions.js`
- [Progress dashboard](https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/pages/Progress.jsx): `aroha-app/src/pages/Progress.jsx`

### Observation guidance

- [Observation conversation](https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/pages/WhatImSeeing.jsx): `aroha-app/src/pages/WhatImSeeing.jsx`
- [Session history client](https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/services/sessionHistoryService.js): `aroha-app/src/services/sessionHistoryService.js`

### Parent-child bridge

- [Child message and sharing](https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/pages/parentchild/ChildMessage.jsx): `aroha-app/src/pages/parentchild/ChildMessage.jsx`
- [Report storage client](https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/utils/reportStorage.js): `aroha-app/src/utils/reportStorage.js`
- [Privacy-aware report AI](https://github.com/aryanshravan/aroha/blob/main/aroha-app/server/services/parentChildAiService.js): `aroha-app/server/services/parentChildAiService.js`
- [Parent reports](https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/pages/parentchild/ParentReports.jsx): `aroha-app/src/pages/parentchild/ParentReports.jsx`
- [Report detail](https://github.com/aryanshravan/aroha/blob/main/aroha-app/src/pages/parentchild/ReportDetail.jsx): `aroha-app/src/pages/parentchild/ReportDetail.jsx`

### API and services

- [AI response service](https://github.com/aryanshravan/aroha/blob/main/aroha-app/server/services/aiService.js): `aroha-app/server/services/aiService.js`
- [Safety instructions](https://github.com/aryanshravan/aroha/blob/main/aroha-app/server/prompts/arohaSystemPrompt.js): `aroha-app/server/prompts/arohaSystemPrompt.js`
- **Groq inference**
- **Gemini fallback**
- [Express API](https://github.com/aryanshravan/aroha/blob/main/aroha-app/server/index.js): `aroha-app/server/index.js`
- [User data store](https://github.com/aryanshravan/aroha/blob/main/aroha-app/server/services/firebaseService.js): `aroha-app/server/services/firebaseService.js`

### Other components

- **Parent / guardian**
- **Adolescent**

## Connections

- Parent / guardian → Route and guard: opens app (evidence: `README.md`)
- Adolescent → Route and guard: opens app (evidence: `README.md`)
- Route and guard → Authentication state: checks access (evidence: `aroha-app/src/App.jsx`)
- Route and guard → Dashboard shell: routes pages (evidence: `aroha-app/src/App.jsx`)
- Route and guard → Learning library: routes to (evidence: `aroha-app/src/App.jsx`)
- Route and guard → Observation conversation: routes to (evidence: `aroha-app/src/App.jsx`)
- Route and guard → Conversation simulator: routes to (evidence: `aroha-app/src/App.jsx`)
- Route and guard → Child message and sharing: routes to (evidence: `aroha-app/src/App.jsx`)
- Learning library → Interactive lessons: opens lessons (evidence: `README.md`)
- Interactive lessons → Five topic content: presents topics
- Interactive lessons → Lesson progress: records progress (evidence: `aroha-app/src/pages/lessons/LessonPage.jsx`)
- Conversation simulator → Roleplay scenarios: loads scenarios (evidence: `aroha-app/src/pages/TrainingSimulator.jsx`)
- Conversation simulator → Progress dashboard: tracks practice (evidence: `README.md`)
- Lesson progress → Progress dashboard: supplies completion (evidence: `aroha-app/src/pages/Progress.jsx`)
- Observation conversation → Session history client: saves sessions (evidence: `aroha-app/src/pages/WhatImSeeing.jsx`)
- Observation conversation → Express API: requests guidance (evidence: `README.md`)
- Session history client → Express API: syncs sessions (evidence: `aroha-app/src/services/sessionHistoryService.js`)
- Express API → AI response service: requests response (evidence: `aroha-app/server/index.js`)
- AI response service → Safety instructions: uses instructions (evidence: `aroha-app/server/services/aiService.js`)
- AI response service → Groq inference: calls primary (evidence: `README.md`)
- AI response service → Gemini fallback: falls back (evidence: `README.md`)
- Express API → User data store: reads and writes (evidence: `aroha-app/server/index.js`)
- Child message and sharing → Report storage client: processes sharing (evidence: `aroha-app/src/pages/parentchild/ChildMessage.jsx`)
- Report storage client → Express API: submits messages (evidence: `aroha-app/src/utils/reportStorage.js`)
- Express API → Privacy-aware report AI: delegates reports (evidence: `aroha-app/server/index.js`)
- Privacy-aware report AI → AI response service: uses AI response (evidence: `aroha-app/server/services/parentChildAiService.js`)
- Report storage client → User data store: persists reports (evidence: `README.md`)
- Parent reports → Report storage client: loads reports (evidence: `aroha-app/src/pages/parentchild/ParentReports.jsx`)
- Report detail → Report storage client: loads report (evidence: `aroha-app/src/pages/parentchild/ReportDetail.jsx`)
