# kauadaviamaro/gabine architecture

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

- Interactive diagram: https://gitdiagram.com/kauadaviamaro/gabine
- Repository: https://github.com/kauadaviamaro/gabine

## Overview

##### Project type and purpose
- This is a Single-Page Application (SPA) e-commerce front-end called “Gabini Headset Store,” built in Vue.js. It provides an interactive catalog, user flows for browsing products, cart management, authentication, user profile, and an admin interface for managing categories and products.

##### File structure
- Top-level files:
- index.html – SPA entry point
- vite.config.ts, tsconfig*.json – build and TypeScript configs
- .env(.example) – environment variables (e.g. BACKEND_URL)
- src/ folder breakdown:
- src/App.vue, src/main.ts – application bootstrap
- src/router/ – Vue Router definitions (authRoutes, index)
- src/components/ – reusable UI components (cart card, modals, alerts, admin widgets)
- src/views/ – route-level view components (HomeView, LoginView, CartView, AdminViews, etc.)
- src/services/ – Axios wrappers for REST endpoints (UserService, ProductService, CategoryService, AddressService)
- src/stores/ – Pinia stores for global state (cart, user, alerts, loading)
- src/models/ – TypeScript data models/interfaces (User, Product, Category, Address)
- src/assets/ – static assets (CSS, images)
- src/utils/ – helper functions (debounce)

##### README for additional insights
- Technology stack: Vue.js, Vue Router, Pinia, Axios, CSS
- Backend API is external and configured via .env
- Intended as a modern, animated, fluid UI mapped from a Figma design

a. Main components to represent
- Client Browser / SPA Container
- Vue Application Core (main.ts + App.vue)
- Vue Router
- Route Views (Home, Products, Cart, Login, Register, Profile, Admin Categories, Admin Products)
- UI Components (Navbar, Hero, ProductCard, CartCard, etc.)
- Pinia Stores (cartStore, userStore, alertStore, loadingStore)
- Services Layer (Axios + service classes)
- External Backend REST API
- Static Asset Host (images, CSS served via Vite dev server or static CDN)

b. Relationships and data-flow
1. User interacts with a View via UI Components.
2. Components dispatch actions to Pinia stores or directly call service methods.
3. Services (Axios) send HTTP requests to the Backend API (CRUD endpoints for products, categories, user, addresses).
4. API returns JSON → Services unwrap and map to models → Stores update state or Components consume responses directly.
5. Pinia store mutations trigger reactive updates in UI Components.
6. Vue Router listens to navigation requests and mounts appropriate Views.

c. Architectural patterns and design principles
- Component-based architecture: small, reusable UI pieces
- Unidirectional data flow: user action → service → store → UI
- Separation of concerns: Services layer for HTTP, Stores for state, Components for presentation
- Route-level code splitting possible via Vue Router (dynamic imports in authRoutes)
- Configuration through .env for environment-specific API endpoints

d. Key technologies, frameworks, and libraries
- Vue.js 3 (Composition or Options API in .vue files)
- Vue Router for client routing
- Pinia for state management
- Axios for HTTP client
- Vite for build and dev server
- TypeScript for typing (models, services)
- CSS and static assets served under /src/assets

## Diagram (Mermaid)

