# aureldp/pomme-project architecture

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

- Interactive diagram: https://gitdiagram.com/aureldp/pomme-project
- Repository: https://github.com/aureldp/pomme-project

## Overview

##### Project Type and Purpose
- Pomme is a full-stack online store website modeled after the Apple website. It’s a student project with standard e-commerce features such as user registration/login, product browsing, cart management, and responsive, cross-platform design.

##### Analyzing the File Structure
- Frontend (client):
– The client directory contains configuration files (babel.config.js, vue.config.js, etc.), static assets (index.html, images, etc.), and the core application logic in src.
– Key directories such as src/components, src/views, and src/router indicate the use of a component-based architecture typical of Vue.js applications.
– Components are further organized (e.g., cartPage and mainPage sub-components) suggesting the separation of UI concerns by page.
- Backend (server):
– The server directory contains a clear MVC-like structure with subdirectories for controllers (handling business logic), routes (defining API endpoints), and repositories (for data access and possibly database interactions).
– Utilities like connectServer.js suggest setup routines or helpers for initial configuration and server connection.
– The main entry is in server/index.js, which ties together controllers, routing, and utilities.

##### Key Architectural Components
- Client Side:
- Main Application: The entry point (client/src/main.js) initializing the Vue app.
- Vue Components and Views: Include major components like App.vue and category-based components (e.g., NavBar.vue, FooterSection.vue) along with complete page views such as MainPage.vue, CartPage.vue, and ModalPage.vue.
- Routing: The client/src/router/router.js that handles in-app navigation.
- Server Side:
- Entry Point: server/index.js which boots the server.
- Controllers: Modules like buyhistoryController.js, productsController.js, and usersController.js handling incoming requests.
- Routes: Modules (e.g., buyhistoryRoutes.js, productsRoutes.js, usersRoutes.js) mapping endpoints to controllers.
- Repository Layer: Modules such as buyhistory.js, products.js, and users.js representing data access logic (abstracting directly to database queries or any persistence layer).
- Utility Functions: Files in the utility directory (connectServer.js, index.js) that support configuration and server connections.

##### Relationships and Interactions
- Within the server, illustrate a flow:
- Routes receive incoming HTTP requests, pass them to the relevant controller.
- Controllers process requests, leverage repository modules to interact with the database (or data storage), and form the response.
- Utilities help bootstrap and maintain server operations (e.g., connecting the application).

##### Important Architectural Patterns and Design Principles
- Separation of Concerns: Frontend and backend are clearly separated; within each, the logic is modularized (pages, components, routes, controllers, repositories).
- MVC (for the backend): The division among routes, controllers, and repository modules reflects this typical pattern.
- Component-Based Architecture (for frontend): The Vue.js structure emphasizes reusable and isolated UI components.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Section
    subgraph "Frontend (Vue.js)"
        FE_Main("Main Application Entry")
        FE_App("Root Vue Component")
        FE_Nav("NavBar Component")
        FE_Footer("Footer Section")
        FE_MainPage("MainPage View")
        FE_CartPage("CartPage View")
        FE_ModalPage("ModalPage View")
        FE_Router("Client-side Routing")
    end

    %% Backend Section
    subgraph "Backend (Node.js)"
        BE_Entry("Server Entry Point")
        BE_Util1("Server Connection Utility")
        BE_Util2("Additional Utility Functions")
        subgraph "API Endpoints"
            BE_BRoutes("Buyhistory Routes")
            BE_PRoutes("Products Routes")
            BE_URoutes("Users Routes")
        end
        subgraph "Controllers"
            BE_BController("Buyhistory Controller")
            BE_PController("Products Controller")
            BE_UController("Users Controller")
        end
        subgraph "Repositories"
            BE_BRepo("Buyhistory Repository")
            BE_PRepo("Products Repository")
            BE_URepo("Users Repository")
        end
    end

    %% Frontend Internal Connections
    FE_Main --> FE_App
    FE_Main --> FE_Router
    FE_Router --> FE_MainPage
    FE_Router --> FE_CartPage
    FE_Router --> FE_ModalPage
    FE_App --> FE_Nav
    FE_App --> FE_Footer

    %% Frontend to Backend Interaction
    FE_Router -.->|"HTTP_API"| BE_Entry

    %% Backend Internal Connections
    BE_Entry --> BE_Util1
    BE_Entry --> BE_Util2
    BE_Entry --> BE_BRoutes
    BE_Entry --> BE_PRoutes
    BE_Entry --> BE_URoutes
    BE_BRoutes --> BE_BController
    BE_PRoutes --> BE_PController
    BE_URoutes --> BE_UController
    BE_BController --> BE_BRepo
    BE_PController --> BE_PRepo
    BE_UController --> BE_URepo

    %% Click Events for Frontend Components
    click FE_Main "https://github.com/aureldp/pomme-project/blob/master/client/src/main.js"
    click FE_App "https://github.com/aureldp/pomme-project/blob/master/client/src/App.vue"
    click FE_Nav "https://github.com/aureldp/pomme-project/blob/master/client/src/components/NavBar.vue"
    click FE_Footer "https://github.com/aureldp/pomme-project/blob/master/client/src/components/FooterSection.vue"
    click FE_MainPage "https://github.com/aureldp/pomme-project/blob/master/client/src/views/MainPage.vue"
    click FE_CartPage "https://github.com/aureldp/pomme-project/blob/master/client/src/views/CartPage.vue"
    click FE_ModalPage "https://github.com/aureldp/pomme-project/blob/master/client/src/views/ModalPage.vue"
    click FE_Router "https://github.com/aureldp/pomme-project/blob/master/client/src/router/router.js"

    %% Click Events for Backend Components
    click BE_Entry "https://github.com/aureldp/pomme-project/blob/master/server/index.js"
    click BE_BController "https://github.com/aureldp/pomme-project/blob/master/server/controller/buyhistoryController.js"
    click BE_PController "https://github.com/aureldp/pomme-project/blob/master/server/controller/productsController.js"
    click BE_UController "https://github.com/aureldp/pomme-project/blob/master/server/controller/usersController.js"
    click BE_BRoutes "https://github.com/aureldp/pomme-project/blob/master/server/routes/buyhistoryRoutes.js"
    click BE_PRoutes "https://github.com/aureldp/pomme-project/blob/master/server/routes/productsRoutes.js"
    click BE_URoutes "https://github.com/aureldp/pomme-project/blob/master/server/routes/usersRoutes.js"
    click BE_BRepo "https://github.com/aureldp/pomme-project/blob/master/server/repository/buyhistory.js"
    click BE_PRepo "https://github.com/aureldp/pomme-project/blob/master/server/repository/products.js"
    click BE_URepo "https://github.com/aureldp/pomme-project/blob/master/server/repository/users.js"
    click BE_Util1 "https://github.com/aureldp/pomme-project/blob/master/server/utility/connectServer.js"
    click BE_Util2 "https://github.com/aureldp/pomme-project/blob/master/server/utility/index.js"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef backend fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef util fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    
    class FE_Main,FE_App,FE_Nav,FE_Footer,FE_MainPage,FE_CartPage,FE_ModalPage,FE_Router frontend;
    class BE_Entry,BE_BRoutes,BE_PRoutes,BE_URoutes,BE_BController,BE_PController,BE_UController,BE_BRepo,BE_PRepo,BE_URepo backend;
    class BE_Util1,BE_Util2 util;
```
