# baclv609/planease architecture

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

- Interactive diagram: https://gitdiagram.com/baclv609/planease
- Repository: https://github.com/baclv609/planease

## Overview

##### Project Type and Purpose
- The README and file structure indicate that this is a client-side web application (SPA) focused on personal schedule management.
- Key features include user registration/login, schedule creation/modification/deletion, calendar integration, and JWT-based authentication.
- Components such as views for authentication, calendar, schedule, dashboard, settings, and errors point out that the app is designed with a modular and scalable UI architecture.

##### And Highlight the Main Components
- Frontend Application:
- The core of the project is built using Vue.js (note the App.vue, main.js, and Vue component files).
- UI Layouts and Views: Distinguish between various layouts (AuthLayout, DashboardLayout, DefaultLayout, etc.) and views (for Auth, Calendar, Dashboard, Schedule, Users, etc.).
- Components Library: There are generic components (BaseButton, BaseInput, BaseModal, etc.) as well as feature-specific components organized under directories like components/calendar, components/profile, and others.
- Composables: Custom hooks (useAuth, useCalendar, etc.) provide reactive functionalities and data binding.
- Router: The routing is extensively organized under src/router (including files for authentication, calendar, dashboard, schedule, etc.), defining navigational flows and state management.
- Stores: Centralized state management is implemented (files under src/stores), managing aspects like authentication state, calendar data, settings, and upcoming tasks.
- Plugins: Integration with external libraries (plugins for antdv, echo, i18n) that extend Vue’s functionality.

- API Integration Modules:
- The src/api directory contains modules like authApi.js, calendarApi.js, and scheduleApi.js, which likely wrap around a common axios client (axiosClient.js) to perform HTTP requests.
- These modules interact with a backend (as configured in the .env file via VITE_API_BASE_URL) to handle authentication and schedule management logic.

- Public Assets and Configurations:
- Configuration files (.env.example, tailwind.config.js, vite.config.js) show build and deployment configurations.

- External Services and JWT:
- The README indicates that user authentication is performed using JWT, so include a note of secure token management and API communication.

##### Relationships and Interactions
- User Interaction Flow:
- UI Components (components in views, layouts, and common) capture actions such as login, schedule creation, or data updates.
- These actions trigger composables and store actions that manage state.

- API and Data Flow:
- The stores and composables route data requests via API modules (using axiosClient) to interact with external endpoints.
- JWT tokens are managed during authentication requests and persist in client state.

- Navigation:
- The Router directs views based on paths (from auth, calendar, schedule, etc.), ensuring each module is loaded as needed.

