# vannguyen799/musicapp-angularjs architecture

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

- Interactive diagram: https://gitdiagram.com/vannguyen799/musicapp-angularjs
- Repository: https://github.com/vannguyen799/musicapp-angularjs

## Overview

##### Main System Components

a) Client-Side (Frontend):
- AngularJS frontend application
- Audio Player component (referenced in view/audioPlayer.html)
- Redirect mechanism (shown by the redirect folder)

b) Server-Side (Backend):
- Google Apps Script backend (indicated by .clasp.json and appsscript.json)
- Google Sheets as database (indicated by sheet/SongFileManager.js)

##### Architectural Layers

a) View Layer:
- Audio Player Interface
- New Tab Interface

b) Controller Layer:
- MusicAppController

c) Service Layer:
- AuthService
- PlaylistService
- SongService
- UserService

d) Model Layer:
- SongInfo model
- Database abstraction

e) RPC Layer:
- JSONRPCServer for client-server communication

##### Data Flow Representation
- Client-server communication through JSON-RPC
- Data flow between services and Google Sheets
- User authentication flow
- Music streaming path

##### Specific Implementation Details

- Blue rectangles: Frontend components
- Green rectangles: Service layer components
- Yellow rectangles: Data storage (Google Sheets)
- Purple rectangles: Authentication components
- Orange rectangles: RPC communication layer

##### Component Relationships

Key interactions:
**Client UI <-> JSONRPCServer <-> Services <-> SongFileManager <-> Google Sheets**
**AuthService <-> UserService**
**PlaylistService <-> SongService**

##### Technical Specifications

A technical stack section showing:
- AngularJS (Frontend Framework)
- Google Apps Script (Backend Runtime)
- Google Sheets (Data Storage)
- HTML5 Audio (Player Implementation)

**[Client Layer (AngularJS)]**
- ↕
**[RPC Communication Layer]**
- ↕
**[Service Layer]**
- ↕
**[Data Access Layer]**
- ↕
**[Google Sheets Storage]**

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef service fill:#2ecc71,stroke:#27ae60,color:white
    classDef storage fill:#f1c40f,stroke:#f39c12,color:black
    classDef auth fill:#9b59b6,stroke:#8e44ad,color:white
    classDef rpc fill:#e67e22,stroke:#d35400,color:white
    classDef model fill:#1abc9c,stroke:#16a085,color:white
    classDef utils fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Frontend Layer
    subgraph Frontend
        APP["Application Entry Point"]
        AP["Audio Player Interface"]
        NT["New Tab Interface"]
        MC["Music App Controller"]
        RD["Redirect Mechanism"]
    end

    %% Service Layer
    subgraph Services
        AS["Auth Service"]
        PS["Playlist Service"]
        SS["Song Service"]
        US["User Service"]
    end

    %% Model Layer
    subgraph Models
        SI["Song Info Model"]
        DB["Database Layer"]
    end

    %% Communication Layer
    RPCL["JSON-RPC Server"]
    SRV["Server Component"]
    ENV["Environment Config"]
    UTIL["Utility Functions"]

    %% Storage Layer
    subgraph Storage
        SFM["Song File Manager"]
        GS["Google Sheets"]
        GAS["Google Apps Script"]
    end

    %% Relationships
    APP --> AP
    APP --> NT
    APP --> MC
    MC --> AS
    MC --> PS
    MC --> SS
    MC --> US
    PS --> SS
    SS --> DB
    AS --> US
    DB --> SFM
    SFM --> GS
    RPCL --> SRV
    SRV --> GAS
    US --> SI
    PS --> SI
    SS --> SI
    ENV --> SRV
    UTIL --> MC
    RD --> AS

    %% Click Events
    click APP "https://github.com/vannguyen799/MusicApp-AngularJS/blob/main/src/app.js"
    click AP "https://github.com/vannguyen799/MusicApp-AngularJS/blob/main/src/view/audioPlayer.html"
    click NT "https://github.com/vannguyen799/MusicApp-AngularJS/blob/main/src/view/newTab.html"
    click MC "https://github.com/vannguyen799/MusicApp-AngularJS/blob/main/src/controller/MusicAppController.js"
    click AS "https://github.com/vannguyen799/MusicApp-AngularJS/blob/main/src/service/AuthService.js"
    click PS "https://github.com/vannguyen799/MusicApp-AngularJS/blob/main/src/service/PlaylistService.js"
    click SS "https://github.com/vannguyen799/MusicApp-AngularJS/blob/main/src/service/SongService.js"
    click US "https://github.com/vannguyen799/MusicApp-AngularJS/blob/main/src/service/UserService.js"
    click SI "https://github.com/vannguyen799/MusicApp-AngularJS/blob/main/src/model/SongInfo.js"
    click DB "https://github.com/vannguyen799/MusicApp-AngularJS/blob/main/src/database.js"
    click RPCL "https://github.com/vannguyen799/MusicApp-AngularJS/blob/main/src/rpc/JSONRPCServer.js"
    click SRV "https://github.com/vannguyen799/MusicApp-AngularJS/blob/main/src/server.js"
    click SFM "https://github.com/vannguyen799/MusicApp-AngularJS/blob/main/src/sheet/SongFileManager.js"
    click GAS "https://github.com/vannguyen799/MusicApp-AngularJS/blob/main/appsscript.json"
    click RD "https://github.com/vannguyen799/MusicApp-AngularJS/blob/main/redirect/index.html"
    click ENV "https://github.com/vannguyen799/MusicApp-AngularJS/blob/main/src/env.js"
    click UTIL "https://github.com/vannguyen799/MusicApp-AngularJS/blob/main/src/utils.js"

    %% Styling
    class APP,AP,NT,MC,RD frontend
    class AS,PS,SS,US service
    class SI,DB model
    class RPCL,SRV rpc
    class SFM,GS,GAS storage
    class AS,US auth
    class ENV,UTIL utils
```
