# yiminwook/liveuta architecture

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

- Interactive diagram: https://gitdiagram.com/yiminwook/liveuta
- Repository: https://github.com/yiminwook/liveuta

## Overview

##### High-Level Architecture Components

a. Frontend Layer:
- Next.js Application (src/app directory structure)
- Client-side Components (src/components)
- State Management (src/stores using Zustand)
- Multiple UI Themes (public/theme-v2.css, theme.css)

b. Backend Layer:
- API Routes (src/app/api)
- Authentication System (NextAuth)
- Multiple Database Connections:
- MongoDB
- OracleDB
- Firebase

c. External Services:
- YouTube Data API
- Firebase Cloud Messaging
- Sentry (Error Tracking)
- Google Analytics
- Discord/Kakao Integration

##### Key Architectural Patterns to Highlight

a. Route Groups Organization:
**(web)**
- (inner) - Internal pages
- (pip) - Picture-in-Picture features

b. Feature Modules:
- Schedule Management
- Setlist Management
- Multi-view Capability
- Push Notifications
- Internationalization (i18n)

**[Client Layer]**

- Web Interface
- Public Pages
- Protected Pages
- Admin Interface

- State Management
- App Store
- Modal Store
- Player Store
- MultiView Store

**[API Layer]**

- Authentication
- NextAuth
- Custom Auth

- Core APIs
- Schedule
- Setlist
- Channel
- Push Notifications

**[External Services]**

- YouTube API
- Firebase
- Cloud Messaging
- Admin SDK

**[Data Layer]**

- MongoDB
- OracleDB
- Firebase Realtime

##### Important Connections

- Authentication flow between NextAuth and external providers
- Data flow between API Layer and databases
- Real-time connections for push notifications
- Integration points with YouTube API

##### Additional Elements

- API versioning notation (v1)
- Caching mechanisms
- Security boundaries
- Internationalization paths

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client["Client Layer"]
        WebUI["Web Interface"]
        PublicPages["Public Pages"]
        ProtectedPages["Protected Pages"]
        AdminUI["Admin Interface"]
        
        subgraph StateManagement["State Management"]
            AppStore["App Store"]:::store
            ModalStore["Modal Store"]:::store
            PlayerStore["Player Store"]:::store
            MultiViewStore["Multi-view Store"]:::store
        end
        
        Components["Components"]:::frontend
        Themes["UI Themes"]:::frontend
        I18N["Internationalization"]:::frontend
    end
    
    subgraph APILayer["API Layer"]
        AuthSystem["Authentication System"]
        
        subgraph CoreAPI["Core APIs"]
            ScheduleAPI["Schedule API"]:::api
            SetlistAPI["Setlist API"]:::api
            ChannelAPI["Channel API"]:::api
            PushAPI["Push Notifications API"]:::api
        end
    end
    
    subgraph ExternalServices["External Services"]
        YouTube["YouTube Data API"]:::external
        Firebase["Firebase"]:::external
        Sentry["Sentry"]:::external
        Analytics["Google Analytics"]:::external
    end
    
    subgraph DataLayer["Data Layer"]
        MongoDB[(MongoDB)]:::database
        OracleDB[(OracleDB)]:::database
        FirebaseDB[(Firebase Realtime)]:::database
    end
    
    %% Connections
    WebUI --> Components
    Components --> StateManagement
    Components --> Themes
    Components --> I18N
    
    APILayer <--> Client
    CoreAPI <--> DataLayer
    AuthSystem <--> ExternalServices
    CoreAPI <--> ExternalServices
    
    %% Styling
    classDef frontend fill:#3498db
    classDef api fill:#2ecc71
    classDef database fill:#9b59b6
    classDef external fill:#e74c3c
    classDef store fill:#f1c40f
    
    %% Click Events
    click Components "https://github.com/yiminwook/liveuta/tree/main/src/components"
    click Themes "https://github.com/yiminwook/liveuta/blob/main/public/theme.css"
    click I18N "https://github.com/yiminwook/liveuta/tree/main/src/i18n"
    click ScheduleAPI "https://github.com/yiminwook/liveuta/tree/main/src/app/api/v1/schedule"
    click SetlistAPI "https://github.com/yiminwook/liveuta/tree/main/src/app/api/v1/setlist"
    click PushAPI "https://github.com/yiminwook/liveuta/tree/main/src/app/api/push"
    click AuthSystem "https://github.com/yiminwook/liveuta/blob/main/src/app/api/auth/[...nextauth]"
    click MongoDB "https://github.com/yiminwook/liveuta/tree/main/src/libraries/mongoDB"
    click OracleDB "https://github.com/yiminwook/liveuta/tree/main/src/libraries/oracleDB"
    click Firebase "https://github.com/yiminwook/liveuta/tree/main/src/libraries/firebase"
    click YouTube "https://github.com/yiminwook/liveuta/tree/main/src/libraries/youtube"
    click Sentry "https://github.com/yiminwook/liveuta/blob/main/sentry.client.config.ts"
    click Analytics "https://github.com/yiminwook/liveuta/blob/main/src/components/config/GoogleAnalytics.tsx"
    click StateManagement "https://github.com/yiminwook/liveuta/tree/main/src/stores"
```
