# eatekha/finditapp architecture

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

- Interactive diagram: https://gitdiagram.com/eatekha/finditapp
- Repository: https://github.com/eatekha/finditapp

## Overview

##### Project type and purpose
- This is an iOS mobile client application (FindIT) built with Swift and SwiftUI.
- It records and processes audio, performs speech recognition (hot-word or continuous), sends/transcribes audio (likely via Whisper or a remote service over WebSocket), and displays relevant “movie” or “item” search results in a SwiftUI interface.

##### File structure
- Top-level Xcode project/xcworkspace files (FindIT.xcodeproj, FindIT.xcworkspace).
- App source in FindIT/:
- SwiftUI entrypoint: FindITApp.swift, ContentView.swift
- Views: MovieView.swift, MovieDetailView.metal, TestView.swift, ViewController.swift
- ViewModel: MovieViewModel.swift
- Managers: AudioManager.swift, AudioRecorder.swift, SpeechRecognizer.swift, WhisperManager.swift, WebSocketManager.swift
- Assets & Info.plist
- Third-party frameworks in Pods/:
- Cobra-iOS (Picovoice for voice activity detection)
- ios-voice-processor (audio buffering and processing)
- Podfiles, test targets (FindITTests, FindITUITests)

##### README
- Very minimal (“MyFinance”)—project name placeholder. No embedded architecture details, so infer from code.

##### Main components and interactions
a. Components
1) UI Layer (SwiftUI Views & ViewController)
2) MVVM Layer (MovieViewModel)
3) Audio Pipeline
- AudioRecorder / AudioManager
- VoiceProcessor (from ios-voice-processor)
- Cobra (hot-word/voice activity detection)
4) Speech-to-Text
- SpeechRecognizer (local or remote STT)
- WhisperManager (handles Whisper API or model)
5) Networking
- WebSocketManager (real-time communication with backend or transcription service)
6) Assets & Rendering
- MovieDetailView.metal (custom Metal shader)
7) External frameworks
- Cobra-iOS xcframework
- ios-voice-processor Swift package

b. Relationships & data flow
1) User taps UI → ContentView calls MovieViewModel
2) MovieViewModel invokes AudioManager/AudioRecorder
3) Audio is buffered → VoiceProcessor → Cobra for VAD/hotword
4) On detection, audio frames go to SpeechRecognizer and/or WhisperManager
5) WhisperManager may use WebSocketManager to stream audio to a remote Whisper service
6) Transcribed text returns to MovieViewModel
7) MovieViewModel queries local or remote movie-search API → updates published properties
8) SwiftUI Views observe ViewModel → render MovieView, MovieDetailView with Metal shader

c. Architectural patterns & principles
- MVVM: clear separation between Views and business logic
- Modular audio pipeline: pluggable components (record → process → recognize)
- Dependency injection/facade for external services (WebSocketManager, WhisperManager)
- Use of Swift packages and CocoaPods for decoupled third-party code

