# manterolaenrique/guitar-app-git architecture

> Architecture diagram of the GitHub repository manterolaenrique/guitar-app-git, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/manterolaenrique/guitar-app-git
- Repository: https://github.com/manterolaenrique/guitar-app-git

## Overview

##### Project type and purpose
- This is a full-stack (front-end heavy) web application built with Next.js and React, designed to provide interactive guitar tools: scale visualizer, chord charts, circle of fifths, and a tuner.
- There is no custom back-end API; all data (chord formulas, scale data, circle-of-fifths notes) is served as static modules. The tuner uses the browser’s Web Audio API via a custom hook.

##### File structure
- **app/** – file-based routing for Next.js pages (SSR/SSG).
- **components/** – reusable UI pieces (ChordInfo, Tuner, Navbar, etc.).
- **contexts/** – React Contexts for global state (theme, notation).
- **hooks/** – custom hooks, e.g. useMicrophone.
- **data/** – static data modules for chords, scales, circle of fifths.
- **utils/** – helper functions (noteConverter, theme utilities).
- **styles/** & **globals.css**, **tailwind.config.js** – global and Tailwind CSS configurations.

##### Key insights from README
- Built with Next.js (React + TypeScript) and Tailwind CSS.
- No external APIs; all functionality is client-side, except Next.js serving pages.
- Deployed as a static/SSR site (e.g. Vercel).

##### Main components
a. **User Browser (Client)**
- Renders HTML/CSS/JS, runs React.
- Requests microphone access via Web Audio API.
b. **Next.js Server / CDN**
- Serves pre-rendered pages or static bundles.
- Hosts static assets from public/.
c. **React Application Layers**
- **Pages** (app/*) – route handlers, layout.tsx, page.tsx.
- **UI Components** (components/) – chord viewer, tuner UI, circle of fifths.
- **State Management** (contexts/) – theme, notation selection.
- **Business Logic** (hooks/, utils/) – microphone access, note conversion.
- **Data Layer** (data/) – chord formulas, scale formulas, circle data.
d. **Static Assets** (public/, styles/)
- Images, CSS, Tailwind configuration.

##### Relationships and interactions
- Browser → Next.js Server: HTTP GET for pages & JS bundles.
- Browser ↔ React: Client-side hydration, routing, component rendering.
- React → Data Modules: import static data from data/*.ts to render scales/chords.
- React → Contexts: read/write global theme & notation state.
- React → Hooks: useMicrophone requests audio input, streams data to Tuner component.
- Browser → Web Audio API: capture audio for tuning.

##### Architectural patterns & principles
- **File-based Routing**: Next.js app directory structure.
- **Component-Driven UI**: granular React components.
- **Context API**: global cross-cutting concerns (theme, notation).
- **Static Data Modules**: no database, pure in-repo data.
- **SSR/SSG**: pages pre-rendered, static export ready.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Server / CDN"
        NextServer["Next.js Server / CDN"]:::infrastructure
    end

    subgraph "Client Browser"
        subgraph "React Application"
            subgraph "Pages (app/)"
                app_layout["layout.tsx"]:::client
                app_page["page.tsx (Home)"]:::client
                app_about["about/page.tsx"]:::client
                app_chords["chords/page.tsx"]:::client
                app_circle["circle-of-fifths/page.tsx"]:::client
                app_tuner["tuner/page.tsx"]:::client
            end

            subgraph "UI Components (components/)"
                ChordInfo["ChordInfo.tsx"]:::client
                ScaleViewer["ScaleViewer.tsx"]:::client
                CircleOfFifthsComp["CircleOfFifths.tsx"]:::client
                CircleSheet["CircleOfFifthsSheet.tsx"]:::client
                TunerComp["Tuner.tsx"]:::client
                Navbar["Navbar.tsx"]:::client
                Footer["Footer.tsx"]:::client
                Titulo["TituloAnimado.tsx"]:::client
                AboutComp["About.tsx"]:::client
                FretboardChord["FretboardChord.tsx"]:::client
            end

            subgraph "Contexts (contexts/)"
                NotationContext["MusicNotationContext.tsx"]:::client
            end

            subgraph "Data (data/)"
                chordFormulas["chordFormulas.ts"]:::data
                chordShapes["chordShapes.ts"]:::data
                scaleData["scaleData.ts"]:::data
                scaleFormulas["scaleFormulas.ts"]:::data
                circleData["circleOfFifthsNotes.ts"]:::data
            end

            subgraph "Hooks & Utils"
                useMic["useMicrophone.ts"]:::utils
                noteConverter["noteConverter.ts"]:::utils
                themeUtil["theme.ts"]:::utils
            end

            subgraph "Static Assets & Styles"
                Public["public/"]:::client
                GlobalsCSS["globals.css"]:::client
                Tailwind["tailwind.config.js"]:::client
                NextConfig["next.config.js"]:::infrastructure
            end
        end

        TunerComp -->|"requests audio"| useMic
        useMic -->|"captures audio"| WebAudio
        TunerComp -->|"uses audio stream"| WebAudio

        ChordInfo --> chordFormulas
        ChordInfo --> noteConverter
        ScaleViewer --> scaleData
        ScaleViewer --> scaleFormulas
        ScaleViewer --> noteConverter
        CircleOfFifthsComp --> circleData

        app_layout --> Navbar
        app_layout --> Footer
        app_layout --> GlobalsCSS
        app_layout --> Tailwind
        app_layout --> Public

        app_page --> ChordInfo
        app_chords --> ChordInfo
        app_chords --> ScaleViewer
        app_circle --> CircleOfFifthsComp
        app_circle --> CircleSheet
        app_tuner --> TunerComp
        app_about --> AboutComp

        NotationContext --> ChordInfo
        NotationContext --> ScaleViewer
        NotationContext --> CircleOfFifthsComp

        Public --> NextServer
        GlobalsCSS --> NextServer
        Tailwind --> NextServer

        WebAudio["Web Audio API"]:::external
    end

    NextServer -->|"Serves pages & bundles"| React_Application
    React_Application["React Application"]:::client
    React_Application --> WebAudio
    NextServer -->|"HTTP GET"| React_Application

    click app_layout "https://github.com/manterolaenrique/guitar-app-git/blob/master/app/layout.tsx"
    click app_page "https://github.com/manterolaenrique/guitar-app-git/blob/master/app/page.tsx"
    click app_about "https://github.com/manterolaenrique/guitar-app-git/blob/master/app/about/page.tsx"
    click app_chords "https://github.com/manterolaenrique/guitar-app-git/blob/master/app/chords/page.tsx"
    click app_circle "https://github.com/manterolaenrique/guitar-app-git/blob/master/app/circle-of-fifths/page.tsx"
    click app_tuner "https://github.com/manterolaenrique/guitar-app-git/blob/master/app/tuner/page.tsx"
    click ChordInfo "https://github.com/manterolaenrique/guitar-app-git/blob/master/components/ChordInfo.tsx"
    click ScaleViewer "https://github.com/manterolaenrique/guitar-app-git/blob/master/components/ScaleViewer.tsx"
    click CircleOfFifthsComp "https://github.com/manterolaenrique/guitar-app-git/blob/master/components/CircleOfFifths.tsx"
    click CircleSheet "https://github.com/manterolaenrique/guitar-app-git/blob/master/components/CircleOfFifthsSheet.tsx"
    click TunerComp "https://github.com/manterolaenrique/guitar-app-git/blob/master/components/Tuner.tsx"
    click Navbar "https://github.com/manterolaenrique/guitar-app-git/blob/master/components/Navbar.tsx"
    click Footer "https://github.com/manterolaenrique/guitar-app-git/blob/master/components/Footer.tsx"
    click Titulo "https://github.com/manterolaenrique/guitar-app-git/blob/master/components/TituloAnimado.tsx"
    click AboutComp "https://github.com/manterolaenrique/guitar-app-git/blob/master/components/About.tsx"
    click FretboardChord "https://github.com/manterolaenrique/guitar-app-git/blob/master/components/fretboard/FretboardChord.tsx"
    click NotationContext "https://github.com/manterolaenrique/guitar-app-git/blob/master/contexts/MusicNotationContext.tsx"
    click useMic "https://github.com/manterolaenrique/guitar-app-git/blob/master/hooks/useMicrophone.ts"
    click chordFormulas "https://github.com/manterolaenrique/guitar-app-git/blob/master/data/chordFormulas.ts"
    click chordShapes "https://github.com/manterolaenrique/guitar-app-git/blob/master/data/chordShapes.ts"
    click scaleData "https://github.com/manterolaenrique/guitar-app-git/blob/master/data/scaleData.ts"
    click scaleFormulas "https://github.com/manterolaenrique/guitar-app-git/blob/master/data/scaleFormulas.ts"
    click circleData "https://github.com/manterolaenrique/guitar-app-git/blob/master/data/circleOfFifthsNotes.ts"
    click noteConverter "https://github.com/manterolaenrique/guitar-app-git/blob/master/utils/noteConverter.ts"
    click themeUtil "https://github.com/manterolaenrique/guitar-app-git/blob/master/utils/theme.ts"
    click Public "https://github.com/manterolaenrique/guitar-app-git/tree/master/public/"
    click GlobalsCSS "https://github.com/manterolaenrique/guitar-app-git/blob/master/styles/globals.css"
    click Tailwind "https://github.com/manterolaenrique/guitar-app-git/blob/master/tailwind.config.js"
    click NextConfig "https://github.com/manterolaenrique/guitar-app-git/blob/master/next.config.js"

    classDef infrastructure fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef client fill:#90EE90,stroke:#000,stroke-width:1px
    classDef data fill:#FFFFE0,stroke:#000,stroke-width:1px
    classDef utils fill:#FFA500,stroke:#000,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#000,stroke-width:1px
```