```mermaid
flowchart TD
    user["User"]:::externalActor -->|navigates| router["Vue Router"]:::router

    subgraph "SPA Container"
        subgraph "Application Core"
            main["App.vue"]:::appCore
            bootstrap["main.ts"]:::appCore
        end

        router -->|mounts| HV["HomeView.vue"]:::ui
        router -->|mounts| PV["ProductsView.vue"]:::ui
        router -->|mounts| PDV["ProductDetailView.vue"]:::ui
        router -->|mounts| CV["CartView.vue"]:::ui
        router -->|mounts| LV["LoginView.vue"]:::ui
        router -->|mounts| RV["RegisterView.vue"]:::ui
        router -->|mounts| UPV["UserProfile.vue"]:::ui
        router -->|mounts| ACV["AdminCategoriesView.vue"]:::ui
        router -->|mounts| APV["AdminProductsView.vue"]:::ui

        subgraph "UI Components"
            Navbar["Navbar.vue"]:::ui
            Hero["Hero.vue"]:::ui
            ProdCard["ProductCard.vue"]:::ui
            CartCard["CartCard.vue"]:::ui
            Feature["FeatureProducts.vue"]:::ui
            NewProd["NewProducts.vue"]:::ui
            Highlight["ProductsHighlighted.vue"]:::ui
            AlertC["Alert.vue"]:::ui
            LoadingC["Loading.vue"]:::ui
            AddrModal["AddressModal.vue"]:::ui
            AddrEdit["AddressEdit.vue"]:::ui
            CatList["CategoryList.vue"]:::ui
            CatModal["CategoryModal.vue"]:::ui
            ProdList["ProductList.vue"]:::ui
            ProdModal["ProductModal.vue"]:::ui
        end

        subgraph "Pinia Stores"
            CartStore["CartStore"]:::state
            UserStore["UserStore"]:::state
            AlertStore["AlertStore"]:::state
            LoadingStore["LoadingStore"]:::state
        end

        subgraph "Services Layer"
            Axios["api.ts"]:::service
            ProdService["ProductService.ts"]:::service
            CatService["CategoryService.ts"]:::service
            UserService["UserService.ts"]:::service
            AddrService["AddressService.ts"]:::service
        end

        subgraph "Data Models"
            ProdModel["Products.ts"]:::model
            CatModel["Category.ts"]:::model
            UserModel["User.ts"]:::model
            AddrModel["Address.ts"]:::model
        end

        subgraph "Utilities"
            Debounce["debounce.ts"]:::util
        end

        subgraph "Static Assets"
            CSS["main.css"]:::assets
            Images["images (assets)"]:::assets
        end
    end

    HV --> Navbar
    HV --> Hero
    PV --> ProdCard
    PV --> Feature
    PV --> NewProd
    PV --> Highlight
    PDV --> ProdCard
    CV --> CartCard
    LV --> AlertC
    RV --> AlertC
    UPV --> AddrModal
    UPV --> AddrEdit
    ACV --> CatList
    ACV --> CatModal
    APV --> ProdList
    APV --> ProdModal

    Navbar -->|dispatch| CartStore
    ProdCard -->|reads| CartStore
    CartCard -->|dispatch| CartStore
    AlertC -->|reads| AlertStore
    LoadingC -->|reads| LoadingStore
    AddrModal -->|dispatch| UserStore
    AddrEdit -->|dispatch| UserStore
    CatList -->|dispatch| CatService
    ProdList -->|dispatch| ProdService

    CartStore -->|calls| Axios
    UserStore -->|calls| Axios
    AlertStore -->|calls| Axios
    LoadingStore -->|calls| Axios

    ProdService -->|GET /products| ExternalAPI
    CatService -->|GET /categories| ExternalAPI
    UserService -->|POST /login| ExternalAPI
    AddrService -->|CRUD /addresses| ExternalAPI

    ExternalAPI -->|JSON response| ProdService
    ExternalAPI -->|JSON response| CatService
    ExternalAPI -->|JSON response| UserService
    ExternalAPI -->|JSON response| AddrService

    CSS -->|served by Vite| main
    Images -->|served by Vite| main

    classDef externalActor fill:#FFF,stroke:#000,stroke-width:1px;
    classDef ui fill:#D0E8FF,stroke:#3182BD;
    classDef state fill:#D0F5D0,stroke:#2F855A;
    classDef service fill:#FFE5B4,stroke:#DD6B20;
    classDef external fill:#F8D7DA,stroke:#C53030,stroke-dasharray:4 2;
    classDef appCore fill:#E0E0E0,stroke:#718096;
    classDef router fill:#B2EBF2,stroke:#4FD1C5;
    classDef model fill:#FFF3CD,stroke:#D69E2E;
    classDef util fill:#E1BEE7,stroke:#9C27B0;
    classDef assets fill:#F0F0F0,stroke:#A0AEC0;

    click main "https://github.com/kauadaviamaro/gabine/blob/main/src/App.vue"
    click bootstrap "https://github.com/kauadaviamaro/gabine/blob/main/src/main.ts"
    click router "https://github.com/kauadaviamaro/gabine/blob/main/src/router/index.ts"
    click HV "https://github.com/kauadaviamaro/gabine/blob/main/src/views/HomeView.vue"
    click PV "https://github.com/kauadaviamaro/gabine/blob/main/src/views/ProductsView.vue"
    click PDV "https://github.com/kauadaviamaro/gabine/blob/main/src/views/ProductDetailView.vue"
    click CV "https://github.com/kauadaviamaro/gabine/blob/main/src/views/CartView.vue"
    click LV "https://github.com/kauadaviamaro/gabine/blob/main/src/views/LoginView.vue"
    click RV "https://github.com/kauadaviamaro/gabine/blob/main/src/views/RegisterView.vue"
    click UPV "https://github.com/kauadaviamaro/gabine/blob/main/src/views/UserProfile.vue"
    click ACV "https://github.com/kauadaviamaro/gabine/blob/main/src/views/AdminCategoriesView.vue"
    click APV "https://github.com/kauadaviamaro/gabine/blob/main/src/views/AdminProductsView.vue"
    click Navbar "https://github.com/kauadaviamaro/gabine/blob/main/src/components/Navbar.vue"
    click Hero "https://github.com/kauadaviamaro/gabine/blob/main/src/components/Hero.vue"
    click ProdCard "https://github.com/kauadaviamaro/gabine/blob/main/src/components/ProductCard.vue"
    click CartCard "https://github.com/kauadaviamaro/gabine/blob/main/src/components/CartCard.vue"
    click Feature "https://github.com/kauadaviamaro/gabine/blob/main/src/components/FeatureProducts.vue"
    click NewProd "https://github.com/kauadaviamaro/gabine/blob/main/src/components/NewProducts.vue"
    click Highlight "https://github.com/kauadaviamaro/gabine/blob/main/src/components/ProductsHighlighted.vue"
    click AlertC "https://github.com/kauadaviamaro/gabine/blob/main/src/components/Alert.vue"
    click LoadingC "https://github.com/kauadaviamaro/gabine/blob/main/src/components/Loading.vue"
    click AddrModal "https://github.com/kauadaviamaro/gabine/blob/main/src/components/AddressModal.vue"
    click AddrEdit "https://github.com/kauadaviamaro/gabine/blob/main/src/components/AddressEdit.vue"
    click CatList "https://github.com/kauadaviamaro/gabine/blob/main/src/components/admin/CategoryList.vue"
    click CatModal "https://github.com/kauadaviamaro/gabine/blob/main/src/components/admin/CategoryModal.vue"
    click ProdList "https://github.com/kauadaviamaro/gabine/blob/main/src/components/admin/ProductList.vue"
    click ProdModal "https://github.com/kauadaviamaro/gabine/blob/main/src/components/admin/ProductModal.vue"
    click CartStore "https://github.com/kauadaviamaro/gabine/blob/main/src/stores/CartStorage.ts"
    click UserStore "https://github.com/kauadaviamaro/gabine/blob/main/src/stores/userStorage.ts"
    click AlertStore "https://github.com/kauadaviamaro/gabine/blob/main/src/stores/alertStore.ts"
    click LoadingStore "https://github.com/kauadaviamaro/gabine/blob/main/src/stores/loadingStore.ts"
    click Axios "https://github.com/kauadaviamaro/gabine/blob/main/src/api.ts"
    click ProdService "https://github.com/kauadaviamaro/gabine/blob/main/src/services/ProductService.ts"
    click CatService "https://github.com/kauadaviamaro/gabine/blob/main/src/services/CategoryService.ts"
    click UserService "https://github.com/kauadaviamaro/gabine/blob/main/src/services/UserService.ts"
    click AddrService "https://github.com/kauadaviamaro/gabine/blob/main/src/services/AddressService.ts"
    click ProdModel "https://github.com/kauadaviamaro/gabine/blob/main/src/models/Products.ts"
    click CatModel "https://github.com/kauadaviamaro/gabine/blob/main/src/models/Category.ts"
    click UserModel "https://github.com/kauadaviamaro/gabine/blob/main/src/models/User.ts"
    click AddrModel "https://github.com/kauadaviamaro/gabine/blob/main/src/models/Address.ts"
    click Debounce "https://github.com/kauadaviamaro/gabine/blob/main/src/utils/debounce.ts"
    click CSS "https://github.com/kauadaviamaro/gabine/blob/main/src/assets/css/main.css"
    click Images "https://github.com/kauadaviamaro/gabine/tree/main/src/assets/images"
```
