# woowacourse-teams/2024-pengcook architecture

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

- Interactive diagram: https://gitdiagram.com/woowacourse-teams/2024-pengcook
- Repository: https://github.com/woowacourse-teams/2024-pengcook

## Overview

##### Project Type and Purpose
- PengCook is a full-stack social-media application for sharing and discovering recipes.
- It comprises:
- Android mobile client (Kotlin)
- Java/Spring-Boot backend API
- Persistent storage (relational database)
- Documentation and CI/CD workflows

##### File-Structure Analysis
- Top-level directories:
- android/ – Android app source
- backend/ – Spring Boot service
- docs/ – Markdown docs (architecture, user guide)
- .github/ – issue templates and CI workflows
- Patterns & conventions:
- `android/` likely follows MVVM or MVP with Retrofit for REST calls
- `backend/` likely uses MVC (Controllers → Services → Repositories)
- CI workflows automate builds/tests for both client & server

##### Insights from README
- Tech stack badges confirm Android/Kotlin client and Java/Spring backend
- Feature set: home feed, search, categories, profiles, recipe posting, step-by-step views

a. Main Components
- Android Mobile App
- API Gateway / Load Balancer (optional)
- Spring Boot Backend
- Relational Database (e.g., MySQL/PostgreSQL)
- External Services (e.g., Instagram/YouTube analytics or OAuth)
b. Relationships & Data Flow
1. User taps in Android → ViewModel issues Retrofit call
2. Request hits API Gateway → routed to Spring Boot Controller
3. Controller invokes Service layer → Repository layer → Database
4. Response bubbles back through Service → Controller → mobile client
5. Optional: Backend pushes notifications or media to external social-media APIs
c. Architectural Patterns
- Android: MVVM (Activity/Fragment ↔ ViewModel ↔ Repository)
- Backend: Layered (Controller → Service → Repository)
- RESTful API, JSON over HTTPS
- Transactional boundaries at service methods
d. Key Technologies
- Android: Kotlin, Jetpack, Retrofit, Room or direct SQL?
- Backend: Spring Boot, Spring Data JPA, H2/MySQL, Swagger/OpenAPI for docs
- CI/CD: GitHub Actions for building & testing

##### Diagramming Recommendations
- Client components (blue rectangles)
- Server components (green rectangles)
- External services (gray clouds)
- Related components within containers (e.g., “Android App Module”)
- Asynchronous flows (e.g., push notifications)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Android Client Layer
    subgraph "Android App Module"
        direction TB
        UI["UI (Activity/Fragment)"]:::client
        VM["ViewModel"]:::client
        RepoMobile["Mobile Repository"]:::client
        Retrofit["Retrofit API"]:::client
    end

    %% Backend Server Layer
    subgraph "Spring Boot Backend Service"
        direction TB
        Controller["RecipeController"]:::server
        Service["RecipeService"]:::server
        Repo["RecipeRepository"]:::server
    end

    %% Database
    Database["Relational Database"]:::db

    %% External Services
    External["Social Media APIs"]:::external

    %% Documentation and CI/CD
    DocsEN["docs/README.md"]:::docs
    DocsKO["docs/ko.md"]:::docs
    CI["CI/CD Workflows"]:::docs
    Issues["Issue Templates"]:::docs

    %% Data Flows
    UI -->|"calls ViewModel"| VM
    VM -->|"fetchData() via Repo"| RepoMobile
    RepoMobile -->|"HTTP GET /recipes"| Retrofit
    Retrofit -->|"GET /recipes"| Controller
    Controller -->|"calls Service"| Service
    Service -->|"calls Repository"| Repo
    Repo -->|"CRUD operations"| Database
    Service -->|"push notifications"| External
    Controller -->|"returns JSON"| Retrofit

    %% CI/CD and Docs Relations
    CI -->|"build & test"| UI
    CI -->|"build & test"| Controller
    Issues -->|"trigger branches"| CI

    %% Click Events
    click UI "https://github.com/woowacourse-teams/2024-pengcook/tree/main/android/"
    click VM "https://github.com/woowacourse-teams/2024-pengcook/tree/main/android/"
    click RepoMobile "https://github.com/woowacourse-teams/2024-pengcook/tree/main/android/"
    click Retrofit "https://github.com/woowacourse-teams/2024-pengcook/tree/main/android/"
    click Controller "https://github.com/woowacourse-teams/2024-pengcook/tree/main/backend/"
    click Service "https://github.com/woowacourse-teams/2024-pengcook/tree/main/backend/"
    click Repo "https://github.com/woowacourse-teams/2024-pengcook/tree/main/backend/"
    click Database "https://github.com/woowacourse-teams/2024-pengcook/tree/main/backend/"
    click DocsEN "https://github.com/woowacourse-teams/2024-pengcook/blob/main/docs/README.md"
    click DocsKO "https://github.com/woowacourse-teams/2024-pengcook/blob/main/docs/ko.md"
    click CI "https://github.com/woowacourse-teams/2024-pengcook/blob/main/.github/workflows/issue-automation.yaml"
    click Issues "https://github.com/woowacourse-teams/2024-pengcook/blob/main/.github/issue-branch.yaml"

    %% Styles
    classDef client fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef server fill:#90EE90,stroke:#333,stroke-width:1px
    classDef db fill:#FFD700,stroke:#333,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef docs fill:#F5DEB3,stroke:#333,stroke-width:1px
```
