# poleeast/pinpin_frontend architecture

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

- Interactive diagram: https://gitdiagram.com/poleeast/pinpin_frontend
- Repository: https://github.com/poleeast/pinpin_frontend

## Overview

##### Project Type and Purpose
- This is a full-stack, multi-tier travel planning platform (“PinPin”) comprising a Vue 3 + TypeScript front-end and a NestJS + TypeORM + MySQL back-end.
- Purpose: Provide group trip creation, real-time chat, personalized wish lists, collaborative itinerary planning, multi-currency expense tracking, and integration with external APIs (Google Maps, OpenWeather, ExChangeRate, Cloudinary).

##### File Structure Analysis
- Top-level:
- public/, index.html → static assets, entry HTML
- src/ → front-end source
- src/components/, src/views/, src/router/, src/stores/, src/plugins/, src/services/, src/utils/ → Vue feature modules
- package.json, vite.config.ts → build & dev config
- No back-end code here; the back-end lives in a separate `pinpin_backend` project (per README).
- Key front-end architectural choices: component-based UI (common/layout/settings), Pinia state stores, Vue Router, Axios plugin for HTTP, Vuetify UI library.

##### README Insights
- Front-end: Vue.js 3.5, TypeScript, Vuetify, Pinia, Vite.
- Back-end: NestJS monolith, TypeORM, MySQL, JWT auth, Swagger docs.
- External APIs: Google Maps (places & routing), OpenWeather, ExChangeRate, Cloudinary (media).

##### Main Components
a. Front-End Layer
- Browser / User Interface
- Vue Application (App.vue)
- Subcomponents (layout, common, settings, views)
- Plugins & Services (Axios, FontAwesome, Iconify, Vuetify)
- State Management (Pinia stores: auth.store, snackbar.store)
- Router (vue-router)
b. API Gateway / Back-End Layer
- NestJS Application
- Modules: Auth, Users/Profiles, Trips/Groups, Chat (WebSocket gateway), Settings, Expense, Itinerary
- Controllers (REST endpoints), Services (business logic), Guards (JWT auth)
- Swagger Documentation
c. Data Persistence
- MySQL Database (pinpin_db)
- TypeORM Entities & Repositories
d. External Services
- Google Maps API (Places, Directions)
- OpenWeather API
- ExChangeRate API
- Cloudinary (image upload/storage)

##### Relationships and Interactions
- Browser ↔️ Front-End (Vue + Router + State)
- Front-End → Back-End (REST over HTTPS via Axios plugin; WebSocket for chat)
- Back-End → MySQL (TypeORM queries)
- Back-End → External APIs (HTTP calls to Google Maps, OpenWeather, ExChangeRate, Cloudinary)
- Back-End ↔️ Back-End Modules (service-to-service calls within NestJS DI)

##### Architectural Patterns & Design Principles
- Front-end: Component-Driven UI, Single-Page Application, Unidirectional Data Flow (Pinia)
- Back-end: Modular Monolith (NestJS modules), Layered Architecture (controllers → services → repositories), JWT-based Authentication, API Documentation (Swagger)
- Separation of Concerns: UI, state management, API calls, business logic, data access

