# aalister/typing architecture

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

- Interactive diagram: https://gitdiagram.com/aalister/typing
- Repository: https://github.com/aalister/typing

## Overview

##### Project Type Analysis
This is a frontend-only web application focused on typing practice, built using Svelte and TypeScript. The application appears to be a single-page application (SPA) with client-side functionality.

##### Main Components

Core Application Layer:
- Main Application Container (App.svelte)
- Routing/Entry Point (main.ts)

Feature Components:
- Typing Test Interface (Test.svelte)
- Results Display (Result.svelte)
- Statistics Visualization (Statistics.svelte, CalendarHeatmap.svelte)
- Virtual Keyboard Display (Keyboard.svelte)

Utility/Service Layer:
- Word Management (words.ts, words.txt)
- Score Handling (scores.svelte.ts)
- Date Utilities (date.ts)

UI Components:
- Button Component
- Content Switcher
- Progress Bar
- Theme Picker

**┌─ User Interface Layer ─────────────────────┐**

- ┌─ Core Components ──┐  ┌─ Features ─┐   │
- App Container   │  │ - Test     │   │
- Theme Manager   │  │ - Results  │   │
- ┘  │ - Stats    │   │
- ┘     │

- ┘

##### Specific Elements

Component Relationships:
- How Test.svelte interacts with words.ts for word selection
- How scores.svelte.ts manages and persists typing results
- Demonstrate the relationship between Statistics.svelte and CalendarHeatmap.svelte

State Management:
- Local state management within components
- Data persistence flow to browser storage

UI Component Hierarchy:
- Demonstrate how ThemePicker affects the global application theme
- Relationship between Test.svelte and Keyboard.svelte

##### Technical Details to Highlight

Build/Deploy Flow:
- Vite build process
- GitHub Actions deployment flow to GitHub Pages

Development Tools:
- TypeScript integration
- Svelte compilation process

##### Implementation Notes
- Version information and last updated date
- Adding performance-critical paths

Remember to maintain a balance between showing enough detail to understand the system architecture while avoiding overwhelming complexity that might obscure the main application flow.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "User Interface Layer"
        direction TB
        App["Main Application Container"]
        Entry["Application Entry Point"]
        Theme["Theme Picker"]
    end

    subgraph "Feature Components"
        direction TB
        Test["Typing Test Interface"]
        Result["Results Display"]
        Stats["Statistics View"]
        Calendar["Calendar Heatmap"]
        Keyboard["Virtual Keyboard"]
    end

    subgraph "UI Components"
        direction TB
        Button["Button Component"]
        Content["Content Switcher"]
        Progress["Progress Bar"]
    end

    subgraph "Utility Services"
        direction TB
        Words["Word Management"]
        Scores["Score Handler"]
        Date["Date Utilities"]
        Deploy["GitHub Actions Deploy"]
    end

    App --> Entry
    App --> Theme
    App --> Content
    
    Content --> Test
    Content --> Result
    Content --> Stats
    
    Test --> Words
    Test --> Keyboard
    Test --> Progress
    Test --> Button
    
    Result --> Scores
    Result --> Button
    
    Stats --> Calendar
    Stats --> Scores
    Stats --> Date
    
    Calendar --> Date
    
    classDef core fill:#2374ab,color:#fff,stroke:#000
    classDef feature fill:#48a9a6,color:#fff,stroke:#000
    classDef ui fill:#9c89b8,color:#fff,stroke:#000
    classDef utility fill:#f4845f,color:#fff,stroke:#000
    
    class App,Entry,Theme core
    class Test,Result,Stats,Calendar,Keyboard feature
    class Button,Content,Progress ui
    class Words,Scores,Date,Deploy utility
    
    click App "https://github.com/aalister/typing/blob/main/src/App.svelte"
    click Entry "https://github.com/aalister/typing/blob/main/src/main.ts"
    click Test "https://github.com/aalister/typing/blob/main/src/lib/Test.svelte"
    click Result "https://github.com/aalister/typing/blob/main/src/lib/Result.svelte"
    click Stats "https://github.com/aalister/typing/blob/main/src/lib/Statistics.svelte"
    click Calendar "https://github.com/aalister/typing/blob/main/src/lib/CalendarHeatmap.svelte"
    click Keyboard "https://github.com/aalister/typing/blob/main/src/lib/Keyboard.svelte"
    click Words "https://github.com/aalister/typing/blob/main/src/lib/words.ts"
    click Scores "https://github.com/aalister/typing/blob/main/src/lib/scores.svelte.ts"
    click Date "https://github.com/aalister/typing/blob/main/src/lib/date.ts"
    click Button "https://github.com/aalister/typing/blob/main/src/lib/Button.svelte"
    click Content "https://github.com/aalister/typing/blob/main/src/lib/ContentSwitcher.svelte"
    click Progress "https://github.com/aalister/typing/blob/main/src/lib/ProgressBar.svelte"
    click Theme "https://github.com/aalister/typing/blob/main/src/lib/ThemePicker.svelte"
    click Deploy "https://github.com/aalister/typing/blob/main/.github/workflows/deploy.yml"
```
