# make-a-wish-sopt/make-a-wish-client architecture

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

- Interactive diagram: https://gitdiagram.com/make-a-wish-sopt/make-a-wish-client
- Repository: https://github.com/make-a-wish-sopt/make-a-wish-client

## Overview

##### Project Purpose and Type
- This is a Next.js full-stack application. Its goal is to allow users to create, read, update, and delete “wish” posts while integrating external services like Kakao for social login and handling account (bank) verification.
- The application provides a user-friendly interface for both wish posting (“선물” and “소원”) and managing user profiles (mypage), along with handling media assets.

##### Main Components in the Architecture
- Frontend (UI and Presentation):
- Pages and Routing: The “src/app” directory contains pages (e.g., home, login, wish detail, present, mypage) and nested routes which leverage Next.js routing capabilities.
- Domain & Components: The “src/domain” folders (for example, wishes, present, login, mypage) encapsulate feature-specific logic. Reusable UI components are located in “src/components” (like Button, Modal, Calendar, etc.) and “src/layouts” for consistent page layout.
- Styling & Configuration: Tailwind CSS and global style files (under src/styles and tailwind.config.js) define the look-and-feel.

- API Layer and Server-Side Logic:
- API Endpoints: There are two places for API logic. One is under “src/api” – traditional API abstraction files for auth, cakes, files, etc. The other is using Next.js serverless routes in “src/app/api” (for cookies, Kakao login/logout, paycode, etc.).
- External Integration: Routes for Kakao login indicate that authentication and authorization are handled by external OAuth services. Additionally, bank account verification may be integrated here.

- Infrastructure and Assets:
- Configuration: Files like next.config.mjs, package.json, eslint, prettier settings, and TypeScript configuration (tsconfig.json) indicate build, code style, and development properties.
- Testing: The “src/__test__” directory along with Jest configuration files (jest.config.ts, jest.setup.ts) show that unit and integration tests are part of the project.

##### Relationships and Data Flow
- User interactions with frontend pages (rendered by components and domain layers) trigger actions that ultimately make HTTP requests to the Next.js API endpoints.
- API endpoints process business logic (e.g., wish CRUD operations, Kakao OAuth flows, and account verification) and then communicate with any external services (Kakao OAuth, bank APIs, etc.).
- The static assets (from the public folder) and dynamic content rendered by React components ensure a responsive UI.
- Shared utilities (under src/utils, src/hooks, src/validation) support common functionality and input validation, providing a cohesive interaction between different layers.