##### Architectural Patterns and Design Principles
- Component-Based Architecture: The project has a clear separation by using Vue components for modular design.
- MVVM / MV* Pattern: Views and layouts manage the display logic, while composables and state stores handle business/data logic.
- Separation of Concerns: Clear directory separation (components, views, router, stores, composables, API) allows for maintainability.
- Reusability and Extensibility: Reusable components and composable functions allow convenient extensions or modifications.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Entities
    User("User"):::userStyle

    %% Frontend Application Block
    subgraph "Frontend Application"
        direction TB
        %% Frontend Core
        subgraph "Frontend Core"
            direction TB
            A1("App.vue"):::core
            A2("main.js"):::core
        end

        %% UI Layer
        subgraph "UI Layer"
            direction TB
            %% Layouts
            subgraph "Layouts"
                direction TB
                L1("AuthLayout"):::layout
                L2("DashboardLayout"):::layout
                L3("DefaultLayout"):::layout
                L4("PublicLayout"):::layout
                L5("SettingLayout"):::layout
            end
            %% Views
            subgraph "Views"
                direction TB
                V1("Auth Views"):::view
                V2("Calendar Views"):::view
                V3("Dashboard Views"):::view
                V4("Schedule Views"):::view
                V5("Profile Views"):::view
                V6("Settings Views"):::view
                V7("Errors Views"):::view
            end
            %% Components Library
            subgraph "Components Library"
                direction TB
                C1("Common Components"):::component
                C2("Calendar Components"):::component
                C3("Other UI Components"):::component
            end
        end

        %% Router
        R("Router"):::router

        %% State Management (Stores)
        subgraph "State Management"
            direction TB
            S1("Auth Store"):::store
            S2("Calendar Store"):::store
            S3("Settings Store"):::store
            S4("UpcomingTasks Store"):::store
        end

        %% Composables
        subgraph "Composables"
            direction TB
            Comp1("useAuth"):::composable
            Comp2("useCalendar"):::composable
        end

        %% Plugins
        subgraph "Plugins"
            direction TB
            P1("antdv"):::plugin
            P2("echo"):::plugin
            P3("i18n"):::plugin
        end

        %% API Integration Modules
        subgraph "API Modules"
            direction TB
            A3("authApi"):::api
            A4("calendarApi"):::api
            A5("scheduleApi"):::api
            A6("axiosClient"):::api
        end

        %% Public Assets & Configurations
        subgraph "Public Assets & Configs"
            direction TB
            PA("Public Assets"):::asset
            PC("Configurations"):::config
        end
    end

    %% External Backend
    B("Backend (JWT)"):::backend

    %% Relationships
    User -->|"triggers"| A1
    A1 -->|"initializes"| A2

    %% From Frontend Core to UI Layer (starting with Layouts)
    A2 -->|"renders"| L1
    %% Layouts to Views (example navigation flow)
    L1 -->|"loads"| V1
    L2 --> V3
    L3 --> V1
    L4 --> V1
    L5 --> V6
    %% Views directed through Router
    V1 --> R
    V2 --> R
    V3 --> R
    V4 --> R

    %% UI Layer interactions with Components Library
    V1 --> C1
    V2 --> C2
    V3 --> C3

    %% Components and Views trigger Composables and State Management
    C1 --> Comp1
    C2 --> Comp2
    V1 --> S1
    V2 --> S2

    %% Composables interact with State Management
    Comp1 --> S1
    Comp2 --> S2

    %% State Management and Composables call API Integration Modules
    S1 --> A3
    S2 --> A4
    S3 --> A5
    Comp1 --> A3
    Comp2 --> A4

    %% API Modules communicate with External Backend
    A3 --> B
    A4 --> B
    A5 --> B
    A6 --> A3
    A6 --> A4
    A6 --> A5

    %% Router interfaces with Views
    R --> V1
    R --> V2
    R --> V3
    R --> V4

    %% Plugins integration with UI and State components
    P1 --- L1
    P2 --- S1
    P3 --- Comp1

    %% UI Layer connected with Public Assets & Configurations
    V1 --- PA
    V1 --- PC

    %% Styling
    classDef userStyle fill:#f3f3f3,stroke:#333,stroke-width:2px;
    classDef core fill:#b3cde0,stroke:#333,stroke-width:2px;
    classDef layout fill:#ccebc5,stroke:#333,stroke-width:2px;
    classDef view fill:#decbe4,stroke:#333,stroke-width:2px;
    classDef component fill:#fed9a6,stroke:#333,stroke-width:2px;
    classDef router fill:#ffffcc,stroke:#333,stroke-width:2px;
    classDef store fill:#fbb4ae,stroke:#333,stroke-width:2px;
    classDef composable fill:#d9d9d9,stroke:#333,stroke-width:2px;
    classDef plugin fill:#b3e2cd,stroke:#333,stroke-width:2px;
    classDef api fill:#fddaec,stroke:#333,stroke-width:2px;
    classDef asset fill:#e5f5e0,stroke:#333,stroke-width:2px;
    classDef config fill:#f2f0f7,stroke:#333,stroke-width:2px;
    classDef backend fill:#d1e5f0,stroke:#333,stroke-width:2px;

    %% Click Events
    click A1 "https://github.com/baclv609/planease/blob/main/src/App.vue"
    click A2 "https://github.com/baclv609/planease/blob/main/src/main.js"
    click L1 "https://github.com/baclv609/planease/blob/main/src/layouts/AuthLayout.vue"
    click L2 "https://github.com/baclv609/planease/blob/main/src/layouts/DashboardLayout.vue"
    click L3 "https://github.com/baclv609/planease/blob/main/src/layouts/DefaultLayout.vue"
    click L4 "https://github.com/baclv609/planease/blob/main/src/layouts/PublicLayout.vue"
    click L5 "https://github.com/baclv609/planease/blob/main/src/layouts/SettingLayout.vue"
    click V1 "https://github.com/baclv609/planease/tree/main/src/views/auth"
    click V2 "https://github.com/baclv609/planease/tree/main/src/views/calendar"
    click V3 "https://github.com/baclv609/planease/tree/main/src/views/dashboard"
    click V4 "https://github.com/baclv609/planease/tree/main/src/views/schedule"
    click V5 "https://github.com/baclv609/planease/tree/main/src/views/profile"
    click V6 "https://github.com/baclv609/planease/tree/main/src/views/settings"
    click V7 "https://github.com/baclv609/planease/tree/main/src/views/errors"
    click C1 "https://github.com/baclv609/planease/tree/main/src/components/common"
    click C2 "https://github.com/baclv609/planease/tree/main/src/components/calendar"
    click C3 "https://github.com/baclv609/planease/tree/main/src/components"
    click Comp1 "https://github.com/baclv609/planease/blob/main/src/composables/useAuth.js"
    click Comp2 "https://github.com/baclv609/planease/blob/main/src/composables/useCalendar.js"
    click R "https://github.com/baclv609/planease/tree/main/src/router"
    click S1 "https://github.com/baclv609/planease/blob/main/src/stores/auth.js"
    click S2 "https://github.com/baclv609/planease/blob/main/src/stores/calendarStore.js"
    click S3 "https://github.com/baclv609/planease/blob/main/src/stores/settingsStore.js"
    click S4 "https://github.com/baclv609/planease/blob/main/src/stores/upcomingTasksStore.js"
    click P1 "https://github.com/baclv609/planease/blob/main/src/plugins/antdv.js"
    click P2 "https://github.com/baclv609/planease/blob/main/src/plugins/echo.js"
    click P3 "https://github.com/baclv609/planease/blob/main/src/plugins/i18n.js"
    click A3 "https://github.com/baclv609/planease/blob/main/src/api/authApi.js"
    click A4 "https://github.com/baclv609/planease/blob/main/src/api/calenderApi.js"
    click A5 "https://github.com/baclv609/planease/blob/main/src/api/scheduleApi.js"
    click A6 "https://github.com/baclv609/planease/blob/main/src/api/axiosClient.js"
    click PA "https://github.com/baclv609/planease/tree/main/src/assets"
    click PC "https://github.com/baclv609/planease/blob/main/tailwind.config.js"
```
