# mshazilkhan7/autimate-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/mshazilkhan7/autimate-frontend
- Repository: https://github.com/mshazilkhan7/autimate-frontend

## Overview

#### Purpose and Runtime
Autimate is a Vite-served React/TypeScript single-page application for child speech therapy, social-skills practice, onboarding assessment, progress dashboards, and reports. The browser bootstrap is `src/main.tsx`; application composition and likely route selection begin in `src/App.tsx`. Styling combines global CSS and Tailwind/shadcn UI primitives (`src/index.css`, `src/components/ui/`).

#### Application Shell and Navigation
Pages represent the major product surfaces: authentication, child profile, onboarding, dashboard, therapy, social practice, speech-space gamification, reports, and settings. Shared authenticated and unauthenticated shells establish layout boundaries:
- `src/pages/Auth.tsx`
- `src/components/Layout/AuthLayout.tsx`
- `src/components/Layout/Layout.tsx`
- `src/components/Layout/AppSidebar.tsx`

Control flow is page-driven: the shell/sidebar selects a feature page, which assembles domain components and calls its feature hooks/APIs.

#### Identity and Session Boundary
Authentication and current-user/session state are isolated behind dedicated API modules and hooks rather than embedded in views:
- `src/api/auth.ts`
- `src/api/session.ts`
- `src/hooks/useAuth.ts`
- `src/hooks/useSession.ts`

Type contracts for these flows are centralized in `src/types/auth.ts` and `src/types/session.ts`. The exact backend/provider is not identifiable from the supplied tree; API-facing behavior is abstracted through `src/utils/api.ts`.

#### Onboarding and Child Assessment
Onboarding is a multi-step assessment and profile-capture flow. Question content is static data, while step components render the progression, calculate/display results, and persist through the onboarding boundary:
- `src/pages/Onboarding.tsx`
- `src/components/Onboarding/steps/questionSection.tsx`
- `src/components/Onboarding/steps/result.tsx`
- `src/hooks/useOnboarding.ts`
- `src/api/onboarding.ts`
- `src/data/onboardingQuestions.json`

`src/pages/ChildInfo.tsx` is the adjacent child-information surface. This separates assessment UI/state from backend persistence.

#### Speech Therapy Sessions
The therapy feature presents guided word/phoneme exercises, child recording controls, playback, and feedback. Session orchestration is componentized around an exercise shell and API/session state:
- `src/pages/SpeechTherapy.tsx`
- `src/components/Therapy/exercises/sessionShell.tsx`
- `src/components/Therapy/ChildRecordingPanel.tsx`
- `src/components/Therapy/SpeechFeedback.tsx`
- `src/api/therapy.ts`

Therapy vocabulary/content is local (`src/data/speechTherapyWords.ts`). Speech evaluation integrates through `src/hooks/useSpeechAce.ts`, with external-service response shapes modeled in `src/types/speechace.ts`; this is a material browser-to-speech-analysis boundary.

#### Practice and Gamified Learning
Social-skills practice is task-driven from local content, with pages separating catalog and individual practice:
- `src/pages/SocialSkills.tsx`
- `src/pages/SocialSkillsPractice.tsx`
- `src/components/Social/TaskCard.tsx`
- `src/data/socialTasks.json`
- `src/api/social.ts`

Speech Space is a distinct gamified progression mode with levels, rewards, feedback, and 3D/character presentation:
- `src/pages/SpeechSpace.tsx`
- `src/components/SpeechSpace/LevelSelector.tsx`
- `src/components/SpeechSpace/AICharacter3D.tsx`
- `src/data/speechSpaceLevels.json`
- `src/api/space.ts`

#### Progress, Feedback, and Reporting
Dashboard and report views consume persisted user/session outcomes to expose progress and summaries:
- `src/pages/Dashboard.tsx`
- `src/components/Dashboard/ProgressCircle.tsx`
- `src/pages/Reports.tsx`
- `src/hooks/useReport.tsx`
- `src/api/report.ts`

AI feedback is separately encapsulated in `src/hooks/useAIFeedback.tsx`, allowing therapy/practice views to consume generated feedback without owning its service interaction.

#### Deployment
The frontend is built by Vite and deployable as a static SPA; Vercel configuration exists in `vercel.json`. The README also identifies Lovable as the managed editing/publishing environment. Dependencies are managed via npm (`package.json`, `package-lock.json`), with a Bun lockfile also present.

Main entry points: [`src/components/Layout/AppSidebar.tsx`](https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/components/Layout/AppSidebar.tsx) (Feature navigation), [`src/utils/api.ts`](https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/utils/api.ts) (API transport), [`src/pages/SocialSkillsPractice.tsx`](https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/pages/SocialSkillsPractice.tsx) (Social skills practice), [`src/App.tsx`](https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/App.tsx) (Application composition)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["SPA Runtime"]
  node_vite{{"Vite static build<br/>deployment<br/>[vercel.json]"}}
  node_bootstrap["Browser bootstrap<br/>React entry<br/>[main.tsx]"]
  node_app["Application composition<br/>React app<br/>[App.tsx]"]
  node_shells["Auth and app shells<br/>layout boundary<br/>[Layout.tsx]"]
  node_sidebar["Feature navigation<br/>sidebar<br/>[AppSidebar.tsx]"]
  node_api{{"API transport<br/>API client<br/>[api.ts]"}}
