# dudn1933/stagecue-fe architecture

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

- Interactive diagram: https://gitdiagram.com/dudn1933/stagecue-fe
- Repository: https://github.com/dudn1933/stagecue-fe

## Overview

##### Project type and purpose
- This is a front-end single-page application (SPA) built with React, TypeScript, and Vite.
- It implements a component-based UI, calls external RESTful APIs for data (auth, users, biz, cast, notice, ads, troupe), and is intended to be containerized (Dockerfile) and served via nginx.
- CI/CD is handled through Jenkins (Jenkinsfile).

##### File structure
- Top-level:
- Dockerfile, nginx/nginx.conf – containerization and web server configuration
- Jenkinsfile – CI/CD pipeline definition
- package.json / package-lock.json, tsconfig*.json, vite.config.ts – build and tooling
- public, index.html – entry point for the SPA
- src/:
- api/ – HTTP clients for each domain (auth, users, biz, cast, notice, ads, troupe)
- store/ – global state (possibly using Zustand or Redux)
- components/ – reusable UI building blocks (buttons, modals, header, footer, layout)
- pages/ – route-level views grouped by feature (auth, home, mypage, biz, post, troupe, notice)
- assets/, styles/, types/, utils/ – static assets, global styles, shared types, utility functions
- App.tsx, main.tsx – root and bootstrap of the React application
- Config scripts:
- .eslintrc.cjs – linting rules
- tsconfig*.json – TypeScript configurations

##### README for additional insights
- Confirms React+TS+Vite setup, HMR, plugin recommendations.

