# emanuelchristo/movie-night architecture

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

- Interactive diagram: https://gitdiagram.com/emanuelchristo/movie-night
- Repository: https://github.com/emanuelchristo/movie-night

## Overview

##### Main Components
- Frontend Framework: Nuxt.js – This provides SSR, file-based routing (pages directory), Vue components, and middleware.
- Pages: Located in the pages/ directory (e.g., index.vue, _room.vue, createroom.vue, joinroom.vue). These represent the different views like landing, room creation, and join room.
- Layouts: Found in layouts/ – For example, landing.vue sets up different page templates.
- Components: The components/ directory hosts reusable UI components such as AudioBar, Avatar, Controls, etc., and modals specialized for editing and inviting.
- Store: Vuex store (store/index.js) handles state management. This is essential for synchronizing UI state, video progress, and user interactions.
- Plugins: Several plugins (e.g., socket-io.js for real-time socket connections, vue-plyr.js for video playback enhancements, srt-webvtt.js for subtitles) extend the functionality.

##### Relationships and Interactions
- The Nuxt.js framework glues together the pages, layouts, and components. Page components (from the pages/) import and render the UI elements from components/.
- Vuex (store/) acts as the central hub for state management across the different pages and components.
- Plugins integrate external libraries: for instance, the socket-io.js plugin is likely used to establish a real-time connection with the backend (as suggested by the SERVER_URL environment variable), which drives live updates.
- The middleware directory might manage route guards or other cross-cutting concerns within the app.

##### Architectural Patterns
- Component-Based Architecture: Emphasizes reusability (the components folder) where UI elements and modals are modularized.
- Single-Page Application (SPA) with Nuxt routing: The pages directory reflects the different routes, and Nuxt’s SSR/SSG capabilities support both dynamic and static builds.
- State Management using Vuex: The store centralizes global state and synchronizes real-time updates.
- Plugin Architecture: External modular functionalities (socket connection, subtitle parsing, media handling) are encapsulated in plugins.

##### Relevant Technologies
- Nuxt.js/Vue.js for the overall framework
- Vuex for state management
- Plugins like socket-io for real-time data, vue-plyr for video playback, and srt-webvtt for subtitle support
- SCSS for styling (assets/css)
- Middleware for route handling and potentially for security or session management

##### Summarize the Architecture Visually
- At the top, have a “Client/User” block initiating actions.
- Below that, have the “Frontend Application (Nuxt.js)” broken into:
– Pages (routing)
– Layouts (templates)
– Components (UI elements)
– Store (state management)
– Plugins (integration with external services)

## Diagram (Mermaid)

