# lembolov9/web_lab4 architecture

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

- Interactive diagram: https://gitdiagram.com/lembolov9/web_lab4
- Repository: https://github.com/lembolov9/web_lab4

## Overview

##### Project type and purpose
- This is a full-stack web application (“web_lab4”) that lets users view weather information by city.
- The `client` directory is a React app (with Redux) providing the UI; the `server` directory is an Express/Node API that handles requests and fetches weather data from an external service.

##### File structure
- Top level:
- .gitignore, README.md
- /client: React project (package.json, src/, public/, build/)
- /server: Node/Express project (package.json, src/, app.js)
- client/src:
- actions/, reducers/ → Redux architecture.
- components/ (AddForm, Weather, WeatherList, App) → presentational and container components.
- constants/ (action types, initial state, server URL).
- server/src:
- config.js → configuration (e.g., API keys, ports).
- routes/index.js → routing layer.
- controllers/ → business logic (cityController, weatherController).
- models/WeatherCity.js → data model (in-memory or schema).
- No internal database folder, so persistence is probably in memory or delegated to external API.

##### README
- Minimal instructions for launching client and server.

##### Details to capture
- Redux action flow: Action → Middleware/Thunk → HTTP request
- Routes (e.g., /api/weather) mapped to controllers
- Config.js for API keys and port settings
- If using serviceWorker, indicate offline capability node in client layer

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend Layer"
        Browser["User's Browser"]:::frontend
        Entry["Entry Point (src/index.js)"]:::frontend
        Public["Public HTML Template"]:::frontend
        ReactUI["React App (UI Components)"]:::frontend
        ATypes["Action Types"]:::frontend
        InitState["Initial State"]:::frontend
        ServerConst["Server URL Constant"]:::frontend
        Actions["Redux Actions"]:::frontend
        Reducers["Redux Reducers"]:::frontend
        Store["Redux Store"]:::frontend
        SW["Service Worker"]:::frontend
        Build["Production Build"]:::frontend
    end

    subgraph "Backend Layer"
        API["Express API Server (app.js)"]:::backend
        Config["Config (config.js)"]:::backend
        Routes["API Routes"]:::backend
        CityCtrl["City Controller"]:::backend
        WeatherCtrl["Weather Controller"]:::backend
        Model["WeatherCity Model"]:::backend
    end

    External["External Weather API"]:::external

    %% Frontend Flow
    Browser --> ReactUI
    ReactUI --> Actions
    Actions -->|dispatch| Store
    Store --> ReactUI
    Actions -->|HTTP Request| API
    API -->|response| Actions

    %% Backend Flow
    API --> Routes
    Routes --> CityCtrl
    CityCtrl --> WeatherCtrl
    WeatherCtrl --> Model
    WeatherCtrl -->|fetch data| External
    External -->|data| WeatherCtrl
    WeatherCtrl -->|JSON response| API

    %% Click Events
    click ReactUI "https://github.com/lembolov9/web_lab4/tree/master/client/src/components"
    click Actions "https://github.com/lembolov9/web_lab4/blob/master/client/src/actions/index.js"
    click Reducers "https://github.com/lembolov9/web_lab4/blob/master/client/src/reducers/index.js"
    click ATypes "https://github.com/lembolov9/web_lab4/blob/master/client/src/constants/action-types.js"
    click InitState "https://github.com/lembolov9/web_lab4/blob/master/client/src/constants/initial-state.js"
    click ServerConst "https://github.com/lembolov9/web_lab4/blob/master/client/src/constants/server.js"
    click Entry "https://github.com/lembolov9/web_lab4/blob/master/client/src/index.js"
    click SW "https://github.com/lembolov9/web_lab4/blob/master/client/src/serviceWorker.js"
    click Public "https://github.com/lembolov9/web_lab4/blob/master/client/public/index.html"
    click Build "https://github.com/lembolov9/web_lab4/tree/master/client/build"
    click API "https://github.com/lembolov9/web_lab4/blob/master/server/app.js"
    click Config "https://github.com/lembolov9/web_lab4/blob/master/server/src/config.js"
    click Routes "https://github.com/lembolov9/web_lab4/blob/master/server/src/routes/index.js"
    click CityCtrl "https://github.com/lembolov9/web_lab4/blob/master/server/src/controllers/cityController.js"
    click WeatherCtrl "https://github.com/lembolov9/web_lab4/blob/master/server/src/controllers/weatherController.js"
    click Model "https://github.com/lembolov9/web_lab4/blob/master/server/src/models/WeatherCity.js"

    %% Styles
    classDef frontend fill:#bbdefb,stroke:#1e88e5,stroke-width:2px
    classDef backend fill:#c8e6c9,stroke:#43a047,stroke-width:2px
    classDef external fill:#f5f5f5,stroke:#9e9e9e,stroke-width:2px,stroke-dasharray:5 5
```