end

subgraph group_identity["Identity"]
  node_auth["Auth and session<br/>identity hooks/API<br/>[useAuth.ts]"]
  node_auth_page["Authentication<br/>page<br/>[Auth.tsx]"]
end

subgraph group_learning["Assessment &amp; Learning"]
  node_onboarding["Onboarding assessment<br/>page and flow<br/>[Onboarding.tsx]"]
  node_onboarding_steps["Assessment steps<br/>step UI"]
  node_onboarding_content["Assessment questions<br/>local content"]
  node_child_info["Child information<br/>page<br/>[ChildInfo.tsx]"]
  node_therapy["Speech therapy<br/>page and session<br/>[SpeechTherapy.tsx]"]
  node_therapy_session["Exercise session shell<br/>therapy UI<br/>[sessionShell.tsx]"]
  node_speech_analysis{{"Speech analysis<br/>external speech hook<br/>[useSpeechAce.ts]"}}
  node_social["Social skills practice<br/>catalog and practice pages"]
  node_social_content["Social tasks<br/>local content<br/>[socialTasks.json]"]
  node_speech_space["Speech Space<br/>gamified learning page<br/>[SpeechSpace.tsx]"]
  node_space_levels["Speech Space levels<br/>local content"]
end

subgraph group_insights["Progress &amp; Reporting"]
  node_dashboard["Dashboard<br/>progress page<br/>[Dashboard.tsx]"]
  node_reports["Reports<br/>report page and hook<br/>[useReport.tsx]"]
  node_ai_feedback["AI feedback<br/>feedback hook<br/>[useAIFeedback.tsx]"]
end

node_vite -->|"serves build"| node_bootstrap
node_bootstrap -->|"mounts"| node_app
node_app -->|"composes"| node_shells
node_app -->|"shows when signed out"| node_auth_page
node_shells -->|"contains"| node_sidebar
node_sidebar -->|"navigates"| node_onboarding
node_sidebar -->|"navigates"| node_therapy
node_sidebar -->|"navigates"| node_social
node_sidebar -->|"navigates"| node_speech_space
node_sidebar -->|"navigates"| node_dashboard
node_sidebar -->|"navigates"| node_reports
node_auth_page -->|"uses"| node_auth
node_shells -->|"guards session"| node_auth
node_auth -->|"calls"| node_api
node_onboarding -->|"renders"| node_onboarding_steps
node_onboarding_steps -->|"loads"| node_onboarding_content
node_onboarding -->|"persists assessment"| node_api
node_child_info -->|"persists profile"| node_api
node_therapy -->|"renders"| node_therapy_session
node_therapy_session -->|"evaluates recording"| node_speech_analysis
node_therapy -->|"stores outcomes"| node_api
node_therapy_session -->|"requests feedback"| node_ai_feedback
node_social -->|"loads tasks"| node_social_content
node_social -->|"stores practice"| node_api
node_social -->|"requests feedback"| node_ai_feedback
node_speech_space -->|"loads levels"| node_space_levels
node_speech_space -->|"stores progression"| node_api
node_dashboard -->|"loads progress"| node_api
node_reports -->|"loads summaries"| node_api

