# ali09154000/spark-and-chat-studio architecture

> Architecture diagram of the GitHub repository ali09154000/spark-and-chat-studio, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ali09154000/spark-and-chat-studio
- Repository: https://github.com/ali09154000/spark-and-chat-studio

## Overview

SpeakWell is an English-speaking practice app with sign-in, a protected dashboard, voice/conversation practice, transcription, and speaking assessments. The visible workflow runs from authentication into the dashboard, then branches into practice services and assessment reporting; the live-voice relay is a separate server-side capability. Supabase provides authentication and the application’s practice data model. Some routes and service implementations were not excerpted, so their internal links are omitted rather than inferred.

Main entry points: [`src/integrations/supabase/client.ts`](https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/integrations/supabase/client.ts) (Supabase client), [`src/lib/practice-ai.server.ts`](https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/lib/practice-ai.server.ts) (Practice AI service), [`src/routes/auth.tsx`](https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/routes/auth.tsx) (Sign-in), [`src/routes/index.tsx`](https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/routes/index.tsx) (Home page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App entry and identity"]
  node_home["Home page<br/>[index.tsx]"]
  node_auth["Sign-in<br/>[auth.tsx]"]
  node_authgate["Authenticated gate<br/>[route.tsx]"]
  node_dashboard["Dashboard route<br/>[dashboard.tsx]"]
end

subgraph group_practice["Practice experience"]
  node_shell["App shell<br/>[app-shell.tsx]"]
  node_voiceui["Live voice hook<br/>[use-live-voice.ts]"]
  node_conversation["Conversation UI<br/>[conversation.tsx]"]
  node_prompt["Prompt input<br/>[prompt-input.tsx]"]
  node_report["Assessment report"]
end

subgraph group_services["Practice services"]
  node_functions["Practice functions"]
  node_transcribe["Transcription route"]
  node_assessroute["Assessment route<br/>[practice.assess.ts]"]
  node_practiceai["Practice AI service"]
  node_assessment["Assessment parsing"]
  node_chatroute["Chat route<br/>[chat.ts]"]
  node_chatserver["Chat service<br/>[chat.server.ts]"]
  node_liverelay["Live voice relay"]
end

subgraph group_platform["Backend and integrations"]
  node_supabaseclient["Supabase client<br/>[client.ts]"]
  node_previewstorage["Preview auth storage"]
  node_authmiddleware["Auth middleware<br/>[auth-middleware.ts]"]
  node_database[("Supabase data store<br/>[types.ts]")]
end

node_learner(("Learner"))
node_gateway["AI gateway"]

node_learner -->|"visits"| node_home
node_home -->|"checks session"| node_supabaseclient
node_home -->|"opens sign-in"| node_auth
node_learner -->|"signs in"| node_auth
node_auth -->|"authenticates"| node_supabaseclient
node_authgate -->|"checks user"| node_supabaseclient
node_authgate -->|"redirects unauthenticated"| node_auth
node_dashboard -->|"renders"| node_shell
node_dashboard -->|"calls"| node_functions
node_shell -->|"uses"| node_supabaseclient
node_transcribe -->|"delegates to"| node_practiceai
node_assessroute -->|"delegates to"| node_practiceai
node_practiceai -->|"parses assessment"| node_assessment
node_functions -->|"uses"| node_assessment
node_functions -->|"uses"| node_authmiddleware
node_report -->|"uses"| node_assessment
node_supabaseclient -->|"configures"| node_previewstorage
node_practiceai -->|"transcribes audio"| node_gateway
node_liverelay -->|"streams live session"| node_gateway
node_supabaseclient -->|"uses schema types"| node_database

click node_home "https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/routes/index.tsx"
click node_auth "https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/routes/auth.tsx"
click node_authgate "https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/routes/_authenticated/route.tsx"
click node_dashboard "https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/routes/_authenticated/dashboard.tsx"
click node_shell "https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/components/speakwell/app-shell.tsx"
click node_voiceui "https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/hooks/use-live-voice.ts"
click node_conversation "https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/components/ai-elements/conversation.tsx"
click node_prompt "https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/components/ai-elements/prompt-input.tsx"
click node_report "https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/components/speakwell/assessment-report.tsx"
click node_functions "https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/lib/speakwell.functions.ts"
click node_transcribe "https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/routes/api/practice.transcribe.ts"
click node_assessroute "https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/routes/api/practice.assess.ts"
click node_practiceai "https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/lib/practice-ai.server.ts"
click node_assessment "https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/lib/practice-assessment.ts"
click node_chatroute "https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/routes/api/chat.ts"
click node_chatserver "https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/lib/chat.server.ts"
click node_liverelay "https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/lib/live-relay.server.ts"
click node_supabaseclient "https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/integrations/supabase/client.ts"
click node_previewstorage "https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/integrations/supabase/previewAuthStorage.ts"
click node_authmiddleware "https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/integrations/supabase/auth-middleware.ts"
click node_database "https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/integrations/supabase/types.ts"

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_home,node_auth,node_authgate,node_dashboard toneBlue
class node_shell,node_voiceui,node_conversation,node_prompt,node_report toneAmber
class node_functions,node_transcribe,node_assessroute,node_practiceai,node_assessment,node_chatroute,node_chatserver,node_liverelay toneMint
class node_supabaseclient,node_previewstorage,node_authmiddleware,node_database toneRose
class node_learner,node_gateway toneIndigo
```

## Components

### App entry and identity

- [Home page](https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/routes/index.tsx): `src/routes/index.tsx`
- [Sign-in](https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/routes/auth.tsx): `src/routes/auth.tsx`
- [Authenticated gate](https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/routes/_authenticated/route.tsx): `src/routes/_authenticated/route.tsx`
- [Dashboard route](https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/routes/_authenticated/dashboard.tsx): `src/routes/_authenticated/dashboard.tsx`

### Practice experience

- [App shell](https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/components/speakwell/app-shell.tsx): `src/components/speakwell/app-shell.tsx`
- [Live voice hook](https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/hooks/use-live-voice.ts): `src/hooks/use-live-voice.ts`
- [Conversation UI](https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/components/ai-elements/conversation.tsx): `src/components/ai-elements/conversation.tsx`
- [Prompt input](https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/components/ai-elements/prompt-input.tsx): `src/components/ai-elements/prompt-input.tsx`
- [Assessment report](https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/components/speakwell/assessment-report.tsx): `src/components/speakwell/assessment-report.tsx`

### Practice services

- [Practice functions](https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/lib/speakwell.functions.ts): `src/lib/speakwell.functions.ts`
- [Transcription route](https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/routes/api/practice.transcribe.ts): `src/routes/api/practice.transcribe.ts`
- [Assessment route](https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/routes/api/practice.assess.ts): `src/routes/api/practice.assess.ts`
- [Practice AI service](https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/lib/practice-ai.server.ts): `src/lib/practice-ai.server.ts`
- [Assessment parsing](https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/lib/practice-assessment.ts): `src/lib/practice-assessment.ts`
- [Chat route](https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/routes/api/chat.ts): `src/routes/api/chat.ts`
- [Chat service](https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/lib/chat.server.ts): `src/lib/chat.server.ts`
- [Live voice relay](https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/lib/live-relay.server.ts): `src/lib/live-relay.server.ts`

### Backend and integrations

- [Supabase client](https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/integrations/supabase/client.ts): `src/integrations/supabase/client.ts`
- [Preview auth storage](https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/integrations/supabase/previewAuthStorage.ts): `src/integrations/supabase/previewAuthStorage.ts`
- [Auth middleware](https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/integrations/supabase/auth-middleware.ts): `src/integrations/supabase/auth-middleware.ts`
- [Supabase data store](https://github.com/ali09154000/spark-and-chat-studio/blob/main/src/integrations/supabase/types.ts): `src/integrations/supabase/types.ts`

### Other components

- **Learner**
- **AI gateway**

## Connections

- Learner → Home page: visits (evidence: `src/routes/index.tsx`)
- Home page → Supabase client: checks session (evidence: `src/routes/index.tsx`)
- Home page → Sign-in: opens sign-in (evidence: `src/routes/index.tsx`)
- Learner → Sign-in: signs in (evidence: `src/routes/auth.tsx`)
- Sign-in → Supabase client: authenticates (evidence: `src/routes/auth.tsx`)
- Authenticated gate → Supabase client: checks user (evidence: `src/routes/_authenticated/route.tsx`)
- Authenticated gate → Sign-in: redirects unauthenticated (evidence: `src/routes/_authenticated/route.tsx`)
- Dashboard route → App shell: renders (evidence: `src/routes/_authenticated/dashboard.tsx`)
- Dashboard route → Practice functions: calls (evidence: `src/routes/_authenticated/dashboard.tsx`)
- App shell → Supabase client: uses (evidence: `src/components/speakwell/app-shell.tsx`)
- Transcription route → Practice AI service: delegates to (evidence: `src/routes/api/practice.transcribe.ts`)
- Assessment route → Practice AI service: delegates to (evidence: `src/routes/api/practice.assess.ts`)
- Practice AI service → Assessment parsing: parses assessment (evidence: `src/lib/practice-ai.server.ts`)
- Practice functions → Assessment parsing: uses (evidence: `src/lib/speakwell.functions.ts`)
- Practice functions → Auth middleware: uses (evidence: `src/lib/speakwell.functions.ts`)
- Assessment report → Assessment parsing: uses (evidence: `src/components/speakwell/assessment-report.tsx`)
- Supabase client → Preview auth storage: configures (evidence: `src/integrations/supabase/client.ts`)
- Practice AI service → AI gateway: transcribes audio (evidence: `src/lib/practice-ai.server.ts`)
- Live voice relay → AI gateway: streams live session (evidence: `src/lib/live-relay.server.ts`)
- Supabase client → Supabase data store: uses schema types (evidence: `src/integrations/supabase/client.ts`)
