# lucasbeck1/videogames_webpage architecture

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

- Interactive diagram: https://gitdiagram.com/lucasbeck1/videogames_webpage
- Repository: https://github.com/lucasbeck1/videogames_webpage

## Overview

##### Project type and purpose
- This is a classic full-stack web application named “Henry Videogames.”
- Purpose: provide a searchable, filterable videogame catalog, support adding new games, fetch data from a third-party API (RAWG), and store custom entries in a PostgreSQL database.

##### File structure
- Top-level split:
- api/    ← Backend
- client/ ← Frontend
- api/
- index.js, src/app.js → Express app entry points
- src/db.js → Sequelize setup & Postgres connection
- src/models/ → Sequelize models (Genre, Videogame)
- src/routes/ → Express routing
- tests/ → unit/integration tests for models & routes
- client/
- public/ → static HTML, manifest, robots.txt
- src/Components/ → React view components & CSS modules
- src/Redux/ → Redux store, actions, reducer
- src/Back_data/ → sample JSON for local dev/testing
- src/index.js → React root
- tests, utilities, assets

##### README for additional insights
- Tech stack: React, Redux, CSS on the frontend; Node, Express, Sequelize, PostgreSQL on the backend
- Features: search/filter/order games, random recommendation, create new games
- External dependencies: RAWG HTTP API (via API_KEY)

##### Elements
- Middleware (e.g., CORS, JSON parser) between client and server if desired.

##### Final advice
- Don’t hesitate to show the test suite as an optional side-car to the API.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Frontend Layer
    subgraph "Frontend Layer"
        direction TB
        HTML["index.html"]:::frontend
        Index["index.js"]:::frontend
        App["App.js"]:::frontend
        subgraph "Redux Store"
            direction TB
            Store["store.js"]:::frontend
            Actions["actions.js"]:::frontend
            Reducer["reducer.js"]:::frontend
        end
        Components["Components/"]:::frontend
    end

    %% API Layer
    subgraph "API Layer"
        direction TB
        APIIndex["index.js"]:::backend
        AppJs["app.js"]:::backend
        Routes["routes/index.js"]:::backend
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        DB["PostgreSQL DB"]:::db
        DBConfig["db.js"]:::backend
        subgraph "Models"
            direction TB
            Genre["Genre.js"]:::backend
            Videogame["Videogame.js"]:::backend
        end
    end

    %% External Service
    RAWG["RAWG API"]:::external

    %% Connections
    HTML -->|loads| Index
    Index -->|renders| App
    App -->|dispatches actions| Store
    Store -->|uses actions| Actions
    Store -->|updates via| Reducer
    App -->|renders UI| Components

    App -->|HTTP GET/POST /videogames| APIIndex
    APIIndex -->|initializes| AppJs
    AppJs -->|uses routes| Routes

    Routes -->|SELECT/INSERT| DBConfig
    DBConfig -->|connects ORM| DB
    DBConfig -->|defines models| Genre
    DBConfig -->|defines models| Videogame

    AppJs -->|External GET /games| RAWG

    RAWG -->|returns game data| AppJs
    DB -->|returns persisted data| Routes
    Routes -->|JSON responses| App

    %% Click Events
    click HTML "https://github.com/lucasbeck1/videogames_webpage/blob/master/client/public/index.html"
    click Index "https://github.com/lucasbeck1/videogames_webpage/blob/master/client/src/index.js"
    click App "https://github.com/lucasbeck1/videogames_webpage/blob/master/client/src/App.js"
    click Store "https://github.com/lucasbeck1/videogames_webpage/blob/master/client/src/Redux/store.js"
    click Actions "https://github.com/lucasbeck1/videogames_webpage/blob/master/client/src/Redux/actions.js"
    click Reducer "https://github.com/lucasbeck1/videogames_webpage/blob/master/client/src/Redux/reducer.js"
    click Components "https://github.com/lucasbeck1/videogames_webpage/tree/master/client/src/Components/"
    click APIIndex "https://github.com/lucasbeck1/videogames_webpage/blob/master/api/index.js"
    click AppJs "https://github.com/lucasbeck1/videogames_webpage/blob/master/api/src/app.js"
    click Routes "https://github.com/lucasbeck1/videogames_webpage/blob/master/api/src/routes/index.js"
    click DBConfig "https://github.com/lucasbeck1/videogames_webpage/blob/master/api/src/db.js"
    click Genre "https://github.com/lucasbeck1/videogames_webpage/blob/master/api/src/models/Genre.js"
    click Videogame "https://github.com/lucasbeck1/videogames_webpage/blob/master/api/src/models/Videogame.js"

    %% Styles
    classDef frontend fill:#BBDEFB,stroke:#0D47A1,color:#0D47A1,stroke-width:1px,shape:roundrect;
    classDef backend fill:#C8E6C9,stroke:#1B5E20,color:#1B5E20,stroke-width:1px,shape:rect;
    classDef db fill:#FFE0B2,stroke:#E65100,color:#E65100,stroke-width:1px,shape:cylinder;
    classDef external fill:#DCEDC8,stroke:#33691E,color:#33691E,stroke-width:1px,shape:rect;
```
