# just-codingbaby/3-3team-favorite-photo-fe architecture

> Architecture diagram of the GitHub repository just-codingbaby/3-3team-favorite-photo-fe, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/just-codingbaby/3-3team-favorite-photo-fe
- Repository: https://github.com/just-codingbaby/3-3team-favorite-photo-fe

## Overview

##### Main System Components

A. Client Layer
- Browser/User Interface
- Next.js Runtime

B. Application Layer
- Pages Router
- Component Layer
- State Management
- API Integration

C. External Systems
- Backend API Service
- Authentication Service

##### Detailed Component Breakdown

A. Core Application Structure:
- Pages Layer
- Public Pages (/, /login, /signup)
- Protected Pages (/market, /mygallery)
- Dynamic Routes ([id])

B. Component Architecture:
- Shared Components
- UI Components
- Layout Components
- Form Components
- Feature Components
- Market
- Gallery
- Authentication

##### Data Flow Representation

- Client-side routing (Next.js Pages → Components)
- API calls (Components → External API)
- State management flow (Context → Components)
- Authentication flow (Login/Signup → Auth Provider → Protected Routes)

##### Key Technical Elements to Highlight

- Authentication Context (AuthProvider.jsx)
- API Integration Layer (lib/axios.js)
- Custom Hooks Layer (hooks/)
- Shared UI Components (components/shared/)

**┌─────────────────────────────────────────────┐**
- Client Browser               │
- ┤
- Next.js Runtime                │
- ┬──────────────┬──────────────┤
- Pages Router│  Components  │    Hooks     │
- ┴──────────────┴──────────────┤
- API Integration Layer            │
- ┤
- External Services                │
- ┘

##### Implementation Notes

- Annotations for key architectural decisions
- Relationship between pages and their corresponding components

##### Additional Details

Specific callouts for:
- Tailwind CSS integration
- Form handling patterns
- Modal management
- Image handling
- API error handling

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client["Client Layer"]
        Browser["Browser/User Interface"]
        NextRuntime["Next.js Runtime"]
    end

    subgraph AppLayer["Application Layer"]
        subgraph Pages["Pages Router"]
            PublicPages["Public Pages"]:::pages
            ProtectedPages["Protected Pages"]:::pages
            DynamicRoutes["Dynamic Routes"]:::pages
        end

        subgraph Components["Component Layer"]
            subgraph SharedComp["Shared Components"]
                UIComp["UI Components"]:::ui
                LayoutComp["Layout Components"]:::ui
                FormComp["Form Components"]:::ui
            end

            subgraph FeatureComp["Feature Components"]
                MarketComp["Market Components"]:::feature
                GalleryComp["Gallery Components"]:::feature
                AuthComp["Auth Components"]:::feature
            end
        end

        subgraph State["State Management"]
            AuthContext["Auth Context"]:::state
            CustomHooks["Custom Hooks"]:::state
        end

        subgraph Integration["API Integration"]
            AxiosSetup["Axios Setup"]:::api
            APIConstants["API Constants"]:::api
            QueryKeys["Query Keys"]:::api
        end

        subgraph Modal["Modal System"]
            BaseModal["Base Modal"]:::ui
            ModalWrapper["Modal Wrapper"]:::ui
            ExchangeModal["Exchange Modal"]:::ui
        end
    end

    subgraph External["External Systems"]
        BackendAPI["Backend API Service"]:::external
        AuthService["Authentication Service"]:::external
    end

    %% Relationships
    Browser --> NextRuntime
    NextRuntime --> Pages
    Pages --> Components
    Components --> State
    State --> Integration
    Integration --> External

    %% Component Relationships
    PublicPages --> AuthComp
    ProtectedPages --> MarketComp
    ProtectedPages --> GalleryComp
    MarketComp --> Modal
    GalleryComp --> SharedComp
    AuthComp --> AuthContext

    %% Click Events
    click PublicPages "https://github.com/just-codingbaby/3-3team-favorite-photo-fe/blob/develop/src/pages/login.jsx"
    click ProtectedPages "https://github.com/just-codingbaby/3-3team-favorite-photo-fe/blob/develop/src/pages/market/index.jsx"
    click DynamicRoutes "https://github.com/just-codingbaby/3-3team-favorite-photo-fe/blob/develop/src/pages/market/[id].jsx"
    click AuthContext "https://github.com/just-codingbaby/3-3team-favorite-photo-fe/blob/develop/src/contexts/AuthProvider.jsx"
    click MarketComp "https://github.com/just-codingbaby/3-3team-favorite-photo-fe/tree/develop/src/components/market"
    click GalleryComp "https://github.com/just-codingbaby/3-3team-favorite-photo-fe/tree/develop/src/components/mygallery"
    click UIComp "https://github.com/just-codingbaby/3-3team-favorite-photo-fe/tree/develop/src/components/ui"
    click LayoutComp "https://github.com/just-codingbaby/3-3team-favorite-photo-fe/blob/develop/src/components/layout.js"
    click FormComp "https://github.com/just-codingbaby/3-3team-favorite-photo-fe/blob/develop/src/components/ui/form.jsx"
    click AxiosSetup "https://github.com/just-codingbaby/3-3team-favorite-photo-fe/blob/develop/src/lib/axios.js"
    click APIConstants "https://github.com/just-codingbaby/3-3team-favorite-photo-fe/blob/develop/src/pages/api/api.js"
    click QueryKeys "https://github.com/just-codingbaby/3-3team-favorite-photo-fe/blob/develop/src/lib/queryKeys.js"
    click BaseModal "https://github.com/just-codingbaby/3-3team-favorite-photo-fe/blob/develop/src/components/modal.jsx"
    click ModalWrapper "https://github.com/just-codingbaby/3-3team-favorite-photo-fe/blob/develop/src/components/market/cardDetail/ModalWrapper.jsx"
    click ExchangeModal "https://github.com/just-codingbaby/3-3team-favorite-photo-fe/blob/develop/src/components/market/cardDetail/ModalExchange.jsx"
    click CustomHooks "https://github.com/just-codingbaby/3-3team-favorite-photo-fe/blob/develop/src/hooks/useHook.js"

    %% Styles
    classDef pages fill:#2563eb,color:white
    classDef ui fill:#fbbf24,color:black
    classDef feature fill:#22c55e,color:white
    classDef state fill:#9333ea,color:white
    classDef api fill:#0891b2,color:white
    classDef external fill:#dc2626,color:white

    %% Legend
    subgraph Legend
        L1[Pages]:::pages
        L2[UI Components]:::ui
        L3[Feature Components]:::feature
        L4[State Management]:::state
        L5[API Layer]:::api
        L6[External Services]:::external
    end
```
