# olhasmy/mesto architecture

> Architecture diagram of the GitHub repository olhasmy/mesto, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/olhasmy/mesto
- Repository: https://github.com/olhasmy/mesto

## Overview

Mesto is an interactive web app for viewing and managing a user profile and place cards. The main workflow loads the user and cards from the remote API, renders them, and lets the user edit profile/avatar data, add or delete cards, toggle likes, and open image previews. Form validation and popup components support those interactions; BEM styles provide the presentation layer. Edges follow the shown page orchestration, module references, and API calls; unsampled UI wiring is not inferred.

Main entry points: [`src/pages/index.js`](https://github.com/olhasmy/mesto/blob/main/src/pages/index.js) (Page controller), [`src/utils/constants.js`](https://github.com/olhasmy/mesto/blob/main/src/utils/constants.js) (DOM bindings), [`src/index.html`](https://github.com/olhasmy/mesto/blob/main/src/index.html) (App document), [`src/components/Api.js`](https://github.com/olhasmy/mesto/blob/main/src/components/Api.js) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["App orchestration"]
  node_app["Page controller<br/>[index.js]"]
  node_bindings["DOM bindings<br/>[constants.js]"]
end

subgraph group_data["Profile and cards"]
  node_api["API client<br/>[Api.js]"]
  node_profile["User profile<br/>[UserInfo.js]"]
  node_cards["Card behavior<br/>[Card.js]"]
  node_section["Card rendering<br/>[Section.js]"]
end

subgraph group_interaction["Forms and popups"]
  node_validator["Form validation<br/>[FormValidator.js]"]
  node_popup["Popup base<br/>[Popup.js]"]
  node_formpopup["Form popup<br/>[PopupWithForm.js]"]
  node_imagepopup["Image preview<br/>[PopupWithImage.js]"]
end

subgraph group_presentation["UI presentation"]
  node_document["App document<br/>[index.html]"]
  node_styles["BEM styling"]
end

node_visitor(("Visitor"))
node_service[("Mesto API")]

node_visitor -->|"uses"| node_app
node_app -->|"loads and updates"| node_api
node_api -->|"fetches data"| node_service
node_app -->|"sets profile"| node_profile
node_app -->|"renders cards"| node_section
node_section -->|"calls renderer"| node_app
node_app -->|"creates cards"| node_cards
node_cards -->|"invokes handlers"| node_app
node_app -->|"handles submissions"| node_formpopup
node_app -->|"opens preview"| node_imagepopup
node_app -->|"enables validation"| node_validator
node_app -->|"imports bindings"| node_bindings
node_bindings -->|"configures"| node_validator
node_bindings -->|"constructs"| node_profile
node_formpopup -->|"extends"| node_popup
node_imagepopup -->|"extends"| node_popup
node_document -.->|"hosts"| node_app
node_document -.->|"styled by"| node_styles

click node_app "https://github.com/olhasmy/mesto/blob/main/src/pages/index.js"
click node_api "https://github.com/olhasmy/mesto/blob/main/src/components/Api.js"
click node_profile "https://github.com/olhasmy/mesto/blob/main/src/components/UserInfo.js"
click node_cards "https://github.com/olhasmy/mesto/blob/main/src/components/Card.js"
click node_section "https://github.com/olhasmy/mesto/blob/main/src/components/Section.js"
click node_validator "https://github.com/olhasmy/mesto/blob/main/src/components/FormValidator.js"
click node_popup "https://github.com/olhasmy/mesto/blob/main/src/components/Popup.js"
click node_formpopup "https://github.com/olhasmy/mesto/blob/main/src/components/PopupWithForm.js"
click node_imagepopup "https://github.com/olhasmy/mesto/blob/main/src/components/PopupWithImage.js"
click node_bindings "https://github.com/olhasmy/mesto/blob/main/src/utils/constants.js"
click node_document "https://github.com/olhasmy/mesto/blob/main/src/index.html"
click node_styles "https://github.com/olhasmy/mesto/tree/main/src/blocks"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_bindings toneBlue
class node_api,node_profile,node_cards,node_section,node_service toneAmber
class node_validator,node_popup,node_formpopup,node_imagepopup toneMint
class node_document,node_styles toneRose
class node_visitor toneIndigo
```

## Components

### App orchestration

- [Page controller](https://github.com/olhasmy/mesto/blob/main/src/pages/index.js): `src/pages/index.js`
- [DOM bindings](https://github.com/olhasmy/mesto/blob/main/src/utils/constants.js): `src/utils/constants.js`

### Profile and cards

- [API client](https://github.com/olhasmy/mesto/blob/main/src/components/Api.js): `src/components/Api.js`
- [User profile](https://github.com/olhasmy/mesto/blob/main/src/components/UserInfo.js): `src/components/UserInfo.js`
- [Card behavior](https://github.com/olhasmy/mesto/blob/main/src/components/Card.js): `src/components/Card.js`
- [Card rendering](https://github.com/olhasmy/mesto/blob/main/src/components/Section.js): `src/components/Section.js`

### Forms and popups

- [Form validation](https://github.com/olhasmy/mesto/blob/main/src/components/FormValidator.js): `src/components/FormValidator.js`
- [Popup base](https://github.com/olhasmy/mesto/blob/main/src/components/Popup.js): `src/components/Popup.js`
- [Form popup](https://github.com/olhasmy/mesto/blob/main/src/components/PopupWithForm.js): `src/components/PopupWithForm.js`
- [Image preview](https://github.com/olhasmy/mesto/blob/main/src/components/PopupWithImage.js): `src/components/PopupWithImage.js`

### UI presentation

- [App document](https://github.com/olhasmy/mesto/blob/main/src/index.html): `src/index.html`
- [BEM styling](https://github.com/olhasmy/mesto/tree/main/src/blocks): `src/blocks`

### Other components

- **Visitor**
- **Mesto API**

## Connections

- Visitor → Page controller: uses (evidence: `README.md`)
- Page controller → API client: loads and updates (evidence: `src/pages/index.js`)
- API client → Mesto API: fetches data (evidence: `src/components/Api.js`)
- Page controller → User profile: sets profile (evidence: `src/pages/index.js`)
- Page controller → Card rendering: renders cards (evidence: `src/pages/index.js`)
- Card rendering → Page controller: calls renderer (evidence: `src/components/Section.js`)
- Page controller → Card behavior: creates cards (evidence: `src/pages/index.js`)
- Card behavior → Page controller: invokes handlers (evidence: `src/pages/index.js`)
- Page controller → Form popup: handles submissions (evidence: `src/pages/index.js`)
- Page controller → Image preview: opens preview (evidence: `src/pages/index.js`)
- Page controller → Form validation: enables validation (evidence: `src/pages/index.js`)
- Page controller → DOM bindings: imports bindings (evidence: `src/pages/index.js`)
- DOM bindings → Form validation: configures (evidence: `src/utils/constants.js`)
- DOM bindings → User profile: constructs (evidence: `src/utils/constants.js`)
- Form popup → Popup base: extends (evidence: `src/components/PopupWithForm.js`)
- Image preview → Popup base: extends (evidence: `src/components/PopupWithImage.js`)
- App document → Page controller: hosts
- App document → BEM styling: styled by
