# ilakshaygupt/soundly-ios architecture

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

- Interactive diagram: https://gitdiagram.com/ilakshaygupt/soundly-ios
- Repository: https://github.com/ilakshaygupt/soundly-ios

## Overview

##### Main Components

a. Client Applications:
- iOS App (Main Application)
- WatchOS App (Companion App)
- Bi-directional communication between iOS and WatchOS apps

b. Core Features Modules:
- Authentication System
- Music Player System
- Search Engine
- Library Management
- User Playlist System

c. External Services (to be inferred):
- Backend API Server
- Media Storage Server
- Authentication Server

##### Architectural Patterns to Highlight

- Models (e.g., SongModel, PlaylistModel)
- Views (Screen files)
- ViewModels (e.g., LoginViewModel, PlayerViewModel)

##### Component Relationships

**┌─────────────────────────────────────────────────────────────┐**
- Client Applications                      │
- ┐                        ┌──────────────────┐│
- iOS App      │◄──────WatchKit───────►│    WatchOS App   ││
- ┬───────┘                        └──────────────────┘│

- ▼                                                     │
**┌─────────────────┐                                           │**
- Core Services  │                                           │
- ┴───────────────────────────────────────┐  │
- ┌───────────┐  ┌──────────┐  ┌────────────┐ ┌────────┐ │  │
- Auth    │  │  Player  │  │  Library   │ │ Search │ │  │
- Module   │  │  Module  │  │   Module   │ │ Module │ │  │
- ┬─────┘  └────┬─────┘  └─────┬──────┘ └───┬────┘ │  │
- ┼──────────────┼─────────────┼────────────┼───────┘  │

- ▼              ▼             ▼            ▼          │
**┌─────────────────────────────────────────────────────────────┘**
- External Services                         │
- ┐  ┌──────────────┐  ┌────────────────┐     │
- Auth Server   │  │ Media Server │  │  API Gateway   │     │
- ┘  └──────────────┘  └────────────────┘     │

##### Specific Implementation Details

- Authentication flow (Login/SignUp/OTP)
- Music playback system with AVFoundation
- Data persistence (KeychainWrapper usage)
- Network layer for API communications
- WatchOS connectivity pattern

##### Technical Stack Indicators

Technology badges/labels:
- SwiftUI
- AVFoundation
- WatchKit
- Keychain
- NetworkImage

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client["Client Applications"]
        direction TB
        iOS["iOS App"]
        Watch["WatchOS App"]
        iOS <--> |WatchKit| Watch
    end

    subgraph Core["Core Features"]
        direction TB
        Auth["Authentication System"]
        Player["Music Player System"]
        Search["Search Engine"]
        Library["Library Management"]
        Home["Home Interface"]
    end

    subgraph Auth_Components["Authentication Components"]
        direction TB
        Login["Login Module"]
        SignUp["SignUp Module"]
        OTP["OTP Module"]
    end

    subgraph Player_Components["Player Components"]
        direction TB
        PlayerCore["Player Core Logic"]
        Controls["Player Controls"]
        NowPlaying["Now Playing"]
    end

    subgraph Watch_Components["WatchOS Components"]
        direction TB
        WatchApp["Watch App"]
        Connectivity["Watch Connectivity"]
        WatchPlayer["Watch Player"]
    end

    subgraph Network["Network Layer"]
        direction TB
        APIHandler["API Handler"]
        ErrorHandler["Error Handler"]
    end

    subgraph External["External Services"]
        direction TB
        AuthServer["Authentication Server"]
        MediaServer["Media Server"]
        APIGateway["API Gateway"]
    end

    iOS --> Core
    Watch --> Watch_Components
    Auth --> Auth_Components
    Player --> Player_Components
    Core --> Network
    Network --> External

    %% Click Events
    click Auth "https://github.com/ilakshaygupt/soundly-ios/tree/main/Soundly/Features/Auth/"
    click Login "https://github.com/ilakshaygupt/soundly-ios/tree/main/Soundly/Features/Auth/Login/"
    click SignUp "https://github.com/ilakshaygupt/soundly-ios/tree/main/Soundly/Features/Auth/SignUp/"
    click OTP "https://github.com/ilakshaygupt/soundly-ios/tree/main/Soundly/Features/Auth/OTP/"
    click PlayerCore "https://github.com/ilakshaygupt/soundly-ios/blob/main/Soundly/Utilities/MusicPlayerManager.swift"
    click Controls "https://github.com/ilakshaygupt/soundly-ios/blob/main/Soundly/Features/Commons/MusicLogic/PlayerControls.swift"
    click NowPlaying "https://github.com/ilakshaygupt/soundly-ios/blob/main/Soundly/Features/Commons/MusicLogic/NowPlayingBar.swift"
    click Search "https://github.com/ilakshaygupt/soundly-ios/tree/main/Soundly/Features/Search/"
    click Library "https://github.com/ilakshaygupt/soundly-ios/tree/main/Soundly/Features/Library/"
    click WatchApp "https://github.com/ilakshaygupt/soundly-ios/tree/main/SoundlyWatchOs Watch App/"
    click Connectivity "https://github.com/ilakshaygupt/soundly-ios/blob/main/SoundlyWatchOs Watch App/WatchToIosConnector.swift"
    click WatchPlayer "https://github.com/ilakshaygupt/soundly-ios/blob/main/SoundlyWatchOs Watch App/WatchNowPlayingViewModel.swift"
    click APIHandler "https://github.com/ilakshaygupt/soundly-ios/blob/main/Soundly/Utilities/APIRequest.swift"
    click ErrorHandler "https://github.com/ilakshaygupt/soundly-ios/blob/main/Soundly/Utilities/APIError.swift"
    click Home "https://github.com/ilakshaygupt/soundly-ios/blob/main/Soundly/Features/HomePage/Screens/MainView.swift"

    classDef client fill:#2374ab
    classDef core fill:#48a9a6
    classDef auth fill:#4b4e6d
    classDef player fill:#6a8d73
    classDef watch fill:#a4c2a5
    classDef network fill:#f4d03f
    classDef external fill:#e67e22

    class iOS,Watch client
    class Auth,Player,Search,Library,Home core
    class Login,SignUp,OTP auth
    class PlayerCore,Controls,NowPlaying player
    class WatchApp,Connectivity,WatchPlayer watch
    class APIHandler,ErrorHandler network
    class AuthServer,MediaServer,APIGateway external
```