##### Final Advice
- Essential architectural layers and their interactions.
- Labels are concise and unambiguous, reflecting real folder/module names.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Front-End Tier
    subgraph "Front-End Tier"
        direction TB
        Browser["Browser / User Interface"]:::frontend
        VueApp["Vue Application (App.vue)"]:::frontend
        Subcomponents["Subcomponents"]:::frontend
        Router["Vue Router (src/router/index.ts)"]:::frontend
        State["Pinia Stores"]:::frontend
        Plugins["Plugins"]:::frontend
        ServicesFE["API Services"]:::frontend
        Views["Views (Pages)"]:::frontend
        Assets["Static Assets & Styles"]:::frontend
        Utils["Utility Functions"]:::frontend
        Entry["Main Bootstrap (src/main.ts)"]:::frontend
    end

    %% Back-End Tier
    subgraph "Back-End Tier"
        direction TB
        NestApp["NestJS Application"]:::backend
        subgraph "Modules"
            AuthMod["Auth Module"]:::backend
            UsersMod["Users/Profiles Module"]:::backend
            TripsMod["Trips/Groups Module"]:::backend
            ChatMod["Chat Module (WebSocket)"]:::backend
            SettingsMod["Settings Module"]:::backend
            ExpenseMod["Expense Module"]:::backend
            ItinMod["Itinerary Module"]:::backend
        end
        Swagger["Swagger Docs"]:::backend
    end

    %% Persistence Tier
    MySQL["MySQL Database (pinpin_db)"]:::database

    %% External Services
    subgraph "External APIs"
        direction TB
        GoogleMaps["Google Maps API"]:::external
        OpenWeather["OpenWeather API"]:::external
        ExchangeRate["ExChangeRate API"]:::external
        Cloudinary["Cloudinary"]:::external
    end

    %% Connections
    Browser -->|"loads"| VueApp
    VueApp -->|"uses components"| Subcomponents
    VueApp -->|"uses router"| Router
    VueApp -->|"uses state"| State
    VueApp -->|"uses plugins"| Plugins
    VueApp -->|"calls services"| ServicesFE
    VueApp -->|"renders views"| Views
    VueApp -->|"imports assets"| Assets
    VueApp -->|"imports utils"| Utils
    VueApp -->|"bootstrap"| Entry

    ServicesFE -->|HTTPS| NestApp
    VueApp -.->|WebSocket WS| ChatMod

    NestApp -->|DI calls| AuthMod
    NestApp -->|DI calls| UsersMod
    NestApp -->|DI calls| TripsMod
    NestApp -->|DI calls| ChatMod
    NestApp -->|DI calls| SettingsMod
    NestApp -->|DI calls| ExpenseMod
    NestApp -->|DI calls| ItinMod
    NestApp -->|"docs"| Swagger

    AuthMod -->|TypeORM| MySQL
    UsersMod -->|TypeORM| MySQL
    TripsMod -->|TypeORM| MySQL
    ChatMod -->|TypeORM| MySQL
    SettingsMod -->|TypeORM| MySQL
    ExpenseMod -->|TypeORM| MySQL
    ItinMod -->|TypeORM| MySQL

    NestApp -->|HTTPS calls| GoogleMaps
    NestApp -->|HTTPS calls| OpenWeather
    NestApp -->|HTTPS calls| ExchangeRate
    NestApp -->|HTTPS calls| Cloudinary

    %% Click Events - Front-End
    click VueApp "https://github.com/poleeast/pinpin_frontend/blob/master/src/App.vue"
    click Subcomponents "https://github.com/poleeast/pinpin_frontend/tree/master/src/components/common"
    click Subcomponents "https://github.com/poleeast/pinpin_frontend/tree/master/src/components/layout"
    click Subcomponents "https://github.com/poleeast/pinpin_frontend/tree/master/src/components/settings"
    click Router "https://github.com/poleeast/pinpin_frontend/blob/master/src/router/index.ts"
    click State "https://github.com/poleeast/pinpin_frontend/blob/master/src/stores/auth.store.ts"
    click State "https://github.com/poleeast/pinpin_frontend/blob/master/src/stores/snackbar.store.ts"
    click Plugins "https://github.com/poleeast/pinpin_frontend/blob/master/src/plugins/axios.ts"
    click Plugins "https://github.com/poleeast/pinpin_frontend/blob/master/src/plugins/fontawesome.ts"
    click Plugins "https://github.com/poleeast/pinpin_frontend/blob/master/src/plugins/iconify.ts"
    click Plugins "https://github.com/poleeast/pinpin_frontend/blob/master/src/plugins/vuetify.ts"
    click ServicesFE "https://github.com/poleeast/pinpin_frontend/blob/master/src/services/auth.service.ts"
    click ServicesFE "https://github.com/poleeast/pinpin_frontend/blob/master/src/services/setting.service.ts"
    click ServicesFE "https://github.com/poleeast/pinpin_frontend/blob/master/src/services/validation.service.ts"
    click Views "https://github.com/poleeast/pinpin_frontend/blob/master/src/views/homePage.vue"
    click Views "https://github.com/poleeast/pinpin_frontend/blob/master/src/views/searchPage.vue"
    click Views "https://github.com/poleeast/pinpin_frontend/blob/master/src/views/schdulePage.vue"
    click Views "https://github.com/poleeast/pinpin_frontend/blob/master/src/views/settingPage.vue"
    click Views "https://github.com/poleeast/pinpin_frontend/blob/master/src/views/notFoundPage.vue"
    click Assets "https://github.com/poleeast/pinpin_frontend/tree/master/public/"
    click Assets "https://github.com/poleeast/pinpin_frontend/tree/master/src/assets"
    click Utils "https://github.com/poleeast/pinpin_frontend/blob/master/src/utils/functionalComponent.utils.ts"
    click Utils "https://github.com/poleeast/pinpin_frontend/blob/master/src/utils/validators.untils.ts"
    click Entry "https://github.com/poleeast/pinpin_frontend/blob/master/src/main.ts"

    %% Styles
    classDef frontend fill:#E3F2FD,stroke:#90CAF9,stroke-width:1px
    classDef backend fill:#FFE0B2,stroke:#FFB74D,stroke-width:1px
    classDef database fill:#C8E6C9,stroke:#66BB6A,stroke-width:1px
    classDef external fill:#E0E0E0,stroke:#BDBDBD,stroke-width:1px
```
