# bogdan016/onlinestore-website architecture

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

- Interactive diagram: https://gitdiagram.com/bogdan016/onlinestore-website
- Repository: https://github.com/bogdan016/onlinestore-website

## Overview

##### Main Components
- Frontend Application: Built with Angular, this component includes all UI elements (e.g., product listing, product details, cart, checkout, search, etc.) and interacts with the backend via REST calls.
- Backend Application: A Spring Boot application using Java and Maven. It implements the core business logic, exposes REST endpoints (as seen from the configuration package with RestConfig.java), and connects to the persistence layer.
- Database: A MySQL database (hinted by the “countries.sql” file and the use of MySQL in the README) that stores entities like Country, County, Product, and ProductCategory.

##### Relationships and Interactions
- The Angular frontend communicates with the backend Spring Boot application via REST APIs.
- The backend acts as the intermediary layer where controllers (likely inferred though not directly visible) handle incoming requests, use DAO and repository classes to fetch or modify data, and then reply to the frontend.
- The backend interacts with the MySQL database where entity data is stored and managed.
- Additionally, the configuration files (such as Spring’s application.properties) indicate database connectivity and other runtime settings.

##### Architectural Patterns and Design Principles
- Client-Server (Full-Stack) Separation: The project clearly separates the Angular frontend from the Spring Boot backend.
- MVC or Repository Pattern on the backend: The file structure shows separate packages for entities, DAO/repositories, and configuration, which is indicative of standard enterprise architectures.
- Modular Component Design: In the frontend, components like product-list, product-details, cart-status, etc., are well organized, emphasizing reusability.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend"
        A1["Angular Frontend"]:::frontend
        subgraph "Angular Modules"
            A2["Components"]:::components
            A3["Services"]:::services
        end
        A1 -->|"contains"| A2
        A1 -->|"contains"| A3
    end

    subgraph "Backend"
        B1["Spring Boot Application"]:::backend
        subgraph "Backend Layers"
            B2["Application Startup"]:::startup
            B3["REST Configuration"]:::config
            B4["DAO/Repositories"]:::dao
            B5["Entities/Models"]:::entities
        end
        B1 -->|"includes"| B2
        B1 -->|"includes"| B3
        B1 -->|"includes"| B4
        B1 -->|"includes"| B5
    end

    subgraph "Database"
        DB["MySQL Database"]:::database
    end

    A1 -->|"REST_API_call"| B1
    B4 -->|"Data_Query"| DB

    click A1 "https://github.com/bogdan016/onlinestore-website/tree/main/Frontend/angular-online-store"
    click A2 "https://github.com/bogdan016/onlinestore-website/tree/main/Frontend/angular-online-store/src/app/components"
    click A3 "https://github.com/bogdan016/onlinestore-website/tree/main/Frontend/angular-online-store/src/app/services"
    click B1 "https://github.com/bogdan016/onlinestore-website/tree/main/Backend/onlinestore"
    click B2 "https://github.com/bogdan016/onlinestore-website/blob/main/Backend/onlinestore/src/main/java/com/github/Bogdan016/onlinestore/OnlineStoreApplication.java"
    click B3 "https://github.com/bogdan016/onlinestore-website/blob/main/Backend/onlinestore/src/main/java/com/github/Bogdan016/onlinestore/configuration/RestConfig.java"
    click B4 "https://github.com/bogdan016/onlinestore-website/tree/main/Backend/onlinestore/src/main/java/com/github/Bogdan016/onlinestore/dao"
    click B5 "https://github.com/bogdan016/onlinestore-website/tree/main/Backend/onlinestore/src/main/java/com/github/Bogdan016/onlinestore/entity"
    click DB "https://github.com/bogdan016/onlinestore-website/blob/main/Backend/countries.sql"

    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef components fill:#B0E0E6,stroke:#333,stroke-width:2px;
    classDef services fill:#AFEEEE,stroke:#333,stroke-width:2px;
    classDef backend fill:#FFD700,stroke:#333,stroke-width:2px;
    classDef startup fill:#FFDEAD,stroke:#333,stroke-width:2px;
    classDef config fill:#F0E68C,stroke:#333,stroke-width:2px;
    classDef dao fill:#F4A460,stroke:#333,stroke-width:2px;
    classDef entities fill:#FFA07A,stroke:#333,stroke-width:2px;
    classDef database fill:#98FB98,stroke:#333,stroke-width:2px;
```
