# roberto8695/captcha-accesible architecture

> Architecture diagram of the GitHub repository roberto8695/captcha-accesible, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/roberto8695/captcha-accesible
- Repository: https://github.com/roberto8695/captcha-accesible

## Overview

##### Project type and purpose
- This is a Next.js (v13+) React application focused on building an accessible CAPTCHA system with advanced audio/voice features.
- The README confirms it was bootstrapped with create-next-app and runs purely as a Next.js front-end (no separate “backend” folder or API routes).
- The many Markdown files (e.g., VOICE_IMPROVEMENTS.md, SOLUCION_GOOGLE_VOICE.md) and custom hooks (useSpeech*, useAccessibility) indicate the core feature: generating and playing CAPTCHAs via the Web Speech API and/or Google TTS, with a fallback for local voices.

##### File structure
- `src/app/` → Next.js App Router:
- `page.tsx` (home)
- `captchasordos/page.tsx` (the accessible CAPTCHA route)
- `layout.tsx`, `globals.css`
- `src/components/` → UI components responsible for:
- Rendering the visual CAPTCHA (`CaptchaComponent.tsx`)
- Rendering and switching to an accessible version (`AccessibleCaptchaComponent.tsx`)
- A selection modal (`CaptchaSelectionModal.tsx`)
- Hover tests and sound feedback modules (`HoverTestComponent.tsx`, `SoundFeedback*.tsx`)
- `src/hooks/` → Business-logic hooks abstracting speech and accessibility:
- `useAccessibility.ts`
- Multiple speech hooks: `useSpeech.ts`, `useSpeechGoogleOptimized.ts`, `useSpeechSimple.ts`, etc.
- Other top-level files: Next.js configs (`next.config.ts`, `postcss.config.mjs`), linting, package.json, and a `public/` folder for static assets.

##### README for additional insights
- Confirms use of Next.js, fonts optimization via `next/font`.
- No mention of custom API routes or external servers—implies speech integration occurs client-side via browser APIs or direct calls to external TTS services.

##### Essential details to capture
- File-system routing under `src/app` and how it translates to endpoints.
- Distinction between SSR-rendered pages and client‐only logic in hooks.
- The dual-path audio generation (browser’s Web Speech API vs. Google TTS).
- How static assets (public folder, optimized fonts) fit into the serving pipeline.

## Diagram (Mermaid)

```mermaid
flowchart TB
    B["Client Browser"]:::client
    N["Next.js Server (SSR/SSG)"]:::infra
    B -->|"HTTP Request"| N

    subgraph "App Router (src/app)"
        L["layout.tsx"]:::pages
        G["globals.css"]:::pages
        Home["Home Page\npage.tsx"]:::pages
        Captchas["/captchasordos Page\npage.tsx"]:::pages
    end

    N -->|"Serve Pages"| Home
    N -->|"Serve Pages"| Captchas
    Home -->|wraps| L
    Captchas -->|wraps| L
    Home -->|uses| G
    Captchas -->|uses| G

    subgraph "UI Components (src/components)"
        VC["CaptchaComponent"]:::component
        AC["AccessibleCaptchaComponent"]:::component
        CS["CaptchaSelectionModal"]:::component
        HT["HoverTestComponent"]:::component
        SF["SoundFeedback"]:::component
        SN["SoundFeedbackNew"]:::component
    end

    Captchas -->|renders| AC
    Home -->|renders| VC
    Home -->|renders| CS
    Home -->|renders| HT
    AC -->|renders| SF
    AC -->|renders| SN

    subgraph "Business Logic Hooks (src/hooks)"
        A["useAccessibility"]:::hook
        S1["useSpeech"]:::hook
        SFx["useSpeechFixed"]:::hook
        SG["useSpeechGoogleOptimized"]:::hook
        SS["useSpeechSimple"]:::hook
    end

    VC -->|calls| A
    AC -->|calls| A
    VC -->|calls| S1
    VC -->|calls| SFx
    AC -->|calls| SG
    AC -->|calls| SS

    subgraph "External Services"
        W["Web Speech API"]:::external
        GCT["Google Cloud TTS"]:::external
    end

    S1 -->|calls| W
    SFx -->|calls| W
    SS -->|calls| W
    SG -->|calls| GCT

    Static["Static Assets\n(public/)"]:::infra
    Configs["next.config.ts\npostcss.config.mjs\npackage.json"]:::infra

    N -->|serves| Static
    N -->|reads| Configs

    classDef client fill:#a2d5f2,stroke:#333,stroke-width:1px
    classDef infra fill:#f4c2c2,stroke:#333,stroke-width:1px
    classDef pages fill:#d5f2a2,stroke:#333,stroke-width:1px
    classDef component fill:#c2f4c2,stroke:#333,stroke-width:1px
    classDef hook fill:#c2c2f4,stroke:#333,stroke-width:1px
    classDef external fill:#f2e2a2,stroke:#333,stroke-width:1px

    click Home "https://github.com/roberto8695/captcha-accesible/blob/main/src/app/page.tsx"
    click Captchas "https://github.com/roberto8695/captcha-accesible/blob/main/src/app/captchasordos/page.tsx"
    click L "https://github.com/roberto8695/captcha-accesible/blob/main/src/app/layout.tsx"
    click G "https://github.com/roberto8695/captcha-accesible/blob/main/src/app/globals.css"
    click VC "https://github.com/roberto8695/captcha-accesible/blob/main/src/components/CaptchaComponent.tsx"
    click AC "https://github.com/roberto8695/captcha-accesible/blob/main/src/components/AccessibleCaptchaComponent.tsx"
    click CS "https://github.com/roberto8695/captcha-accesible/blob/main/src/components/CaptchaSelectionModal.tsx"
    click HT "https://github.com/roberto8695/captcha-accesible/blob/main/src/components/HoverTestComponent.tsx"
    click SF "https://github.com/roberto8695/captcha-accesible/blob/main/src/components/SoundFeedback.tsx"
    click SN "https://github.com/roberto8695/captcha-accesible/blob/main/src/components/SoundFeedbackNew.tsx"
    click A "https://github.com/roberto8695/captcha-accesible/blob/main/src/hooks/useAccessibility.ts"
    click S1 "https://github.com/roberto8695/captcha-accesible/blob/main/src/hooks/useSpeech.ts"
    click SFx "https://github.com/roberto8695/captcha-accesible/blob/main/src/hooks/useSpeechFixed.ts"
    click SG "https://github.com/roberto8695/captcha-accesible/blob/main/src/hooks/useSpeechGoogleOptimized.ts"
    click SS "https://github.com/roberto8695/captcha-accesible/blob/main/src/hooks/useSpeechSimple.ts"
    click Static "https://github.com/roberto8695/captcha-accesible/tree/main/public/"
    click Configs "https://github.com/roberto8695/captcha-accesible/blob/main/package.json"
```