click node_vite "https://github.com/mshazilkhan7/autimate-frontend/blob/main/vercel.json"
click node_bootstrap "https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/main.tsx"
click node_app "https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/App.tsx"
click node_shells "https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/components/Layout/Layout.tsx"
click node_sidebar "https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/components/Layout/AppSidebar.tsx"
click node_api "https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/utils/api.ts"
click node_auth "https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/hooks/useAuth.ts"
click node_auth_page "https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/pages/Auth.tsx"
click node_onboarding "https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/pages/Onboarding.tsx"
click node_onboarding_steps "https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/components/Onboarding/steps/questionSection.tsx"
click node_onboarding_content "https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/data/onboardingQuestions.json"
click node_child_info "https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/pages/ChildInfo.tsx"
click node_therapy "https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/pages/SpeechTherapy.tsx"
click node_therapy_session "https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/components/Therapy/exercises/sessionShell.tsx"
click node_speech_analysis "https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/hooks/useSpeechAce.ts"
click node_social "https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/pages/SocialSkillsPractice.tsx"
click node_social_content "https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/data/socialTasks.json"
click node_speech_space "https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/pages/SpeechSpace.tsx"
click node_space_levels "https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/data/speechSpaceLevels.json"
click node_dashboard "https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/pages/Dashboard.tsx"
click node_reports "https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/hooks/useReport.tsx"
click node_ai_feedback "https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/hooks/useAIFeedback.tsx"

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_vite,node_bootstrap,node_app,node_shells,node_sidebar,node_api toneBlue
class node_auth,node_auth_page toneAmber
class node_onboarding,node_onboarding_steps,node_onboarding_content,node_child_info,node_therapy,node_therapy_session,node_speech_analysis,node_social,node_social_content,node_speech_space,node_space_levels toneMint
class node_dashboard,node_reports,node_ai_feedback toneRose
```

## Components

### SPA Runtime

- [Vite static build](https://github.com/mshazilkhan7/autimate-frontend/blob/main/vercel.json): deployment · Builds and serves the static SPA. · `vercel.json`
- [Browser bootstrap](https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/main.tsx): React entry · `src/main.tsx`
- [Application composition](https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/App.tsx): React app · Composes the SPA and selects product surfaces. · `src/App.tsx`
- [Auth and app shells](https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/components/Layout/Layout.tsx): layout boundary · Separates unauthenticated and authenticated layouts. · `src/components/Layout/Layout.tsx`
- [Feature navigation](https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/components/Layout/AppSidebar.tsx): sidebar · `src/components/Layout/AppSidebar.tsx`
- [API transport](https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/utils/api.ts): API client · Shared abstraction for backend-facing behavior. · `src/utils/api.ts`

### Identity

- [Auth and session](https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/hooks/useAuth.ts): identity hooks/API · Owns authentication and current-session state. · `src/hooks/useAuth.ts`
- [Authentication](https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/pages/Auth.tsx): page · `src/pages/Auth.tsx`

### Assessment & Learning

- [Onboarding assessment](https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/pages/Onboarding.tsx): page and flow · Multi-step assessment and profile capture. · `src/pages/Onboarding.tsx`
- [Assessment steps](https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/components/Onboarding/steps/questionSection.tsx): step UI · Renders questions and assessment results. · `src/components/Onboarding/steps/questionSection.tsx`
- [Assessment questions](https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/data/onboardingQuestions.json): local content · `src/data/onboardingQuestions.json`
- [Child information](https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/pages/ChildInfo.tsx): page · `src/pages/ChildInfo.tsx`
- [Speech therapy](https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/pages/SpeechTherapy.tsx): page and session · Guided phoneme and word exercise sessions. · `src/pages/SpeechTherapy.tsx`
- [Exercise session shell](https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/components/Therapy/exercises/sessionShell.tsx): therapy UI · Orchestrates exercises, recording, playback, and feedback. · `src/components/Therapy/exercises/sessionShell.tsx`
- [Speech analysis](https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/hooks/useSpeechAce.ts): external speech hook · Browser boundary for speech evaluation. · `src/hooks/useSpeechAce.ts`
- [Social skills practice](https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/pages/SocialSkillsPractice.tsx): catalog and practice pages · Task-driven social-skills activities. · `src/pages/SocialSkillsPractice.tsx`
- [Social tasks](https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/data/socialTasks.json): local content · `src/data/socialTasks.json`
- [Speech Space](https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/pages/SpeechSpace.tsx): gamified learning page · Levels, rewards, feedback, and character presentation. · `src/pages/SpeechSpace.tsx`
- [Speech Space levels](https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/data/speechSpaceLevels.json): local content · `src/data/speechSpaceLevels.json`

### Progress & Reporting

- [Dashboard](https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/pages/Dashboard.tsx): progress page · `src/pages/Dashboard.tsx`
- [Reports](https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/hooks/useReport.tsx): report page and hook · Builds persisted progress summaries. · `src/hooks/useReport.tsx`
- [AI feedback](https://github.com/mshazilkhan7/autimate-frontend/blob/main/src/hooks/useAIFeedback.tsx): feedback hook · Encapsulates generated-feedback service interaction. · `src/hooks/useAIFeedback.tsx`

## Connections

- Vite static build → Browser bootstrap: serves build
- Browser bootstrap → Application composition: mounts
- Application composition → Auth and app shells: composes
- Application composition → Authentication: shows when signed out
- Auth and app shells → Feature navigation: contains
- Feature navigation → Onboarding assessment: navigates
- Feature navigation → Speech therapy: navigates
- Feature navigation → Social skills practice: navigates
- Feature navigation → Speech Space: navigates
- Feature navigation → Dashboard: navigates
- Feature navigation → Reports: navigates
- Authentication → Auth and session: uses
- Auth and app shells → Auth and session: guards session
- Auth and session → API transport: calls
- Onboarding assessment → Assessment steps: renders
- Assessment steps → Assessment questions: loads
- Onboarding assessment → API transport: persists assessment
- Child information → API transport: persists profile
- Speech therapy → Exercise session shell: renders
- Exercise session shell → Speech analysis: evaluates recording
- Speech therapy → API transport: stores outcomes
- Exercise session shell → AI feedback: requests feedback
- Social skills practice → Social tasks: loads tasks
- Social skills practice → API transport: stores practice
- Social skills practice → AI feedback: requests feedback
- Speech Space → Speech Space levels: loads levels
- Speech Space → API transport: stores progression
- Dashboard → API transport: loads progress
- Reports → API transport: loads summaries