##### Elements
- Clear labels: Browser, nginx, React SPA, API Client, Service A (Auth), Service B (Users), etc., CI/CD
- Browser → nginx (GET index.html, static assets)
- React SPA → API services (HTTP calls)
- Jenkins → Docker build → Registry → Deployment

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% CI/CD Pipeline
    subgraph "CI/CD Pipeline" 
        Jenkins["Jenkins"]:::infra
        Package["package.json & lock"]:::infra
        TSConfig["tsconfig.json"]:::infra
        ViteConfig["vite.config.ts"]:::infra
        DockerfileNode["Dockerfile"]:::infra
        Registry["Container Registry"]:::infra
        Deployment["Deployment"]:::infra
    end

    Jenkins -->|build & test| Package
    Jenkins -->|use config| TSConfig
    Jenkins -->|use config| ViteConfig
    Jenkins -->|build image| DockerfileNode
    DockerfileNode -->|push image| Registry
    Registry -->|deploy| Deployment

    %% Container Infrastructure
    subgraph "Container Infrastructure"
        NginxConf["nginx/nginx.conf"]:::infra
        Nginx["nginx Container"]:::infra
    end

    Deployment --> NginxConf
    NginxConf --> Nginx

    %% Runtime Flow
    subgraph "Runtime Environment"
        Browser["Browser Client"]:::client
        Index["index.html"]:::client
        Public["public/ Static Assets"]:::client
    end

    Browser -->|GET| Nginx
    Nginx -->|serves| Index
    Nginx -->|serves| Public

    %% React SPA
    subgraph "React SPA" 
        Main["src/main.tsx"]:::client
        App["src/App.tsx"]:::client
        subgraph "API Client Layer" 
            APIIndex["src/api/index.ts"]:::client
            AuthAPI["src/api/auth/index.tsx"]:::client
            UsersAPI["src/api/users/index.ts"]:::client
            BizAPI["src/api/biz/index.ts"]:::client
            CastAPI["src/api/cast/index.tsx"]:::client
            NoticeAPI["src/api/notice/index.tsx"]:::client
            AdsAPI["src/api/ads/index.ts"]:::client
            TroupeAPI["src/api/troupe/index.tsx"]:::client
        end
        subgraph "State Management Store"
            SessionStore["src/store/session.ts"]:::client
            SearchStore["src/store/search.ts"]:::client
        end
        subgraph "UI Components"
            Components["src/components/"]:::client
        end
        subgraph "Page-Level Views"
            Pages["src/pages/"]:::client
        end
        subgraph "Utilities & Styles"
            Styles["src/styles/GlobalStyle.ts & fonts.css"]:::client
            Types["src/types/"]:::client
            Utils["src/utils/"]:::client
        end
    end

    Index --> Main
    Main --> App
    App --> APIIndex
    App --> SessionStore
    App --> Components
    App --> Pages
    Components --> Pages
    APIIndex --> AuthAPI
    APIIndex --> UsersAPI
    APIIndex --> BizAPI
    APIIndex --> CastAPI
    APIIndex --> NoticeAPI
    APIIndex --> AdsAPI
    APIIndex --> TroupeAPI
    SessionStore --> Pages
    Pages --> Utils
    Pages --> Styles
    Pages --> Types

    %% External Services
    subgraph "External Backend Services"
        AuthService["Auth Service"]:::service
        UsersService["Users Service"]:::service
        BizService["Biz Service"]:::service
        CastService["Cast Service"]:::service
        NoticeService["Notice Service"]:::service
        AdsService["Ads Service"]:::service
        TroupeService["Troupe Service"]:::service
    end

    AuthAPI -->|HTTP| AuthService
    UsersAPI -->|HTTP| UsersService
    BizAPI -->|HTTP| BizService
    CastAPI -->|HTTP| CastService
    NoticeAPI -->|HTTP| NoticeService
    AdsAPI -->|HTTP| AdsService
    TroupeAPI -->|HTTP| TroupeService

    %% Click Events
    click Jenkins "https://github.com/dudn1933/stagecue-fe/tree/main/Jenkinsfile"
    click Package "https://github.com/dudn1933/stagecue-fe/blob/main/package.json"
    click TSConfig "https://github.com/dudn1933/stagecue-fe/blob/main/tsconfig.json"
    click ViteConfig "https://github.com/dudn1933/stagecue-fe/blob/main/vite.config.ts"
    click DockerfileNode "https://github.com/dudn1933/stagecue-fe/tree/main/Dockerfile"
    click NginxConf "https://github.com/dudn1933/stagecue-fe/blob/main/nginx/nginx.conf"
    click Index "https://github.com/dudn1933/stagecue-fe/blob/main/index.html"
    click Public "https://github.com/dudn1933/stagecue-fe/tree/main/public/"
    click Main "https://github.com/dudn1933/stagecue-fe/blob/main/src/main.tsx"
    click App "https://github.com/dudn1933/stagecue-fe/blob/main/src/App.tsx"
    click APIIndex "https://github.com/dudn1933/stagecue-fe/blob/main/src/api/index.ts"
    click AuthAPI "https://github.com/dudn1933/stagecue-fe/blob/main/src/api/auth/index.tsx"
    click UsersAPI "https://github.com/dudn1933/stagecue-fe/blob/main/src/api/users/index.ts"
    click BizAPI "https://github.com/dudn1933/stagecue-fe/blob/main/src/api/biz/index.ts"
    click CastAPI "https://github.com/dudn1933/stagecue-fe/blob/main/src/api/cast/index.tsx"
    click NoticeAPI "https://github.com/dudn1933/stagecue-fe/blob/main/src/api/notice/index.tsx"
    click AdsAPI "https://github.com/dudn1933/stagecue-fe/blob/main/src/api/ads/index.ts"
    click TroupeAPI "https://github.com/dudn1933/stagecue-fe/blob/main/src/api/troupe/index.tsx"
    click SessionStore "https://github.com/dudn1933/stagecue-fe/blob/main/src/store/session.ts"
    click SearchStore "https://github.com/dudn1933/stagecue-fe/blob/main/src/store/search.ts"
    click Components "https://github.com/dudn1933/stagecue-fe/tree/main/src/components/"
    click Pages "https://github.com/dudn1933/stagecue-fe/tree/main/src/pages/"
    click Styles "https://github.com/dudn1933/stagecue-fe/blob/main/src/styles/GlobalStyle.ts"
    click Types "https://github.com/dudn1933/stagecue-fe/tree/main/src/types/"
    click Utils "https://github.com/dudn1933/stagecue-fe/tree/main/src/utils/"
    
    %% Styles
    classDef client fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef infra fill:#98FB98,stroke:#333,stroke-width:1px
    classDef service fill:#FFD700,stroke:#333,stroke-width:1px
```