##### Architectural Patterns & Design Principles
- Separation of concerns is observed by dividing the project into “presentation” (app, components, layouts), “business logic” (domain folders and services), and “API/data” (src/api, app/api routes).
- Modular design is leveraged so that specific features (e.g., wishes, present, mypage) are encapsulated in their own folder, enabling easier scalability and maintenance.
- Use of Next.js serverless functions (route.ts, page.tsx) minimizes the backend footprint while keeping the user experience unified within one codebase.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Global Entities
    User("User"):::external

    %% Presentation Layer
    subgraph "Presentation Layer"
        pages("Pages & Routing"):::frontend
        components("UI Components"):::frontend
        layout("Main Layout"):::frontend
        subgraph "Domain Features"
            wishes("Wishes Feature"):::frontend
            present("Present Feature"):::frontend
            login("Login & Kakao Integration"):::frontend
            kakaoPage("Kakao Login Page"):::frontend
            mypage("MyPage & Account Management"):::frontend
        end
        utilities("Shared Utilities"):::frontend
        hooks("Form & State Hooks"):::frontend
        styling("Styling & Global Styles"):::frontend
        tailwind("Tailwind Config"):::frontend
    end

    %% API / Server-Side Layer
    subgraph "API/Server-Side Layer"
        apiAbs("API Abstractions"):::api
        subgraph "Next.js Serverless API Routes"
            cookies("Cookies Management"):::api
            kakaoLogin("Kakao Auth Login"):::api
            kakaoLogout("Kakao Auth Logout"):::api
            kakaoPaycode("Kakao Paycode"):::api
        end
    end

    %% External Services
    subgraph "External Services"
        kakaoOAuth("Kakao OAuth Service"):::external
        paymentVer("Payment & Bank Verification"):::external
    end

    %% Static Assets
    subgraph "Static Assets"
        publicAssets("Public Assets"):::assets
        publicFonts("Public Fonts"):::assets
        manifest("Manifest File"):::assets
    end

    %% Testing & Configuration
    subgraph "Testing & Configuration"
        testing("Automated Tests"):::test
        wishesTest("Wishes Create Test"):::test
    end

    %% Relationships and Data Flows
    User -->|"initiates"| pages
    pages -->|"renders"| components
    pages -->|"wraps with"| layout

    pages -->|"navigates"| wishes
    pages -->|"navigates"| present
    pages -->|"navigates"| login
    pages -->|"navigates"| mypage

    %% Domain Features invoking API calls
    wishes -->|"CRUD_ops"| apiAbs
    present -->|"payment_req"| apiAbs
    login -->|"auth_req"| apiAbs
    mypage -->|"account_update"| apiAbs

    %% API Abstractions calling Serverless Routes
    apiAbs -->|"delegates"| cookies
    apiAbs -->|"delegates"| kakaoLogin
    apiAbs -->|"delegates"| kakaoLogout
    apiAbs -->|"delegates"| kakaoPaycode

    %% Serverless Routes communicating to External Services
    kakaoLogin -->|"calls"| kakaoOAuth
    kakaoLogout -->|"calls"| kakaoOAuth
    kakaoPaycode -->|"calls"| paymentVer

    %% Assets used by Frontend
    pages ---|"loads"| publicAssets

    %% Domain Features using Utilities & Hooks
    wishes ---|"uses"| utilities
    wishes ---|"uses"| hooks
    present ---|"uses"| utilities
    present ---|"uses"| hooks
    login ---|"uses"| utilities
    login ---|"uses"| hooks
    mypage ---|"uses"| utilities
    mypage ---|"uses"| hooks

    %% Styling associations
    pages ---|"styled_by"| styling
    components ---|"styled_by"| styling
    styling ---|"configured_by"| tailwind

    %% Testing relationships
    testing ---|"tests"| pages
    wishesTest ---|"tests"| wishes

    %% Additional Domain Navigation
    login -->|"redirects_to"| kakaoPage

    %% Styles
    classDef frontend fill:#a6e1fa,stroke:#333,stroke-width:2px;
    classDef api fill:#ffdd91,stroke:#333,stroke-width:2px;
    classDef external fill:#f6c1c1,stroke:#333,stroke-width:2px;
    classDef assets fill:#d5f5e3,stroke:#333,stroke-width:2px;
    classDef test fill:#e2b4c7,stroke:#333,stroke-width:2px;

    %% Click Events
    click pages "https://github.com/make-a-wish-sopt/make-a-wish-client/tree/main/src/app"
    click components "https://github.com/make-a-wish-sopt/make-a-wish-client/tree/main/src/components"
    click layout "https://github.com/make-a-wish-sopt/make-a-wish-client/blob/main/src/layouts/MainLayout.tsx"
    click wishes "https://github.com/make-a-wish-sopt/make-a-wish-client/tree/main/src/domain/wishes"
    click present "https://github.com/make-a-wish-sopt/make-a-wish-client/tree/main/src/domain/present"
    click login "https://github.com/make-a-wish-sopt/make-a-wish-client/tree/main/src/domain/login"
    click kakaoPage "https://github.com/make-a-wish-sopt/make-a-wish-client/blob/main/src/app/login/oauth2/code/kakao/page.tsx"
    click mypage "https://github.com/make-a-wish-sopt/make-a-wish-client/tree/main/src/domain/mypage"
    click apiAbs "https://github.com/make-a-wish-sopt/make-a-wish-client/tree/main/src/api"
    click cookies "https://github.com/make-a-wish-sopt/make-a-wish-client/blob/main/src/app/api/cookies/route.ts"
    click kakaoLogin "https://github.com/make-a-wish-sopt/make-a-wish-client/blob/main/src/app/api/kakao/login/route.ts"
    click kakaoLogout "https://github.com/make-a-wish-sopt/make-a-wish-client/blob/main/src/app/api/kakao/logout/route.ts"
    click kakaoPaycode "https://github.com/make-a-wish-sopt/make-a-wish-client/blob/main/src/app/api/kakao/paycode/route.ts"
    click publicAssets "https://github.com/make-a-wish-sopt/make-a-wish-client/tree/main/public/assets"
    click publicFonts "https://github.com/make-a-wish-sopt/make-a-wish-client/tree/main/public/fonts"
    click manifest "https://github.com/make-a-wish-sopt/make-a-wish-client/blob/main/public/manifest.json"
    click utilities "https://github.com/make-a-wish-sopt/make-a-wish-client/tree/main/src/utils"
    click hooks "https://github.com/make-a-wish-sopt/make-a-wish-client/tree/main/src/hooks"
    click styling "https://github.com/make-a-wish-sopt/make-a-wish-client/tree/main/src/styles"
    click tailwind "https://github.com/make-a-wish-sopt/make-a-wish-client/blob/main/tailwind.config.js"
    click testing "https://github.com/make-a-wish-sopt/make-a-wish-client/tree/main/src/__test__"
    click wishesTest "https://github.com/make-a-wish-sopt/make-a-wish-client/blob/main/src/__test__/wishes/WishesCreatePage__1.spec.tsx"
    click paymentVer "https://github.com/make-a-wish-sopt/make-a-wish-client/blob/main/src/domain/present/[wishId]/payment.tsx"
    click paymentVer "https://github.com/make-a-wish-sopt/make-a-wish-client/tree/main/src/domain/mypage/edit/deposit"
```
