# heeyeon205/newsion-client architecture

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

- Interactive diagram: https://gitdiagram.com/heeyeon205/newsion-client
- Repository: https://github.com/heeyeon205/newsion-client

## Overview

##### Project type and purpose
- This is a React-based single-page application (SPA) built with Vite.
- Purpose: A “NEWSION” preview platform combining news, user-generated articles, message boards, polls, AI chat, and admin/user management. It consumes a backend API (authentication, CRUD, SSE) and integrates with external services (AI, social login).

##### File structure
- Top-level:
- index.html, public/ → Static assets;
- src/ → All React code;
- vite.config.js → Build configuration;
- package-lock.json, eslint.config.js → Tooling.
- src/api/axios.js → Centralized HTTP client.
- src/store/ → Global state hooks (e.g., user/session via Zustand or similar).
- src/routes/ → Layout, header/footer components and navigation.
- src/pages/ → Feature modules organized by domain: user, news, board, article, poll, notice, mypage, admin, AI.
- src/utils/ → Shared utilities (formatters, token checks, SSE notification, infinite scroll).

##### Elements
- From React pages → Axios client → Backend REST endpoints.
- From Backend → Database (read/write).
- From Backend → SSE → Client.
- From Client/Backend → External services.
- API & services in another.
- Data stores in a third.
- External dependencies in a fourth.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Side
    subgraph "Client (React SPA)"
        direction TB
        subgraph Entry
            Main["src/main.jsx"]:::ui
            App["src/App.jsx"]:::ui
        end
        subgraph "Routing Layer"
            Layout["Layout.jsx"]:::ui
            Header["Header.jsx"]:::ui
            Footer["Footer.jsx"]:::ui
        end
        subgraph "API Client"
            Axios["axios.js"]:::api
        end
        subgraph "Global State Store"
            GlobalStore["useGlobalStore.js"]:::store
            UserStore["useUserStore.js"]:::store
        end
        subgraph "Feature Pages"
            direction TB
            subgraph User
                Auth["Authentication.jsx"]:::feature
                Login["Login.jsx"]:::feature
                Join["Join.jsx"]:::feature
                FindPass["FindPassword.jsx"]:::feature
            end
            subgraph News
                NewsMain["Main.jsx"]:::feature
                NewsDetail["NewsDetailPage.jsx"]:::feature
            end
            subgraph Board
                BoardMain["BoardMainPage.jsx"]:::feature
                BoardDetail["BoardDetailPage.jsx"]:::feature
            end
            subgraph Article
                ArticleMain["ArticleMainPage.jsx"]:::feature
            end
            subgraph Poll
                PollCreate["PollCreatePage.jsx"]:::feature
                PollDetail["PollDetailPage.jsx"]:::feature
            end
            subgraph Notice
                Notice["Notice.jsx"]:::feature
            end
            subgraph MyPage
                Mypage["Mypage.jsx"]:::feature
            end
            subgraph Admin
                AdminMain["AdminMainPage.jsx"]:::feature
            end
            subgraph AI
                GptMain["GptMainPage.jsx"]:::feature
            end
        end
        subgraph "Shared Utilities"
            FormatDate["FormatDate.js"]:::util
            TokenCheck["TokenCheck.js"]:::util
            NotificationSSE["NotificationSSE.jsx"]:::util
        end
    end

    %% Backend Side
    subgraph "Backend API"
        direction TB
        AuthService["Auth Service"]:::service
        ContentService["News/Board/Article/Poll Controllers"]:::service
        SSEService["Notification SSE Service"]:::service
        AdminService["Admin Service"]:::service
    end

    %% Data Layer
    subgraph "Database"
        DB["PostgreSQL / MongoDB"]:::data
    end

    %% External Services
    subgraph "External Services"
        AIService["OpenAI API"]:::external
        OAuth["OAuth Providers"]:::external
        CDN["Font CDN"]:::external
    end

    %% Connections
    Auth -->|routes| Axios
    Login -->|routes| Axios
    Join -->|routes| Axios
    FindPass -->|routes| Axios
    NewsMain -->|requests| Axios
    NewsDetail -->|requests| Axios
    BoardMain -->|requests| Axios
    BoardDetail -->|requests| Axios
    ArticleMain -->|requests| Axios
    PollCreate -->|requests| Axios
    PollDetail -->|requests| Axios
    Notice -->|requests| Axios
    Mypage -->|requests| Axios
    AdminMain -->|requests| Axios
    GptMain -->|requests| Axios

    GlobalStore -->|manages| Axios
    GlobalStore -->|subscribes| NotificationSSE
    NotificationSSE -->|SSE connect| SSEService

    Axios -->|REST calls| AuthService
    Axios -->|REST calls| ContentService
    Axios -->|REST calls| AdminService
    Axios -->|proxy AI calls| AIService
    AuthService -->|read/write| DB
    ContentService -->|read/write| DB
    AdminService -->|read/write| DB
    SSEService -->|reads| DB
    SSEService -->|push events| NotificationSSE

    Login -->|OAuth flow| OAuth
    OAuth -->|callback| AuthService

    Main --> App
    App --> Layout
    Layout --> Header
    Layout --> Footer
    Layout --> GlobalStore
    Layout --> UserStore
    App --> NotificationSSE
    App --> Axios

    %% Click Events
    click Main "https://github.com/heeyeon205/newsion-client/blob/main/src/main.jsx"
    click App "https://github.com/heeyeon205/newsion-client/blob/main/src/App.jsx"
    click Layout "https://github.com/heeyeon205/newsion-client/blob/main/src/routes/Layout.jsx"
    click Header "https://github.com/heeyeon205/newsion-client/blob/main/src/routes/Header.jsx"
    click Footer "https://github.com/heeyeon205/newsion-client/blob/main/src/routes/Footer.jsx"
    click Axios "https://github.com/heeyeon205/newsion-client/blob/main/src/api/axios.js"
    click GlobalStore "https://github.com/heeyeon205/newsion-client/blob/main/src/store/useGlobalStore.js"
    click UserStore "https://github.com/heeyeon205/newsion-client/blob/main/src/store/useUserStore.js"
    click Auth "https://github.com/heeyeon205/newsion-client/blob/main/src/pages/user/Authentication.jsx"
    click Login "https://github.com/heeyeon205/newsion-client/blob/main/src/pages/user/Login.jsx"
    click Join "https://github.com/heeyeon205/newsion-client/blob/main/src/pages/user/Join.jsx"
    click FindPass "https://github.com/heeyeon205/newsion-client/blob/main/src/pages/user/FindPassword.jsx"
    click NewsMain "https://github.com/heeyeon205/newsion-client/blob/main/src/pages/news/Main.jsx"
    click NewsDetail "https://github.com/heeyeon205/newsion-client/blob/main/src/pages/news/NewsDetailPage.jsx"
    click BoardMain "https://github.com/heeyeon205/newsion-client/blob/main/src/pages/board/BoardMainPage.jsx"
    click BoardDetail "https://github.com/heeyeon205/newsion-client/blob/main/src/pages/board/BoardDetailPage.jsx"
    click ArticleMain "https://github.com/heeyeon205/newsion-client/blob/main/src/pages/article/ArticleMainPage.jsx"
    click PollCreate "https://github.com/heeyeon205/newsion-client/blob/main/src/pages/poll/PollCreatePage.jsx"
    click PollDetail "https://github.com/heeyeon205/newsion-client/blob/main/src/pages/poll/PollDetailPage.jsx"
    click Notice "https://github.com/heeyeon205/newsion-client/blob/main/src/pages/notice/Notice.jsx"
    click Mypage "https://github.com/heeyeon205/newsion-client/blob/main/src/pages/mypage/Mypage.jsx"
    click AdminMain "https://github.com/heeyeon205/newsion-client/blob/main/src/pages/admin/AdminMainPage.jsx"
    click GptMain "https://github.com/heeyeon205/newsion-client/blob/main/src/pages/AI/GptMainPage.jsx"
    click FormatDate "https://github.com/heeyeon205/newsion-client/blob/main/src/utils/FormatDate.js"
    click TokenCheck "https://github.com/heeyeon205/newsion-client/blob/main/src/utils/TokenCheck.js"
    click NotificationSSE "https://github.com/heeyeon205/newsion-client/blob/main/src/utils/NotificationSSE.jsx"

    %% Styles
    classDef ui fill:#e0f7fa,stroke:#00838f
    classDef api fill:#ffe0b2,stroke:#ef6c00
    classDef store fill:#f3e5f5,stroke:#6a1b9a
    classDef feature fill:#e8f5e9,stroke:#2e7d32
    classDef util fill:#fff3e0,stroke:#f57c00
    classDef service fill:#e1bee7,stroke:#8e24aa
    classDef data fill:#c8e6c9,stroke:#388e3c
    classDef external fill:#d7ccc8,stroke:#5d4037
```