```mermaid
flowchart TD
    Client("Client/User"):::client
    Nuxt("Nuxt.js Framework"):::framework

    Client -->|"initiates"| Nuxt

    subgraph "Frontend Application (Nuxt.js)"
        subgraph "Pages"
            direction TB
            PIndex("index.vue"):::pagesFile
            PRoom("_room.vue"):::pagesFile
            PCreator("createroom.vue"):::pagesFile
            PJoin("joinroom.vue"):::pagesFile
        end

        subgraph "Layouts"
            direction TB
            LLanding("landing.vue"):::layoutsFile
        end

        subgraph "Components"
            direction TB
            CAudio("AudioBar.vue"):::componentsFile
            CAvatar("Avatar.vue"):::componentsFile
            CControls("Controls.vue"):::componentsFile
            CInfo("Info.vue"):::componentsFile
            CJoinRoom("JoinRoom.vue"):::componentsFile
            CModal("Modal.vue"):::componentsFile
            CParticipant("Participant.vue"):::componentsFile
            CPlayer("Player.vue"):::componentsFile
            CRoomSetup("RoomSetup.vue"):::componentsFile
            CSpinner("Spinner.vue"):::componentsFile
            CVideoStopped("VideoStopped.vue"):::componentsFile
            CEditRoom("modals/EditRoom.vue"):::componentsFile
            CInvite("modals/Invite.vue"):::componentsFile
            CVideoLink("modals/VideoLinkModal.vue"):::componentsFile
        end

        subgraph "Middleware"
            direction TB
            MiddlewareNode("middleware/README.md"):::middlewareFile
        end
    end

    Store("Vuex Store"):::store

    subgraph "Plugins"
        direction TB
        PSocket("socket-io.js"):::pluginsFile
        PPlyr("vue-plyr.js"):::pluginsFile
        PSrt("srt-webvtt.js"):::pluginsFile
        PPing("ping.js"):::pluginsFile
    end

    subgraph "Assets & Static Resources"
        direction TB
        Vars("_variables.scss"):::assetFile
        Global("global.scss"):::assetFile
        Icons("icons (directory)"):::assetDir
        Images("images (directory)"):::assetDir
        SampleVTT("sample.vtt"):::assetFile
    end

    Backend("Backend Server"):::backend

    %% Connections between Nuxt and Presentation Layer
    Nuxt --> PIndex
    Nuxt --> LLanding
    Nuxt --> CAudio
    Nuxt --> MiddlewareNode

    %% State management connections
    PIndex -->|"stateUpdate"| Store
    CAudio -->|"stateUpdate"| Store
    CPlayer -->|"syncs"| Store

    %% Plugins communicating with Backend Server
    PSocket -->|"socket"| Backend
    PPlyr -->|"video"| Backend
    PSrt -->|"subtitle"| Backend
    PPing -->|"ping"| Backend

    %% Assets providing resources
    Global --> CModal
    Vars --> CControls
    Icons --> LLanding
    Images --> CAvatar
    SampleVTT --> PIndex

    %% Class Definitions
    classDef client fill:#f9c,stroke:#333,stroke-width:2px;
    classDef framework fill:#b4d9ff,stroke:#333,stroke-width:2px;
    classDef pagesFile fill:#c1f0c1,stroke:#333,stroke-width:2px;
    classDef layoutsFile fill:#ffeca1,stroke:#333,stroke-width:2px;
    classDef componentsFile fill:#c8e1ff,stroke:#333,stroke-width:2px;
    classDef middlewareFile fill:#f7c6c7,stroke:#333,stroke-width:2px;
    classDef store fill:#ffe6a7,stroke:#333,stroke-width:2px;
    classDef pluginsFile fill:#d0a9f5,stroke:#333,stroke-width:2px;
    classDef assetFile fill:#e2e2e2,stroke:#333,stroke-width:2px;
    classDef assetDir fill:#a1d0a1,stroke:#333,stroke-width:2px;
    classDef backend fill:#fdd,stroke:#333,stroke-width:2px,stroke-dasharray: 5, 5;

    %% Click Events
    click Nuxt "https://github.com/emanuelchristo/movie-night/blob/master/nuxt.config.js"
    click PIndex "https://github.com/emanuelchristo/movie-night/blob/master/pages/index.vue"
    click PRoom "https://github.com/emanuelchristo/movie-night/blob/master/pages/_room.vue"
    click PCreator "https://github.com/emanuelchristo/movie-night/blob/master/pages/createroom.vue"
    click PJoin "https://github.com/emanuelchristo/movie-night/blob/master/pages/joinroom.vue"
    click LLanding "https://github.com/emanuelchristo/movie-night/blob/master/layouts/landing.vue"
    click CAudio "https://github.com/emanuelchristo/movie-night/blob/master/components/AudioBar.vue"
    click CAvatar "https://github.com/emanuelchristo/movie-night/blob/master/components/Avatar.vue"
    click CControls "https://github.com/emanuelchristo/movie-night/blob/master/components/Controls.vue"
    click CInfo "https://github.com/emanuelchristo/movie-night/blob/master/components/Info.vue"
    click CJoinRoom "https://github.com/emanuelchristo/movie-night/blob/master/components/JoinRoom.vue"
    click CModal "https://github.com/emanuelchristo/movie-night/blob/master/components/Modal.vue"
    click CParticipant "https://github.com/emanuelchristo/movie-night/blob/master/components/Participant.vue"
    click CPlayer "https://github.com/emanuelchristo/movie-night/blob/master/components/Player.vue"
    click CRoomSetup "https://github.com/emanuelchristo/movie-night/blob/master/components/RoomSetup.vue"
    click CSpinner "https://github.com/emanuelchristo/movie-night/blob/master/components/Spinner.vue"
    click CVideoStopped "https://github.com/emanuelchristo/movie-night/blob/master/components/VideoStopped.vue"
    click CEditRoom "https://github.com/emanuelchristo/movie-night/blob/master/components/modals/EditRoom.vue"
    click CInvite "https://github.com/emanuelchristo/movie-night/blob/master/components/modals/Invite.vue"
    click CVideoLink "https://github.com/emanuelchristo/movie-night/blob/master/components/modals/VideoLinkModal.vue"
    click Store "https://github.com/emanuelchristo/movie-night/blob/master/store/index.js"
    click PSocket "https://github.com/emanuelchristo/movie-night/blob/master/plugins/socket-io.js"
    click PPlyr "https://github.com/emanuelchristo/movie-night/blob/master/plugins/vue-plyr.js"
    click PSrt "https://github.com/emanuelchristo/movie-night/blob/master/plugins/srt-webvtt.js"
    click PPing "https://github.com/emanuelchristo/movie-night/blob/master/plugins/ping.js"
    click MiddlewareNode "https://github.com/emanuelchristo/movie-night/blob/master/middleware/README.md"
    click Vars "https://github.com/emanuelchristo/movie-night/blob/master/assets/css/_variables.scss"
    click Global "https://github.com/emanuelchristo/movie-night/blob/master/assets/css/global.scss"
    click Icons "https://github.com/emanuelchristo/movie-night/tree/master/assets/icons"
    click Images "https://github.com/emanuelchristo/movie-night/tree/master/assets/images"
    click SampleVTT "https://github.com/emanuelchristo/movie-night/blob/master/static/sample.vtt"
```