d. Key technologies & frameworks
- SwiftUI (UI)
- Combine or ObservableObject (data binding)
- CocoaPods (Cobra-iOS, ios-voice-processor)
- WebSocket for real-time service communication
- Metal shading (MovieDetailView.metal)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User
    User(("User")):::external

    %% UI Layer
    subgraph "UI Layer"
        direction TB
        FindITApp["FindITApp"]:::frontend
        ContentView["ContentView"]:::frontend
        MovieView["MovieView"]:::frontend
        TestView["TestView"]:::frontend
        ViewController["ViewController"]:::frontend
        MovieDetailView["MovieDetailView.metal"]:::frontend
    end

    %% MVVM Layer
    subgraph "MVVM Layer"
        direction TB
        MovieViewModel["MovieViewModel"]:::logic
    end

    %% Audio Pipeline
    subgraph "Audio Pipeline"
        direction TB
        AudioManager["AudioManager"]:::audio
        AudioRecorder["AudioRecorder"]:::audio
        VoiceProcessor["VoiceProcessor"]:::audio
        Cobra["Cobra (VAD/Hotword)"]:::audio
    end

    %% Speech-to-Text
    subgraph "Speech-to-Text"
        direction TB
        SpeechRecognizer["SpeechRecognizer"]:::logic
        WhisperManager["WhisperManager"]:::logic
    end

    %% Networking
    subgraph "Networking"
        direction TB
        WebSocketManager["WebSocketManager"]:::network
    end

    %% External Services
    subgraph "External Services"
        direction TB
        ExternalService["External STT/Backend Service"]:::external
    end

    %% Pod Frameworks
    subgraph "Third-Party Frameworks (Pods)"
        direction TB
        IOSVP["ios-voice-processor"]:::pod
        CobraPod["Cobra-iOS"]:::pod
    end

    %% Connections
    User -->|"taps UI"| ContentView
    ContentView -->|"binds to"| MovieViewModel
    MovieViewModel -->|"start recording"| AudioManager
    AudioManager -->|"record audio"| AudioRecorder
    AudioRecorder -->|"buffered audio"| VoiceProcessor
    VoiceProcessor -->|"VAD frames"| Cobra
    Cobra -->|"on detection"| SpeechRecognizer
    Cobra -->|"on detection"| WhisperManager
    SpeechRecognizer -->|"transcribed text"| MovieViewModel
    WhisperManager -->|"stream audio"| WebSocketManager
    WebSocketManager -->|"streaming"| ExternalService
    ExternalService -->|"transcript"| WhisperManager
    WhisperManager -->|"transcribed text"| MovieViewModel
    MovieViewModel -->|"search query"| ExternalService
    MovieViewModel -->|"publishes update"| MovieView
    MovieViewModel -->|"publishes update"| TestView
    MovieViewModel -->|"publishes update"| MovieDetailView

    %% Group Pods relationships
    VoiceProcessor -- uses --> IOSVP
    Cobra -- uses --> CobraPod

    %% Click Events
    click ContentView "https://github.com/eatekha/finditapp/blob/main/FindIT/ContentView.swift"
    click MovieView "https://github.com/eatekha/finditapp/blob/main/FindIT/MovieView.swift"
    click TestView "https://github.com/eatekha/finditapp/blob/main/FindIT/TestView.swift"
    click FindITApp "https://github.com/eatekha/finditapp/blob/main/FindIT/FindITApp.swift"
    click ViewController "https://github.com/eatekha/finditapp/blob/main/FindIT/ViewController.swift"
    click MovieDetailView "https://github.com/eatekha/finditapp/blob/main/FindIT/MovieDetailView.metal"
    click MovieViewModel "https://github.com/eatekha/finditapp/blob/main/FindIT/MovieViewModel.swift"
    click AudioManager "https://github.com/eatekha/finditapp/blob/main/FindIT/AudioManager.swift"
    click AudioRecorder "https://github.com/eatekha/finditapp/blob/main/FindIT/AudioRecorder.swift"
    click VoiceProcessor "https://github.com/eatekha/finditapp/blob/main/Pods/ios-voice-processor/VoiceProcessor.swift"
    click IOSVP "https://github.com/eatekha/finditapp/tree/main/Pods/ios-voice-processor"
    click Cobra "https://github.com/eatekha/finditapp/blob/main/Pods/Cobra-iOS/binding/ios/Cobra.swift"
    click CobraPod "https://github.com/eatekha/finditapp/tree/main/Pods/Cobra-iOS"
    click SpeechRecognizer "https://github.com/eatekha/finditapp/blob/main/FindIT/SpeechRecognizer.swift"
    click WhisperManager "https://github.com/eatekha/finditapp/blob/main/FindIT/WhisperManager.swift"
    click WebSocketManager "https://github.com/eatekha/finditapp/blob/main/FindIT/WebSocketManager.swift"
    click ExternalService "https://github.com/eatekha/finditapp/blob/main/FindIT/Info.plist"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef logic fill:#90EE90,stroke:#333,stroke-width:1px
    classDef audio fill:#FFA500,stroke:#333,stroke-width:1px
    classDef network fill:#DDA0DD,stroke:#333,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef pod fill:#f2f2f2,stroke:#333,stroke-width:1px
```
