# dnd-side-project/dnd-9th-5-frontend architecture

> Architecture diagram of the GitHub repository dnd-side-project/dnd-9th-5-frontend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dnd-side-project/dnd-9th-5-frontend
- Repository: https://github.com/dnd-side-project/dnd-9th-5-frontend

## Overview

##### Main Components
- Client (Browser) & Presentation Layer: Represented by the Next.js front-end running on the client device.
- Next.js App & Routing Structure: The “src/app” directory clearly shows the use of Next13’s App Routing, divided into two major layout groups:
- (Main): Handles the core user-facing features such as Feed (포즈피드), Pick (포즈픽), and Talk (포즈톡).
- (Sub): Handles supportive or additional flows like Auth (login, withdraw), Detail (for individual pose details), and Menu.
- API Layer: The “src/apis” directory encapsulates API configurations and endpoints. There’s a bifurcation between public and private APIs, which shows how the app interacts with backend services.
- Component Library: “src/components” is populated with reusable UI elements (Buttons, Headers, Modals, etc.) which support the presentation logic.
- Global State and Data Fetching: The use of Recoil (for state management) and React Query (for server state, caching and data synchronization) is supported by “src/provider” and “src/hooks” directories.

##### Relationships and Data Flow
- The Client (Browser) renders the Next.js application and interacts with UI components.
- User requests are routed through the Next.js App “app” folder, where the (Main) and (Sub) directories handle different routing contexts (e.g., feed pages, auth flows, detail views).
- API calls from the Presentation Layer are executed via the API layer (using modules in “src/apis”), where different configurations (publicApi.ts and privateApi.ts) manage external and internal data interactions using Axios.
- Global Providers (RecoilProvider, QueryProvider, and HydrationProvider from “src/provider”) wrap the application to ensure state management and server data fetching across pages.
- All UI components interact with these providers and hooks to manage local and global state, and execute API calls.

##### Architectural Patterns and Design Principles
- Component-Based Architecture: The project is modular, with reusable components for UI elements, overlays, modals, etc.
- Separation of Concerns: Clear distinction between API logic (src/apis), UI components (src/components), application routes/layouts (src/app), and utilities/constants.
- Modern Next.js Techniques: Implements Next13 app routing, making use of file system-based routing and layouts to segregate major functionalities.
- State and Data Management: Utilizes Recoil for local state and React Query for server state management, ensuring scalable and reactive data fetching strategies.

##### Specific Technologies & Libraries
- Next.js (+ App Routing)
- TypeScript (Global type checking with “global.d.ts” and “next-env.d.ts”)
- Tailwind CSS (via “tailwind.config.js” and styles in “styles”)
- Recoil (state management)
- React Query (data fetching)
- Axios (for API requests)

## Diagram (Mermaid)

```mermaid
flowchart TD
    C("Client (Browser)"):::frontend
    N("Next.js App"):::frontend
    subgraph "App Routing Structure"
        M["(Main) Layout"]:::frontend
        S["(Sub) Layout"]:::frontend
    end
    U("UI Components"):::component
    A("API Layer"):::api
    subgraph "API Endpoints"
        P["Public API Configuration"]:::api
        R["Private API Configuration"]:::api
    end
    G("Global Providers"):::provider
    H("Custom Hooks"):::provider
    T("Assets & Styling"):::assets

    C -->|"UserRequest"| N
    N -->|"Routing"| M
    N -->|"Routing"| S
    M -->|"APIRequest"| A
    S -->|"APIRequest"| A
    A -->|"Uses"| P
    A -->|"Uses"| R
    N -->|"Renders"| U
    T -->|"Styles"| U
    G -->|"ProvidesState"| N
    G -->|"SuppliesData"| U
    H -->|"EnablesData"| G

    click C "https://github.com/dnd-side-project/dnd-9th-5-frontend/tree/develop/src/app"
    click M "https://github.com/dnd-side-project/dnd-9th-5-frontend/tree/develop/src/app/(Main)"
    click S "https://github.com/dnd-side-project/dnd-9th-5-frontend/tree/develop/src/app/(Sub)"
    click A "https://github.com/dnd-side-project/dnd-9th-5-frontend/tree/develop/src/apis"
    click P "https://github.com/dnd-side-project/dnd-9th-5-frontend/blob/develop/src/apis/config/publicApi.ts"
    click R "https://github.com/dnd-side-project/dnd-9th-5-frontend/blob/develop/src/apis/config/privateApi.ts"
    click U "https://github.com/dnd-side-project/dnd-9th-5-frontend/tree/develop/src/components"
    click G "https://github.com/dnd-side-project/dnd-9th-5-frontend/tree/develop/src/provider"
    click H "https://github.com/dnd-side-project/dnd-9th-5-frontend/tree/develop/src/hooks"
    click T "https://github.com/dnd-side-project/dnd-9th-5-frontend/tree/develop/public and styles"

    classDef frontend fill:#d1e8ff,stroke:#333,stroke-width:2px;
    classDef api fill:#ffcccc,stroke:#333,stroke-width:2px;
    classDef provider fill:#ccffcc,stroke:#333,stroke-width:2px;
    classDef component fill:#fff3cd,stroke:#333,stroke-width:2px;
    classDef assets fill:#dddddd,stroke:#333,stroke-width:2px;
```
