# 55soup/itshow-voiceflow architecture

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

- Interactive diagram: https://gitdiagram.com/55soup/itshow-voiceflow
- Repository: https://github.com/55soup/itshow-voiceflow

## Overview

##### Main Components
- Frontend (Client):
- React application: Located in the “client” directory. This includes various pages (e.g., GameStart, Intro, ScoreRank) and components (e.g., Alien, Frame, Timer, Button variants) that present different game interfaces.
- Assets: The “public” folder includes static assets – images, video, audio files, and pre-loaded face detection model files.
- Interaction Modules: Components using react-speech-kit for voice-to-text and face-api.js for detecting facial orientations.

- Backend (Server):
- Node/Express Server: Found in “server/server.js” which handles API endpoints for game functionality.
- Database Integration: Although you may not see explicit connection details in the file tree, the README and badges (MongoDB) suggest that the server uses MongoDB to store score data (as indicated in the “점수입력” section).

- External Dependencies and Services:
- Third-party libraries: face-api.js and react-speech-kit are integral to the gameplay.
- Database: MongoDB, used for storing scores.
- Client-to-server communication: The API layer where the client submits data (e.g., scores).

##### Relationships and Interactions
- The frontend communicates with the backend via REST API calls or similar endpoints to insert and retrieve score data.
- The voice recognition and face detection modules primarily act on the client side to capture user input and determine game interactions.
- The backend receives score submissions, validates them (e.g., using regex checks mentioned in the README for telephone format), and writes them to MongoDB.
- There is a clear data flow from user interactions (speech and gestures) in the client, processed by built-in components, eventually resulting in data transaction with the server.

##### Architectural Patterns and Design Principles
- Separation of Concerns: The client and server are cleanly separated into two directories, each with its own package management. This indicates a modular design.
- Component-Based UI: The React client employs a component and page structure, often following the patterns similar to MVC on the view layer.
- API-Driven Communication: The server operates as a backend service that exposes endpoints for processing game logic related data (like score updates), adhering to RESTful API principles.
- Integration of Third-Party Services: Emphasis on the integration of specialized libraries (face-api.js, react-speech-kit) to handle specific multimedia/interaction tasks.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Frontend (Client)"
        FE1["React Application (client)"]:::frontend
        FE2["UI Components (Pages)"]:::ui
        FE3["Interaction Components (Voice & Face Detection)"]:::interaction
        FE4["Static Assets (Public)"]:::assets
        FE1 -->|"contains"| FE2
        FE1 -->|"contains"| FE3
        FE1 -->|"contains"| FE4
    end

    subgraph "Backend (Server)"
        BE1["API Server (Node/Express)"]:::backend
        BE2["Business Logic & Score Validation"]:::backend_logic
        BE1 -->|"processes"| BE2
    end

    subgraph "Database"
        DB["MongoDB"]:::database
    end

    FE1 -->|"APICalls"| BE1
    BE1 -->|"storesData"| DB

    EX1["face-api.js"]:::external
    EX2["react-speech-kit"]:::external
    FE3 -->|"integrates"| EX1
    FE3 -->|"integrates"| EX2

    click FE1 "https://github.com/55soup/itshow-voiceflow/tree/main/client/"
    click FE2 "https://github.com/55soup/itshow-voiceflow/tree/main/client/src/pages"
    click FE3 "https://github.com/55soup/itshow-voiceflow/tree/main/client/src/components"
    click FE4 "https://github.com/55soup/itshow-voiceflow/tree/main/client/public"
    click BE1 "https://github.com/55soup/itshow-voiceflow/blob/main/server/server.js"

    classDef frontend fill:#b3cde0,stroke:#03396c,stroke-width:2px;
    classDef ui fill:#ccebc5,stroke:#2b9348,stroke-width:2px;
    classDef interaction fill:#decbe4,stroke:#6a4c93,stroke-width:2px;
    classDef assets fill:#fbb4ae,stroke:#d9534f,stroke-width:2px;
    classDef backend fill:#fdae61,stroke:#e6550d,stroke-width:2px;
    classDef backend_logic fill:#fee08b,stroke:#fdae61,stroke-width:2px;
    classDef external fill:#ffffcc,stroke:#ffcc00,stroke-width:2px;
    classDef database fill:#e3e3e3,stroke:#999,stroke-width:2px;
```
