# archttp/cfzhv3.0_public_admin architecture

> Architecture diagram of the GitHub repository archttp/cfzhv3.0_public_admin, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/archttp/cfzhv3.0_public_admin
- Repository: https://github.com/archttp/cfzhv3.0_public_admin

## Overview

##### Project Type and Purpose
- This is a single­-page front­end admin dashboard built with Vue 3 and Arco Design. It provides the UI for managing:
- Smart city parking
- EV charging (cars and two­-wheelers)
- Property management (face access control, visits, payments)
- The repo contains only the front­end code—API modules under src/api call out to your backend microservices/REST endpoints.

##### File Structure Analysis
- Top-level:
- config/ & vite.config.* – Vite build and plugin configurations
- src/ – Application source
– api/ – HTTP request modules
– components/, layout/, views/ – Vue components & pages
– router/ – Vue Router definitions and guards
– store/ – Vuex modules
– hooks/, utils/ – re­usable composables and helpers
– assets/, locale/, mock/ – static assets, i18n, mock data
- Build scripts: babel.config.js, vite.config.*
- Env configs: .env.development, .env.production

##### Key README Insights
- Uses Arco Design component library
- Heavy use of charts (echarts via src/types/echarts.ts and src/components/chart)
- Mock folder indicates development fallback when backend is unavailable
- Deployment is static front­end; needs to connect to self­-hosted back­end services

a. Main Components
- Browser (client)
- Vue App (SPA)
– Router
– Vuex Store
– UI Components & Pages
– API Service Layer
- Build & Deployment Pipeline (Vite → static assets → CDN/Server)
- External Backend Services (Authentication, Parking API, EV Charging API, Property Management API)
- Third-Party Libraries (Arco Design, echarts, etc.)

b. Relationships & Data Flow
1. Developer triggers “vite build” → produces static JS/CSS assets.
2. Static assets are served (via CDN or web server) to the Browser.
3. In the Browser:
– Vue Router detects URL → loads corresponding Page component.
– Page/component dispatches Vuex actions or calls API modules (src/api/*.ts).
– API module makes HTTP requests to backend services.
– Responses update Vuex store or resolve inside component.
– UI components re-render with fresh data.
4. Mock server kicks in if mock mode is enabled.

c. Architectural Patterns & Principles
- Modular folder structure (feature by folder under views/api/store)
- Separation of concerns:
– “views” handle page layout
– “components” are reusable UI blocks
– “api” layers abstract HTTP calls
– “store” for app state
– “router” for navigation
- Composables (src/hooks) for cross-cutting logic (loading, theming, locale)
- Configuration-driven routes (router/routes)

d. Key Technologies & Libraries
- Vue 3 + Composition API
- Vuex for state management
- Vue Router for navigation
- Vite for bundling and dev server
- Arco Design Vue UI components
- ECharts for data visualization
- Axios or fetch (inside src/api/interceptor.ts)
- i18n via locale files under src/locale and view­-level locale folders

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    Browser["Browser (User)"]:::frontend

    %% Frontend App Internals
    subgraph "SPA (Vue 3 App)" 
        direction TB
        MainEntry["Main Entry\nsrc/main.ts & src/App.vue"]:::frontend
        Router["Vue Router\nsrc/router"]:::frontend
        Store["Vuex Store\nsrc/store"]:::frontend
        Views["Page Views\nsrc/views"]:::frontend
        Components["UI Components\nsrc/components"]:::frontend
        API["API Service Layer\nsrc/api"]:::frontend
        Interceptor["API Interceptor\nsrc/api/interceptor.ts"]:::frontend
        Hooks["Composables & Hooks\nsrc/hooks"]:::frontend
        Utils["Utilities & Helpers\nsrc/utils"]:::frontend
        Types["ECharts Types\nsrc/types/echarts.ts"]:::frontend
        Locale["Localization (i18n)\nsrc/locale"]:::frontend
        Assets["Static Assets & Styles\nsrc/assets"]:::frontend
        Mock["Mock Server\nsrc/mock"]:::frontend
    end

    %% Build & Deployment Pipeline
    subgraph "Build & Deploy" 
        direction TB
        EnvFiles["Env Configurations\n.env.development/.env.production"]:::build
        ViteConfig["Vite Config\nvite.config.ts & config/vite.config.*"]:::build
        Plugins["Vite Plugins\nconfig/plugin"]:::build
        Build["vite build → Static Assets"]:::build
        CDN["CDN/Web Server"]:::build
    end

    %% Backend Services
    subgraph "External Backend Services"
        direction TB
        AuthAPI["Authentication API"]:::backend
        ParkingAPI["Parking API"]:::backend
        EVAPI["EV Charging API"]:::backend
        PropertyAPI["Property Mgmt API"]:::backend
    end

    %% Data Flows
    Browser -->|"loads SPA"| CDN
    CDN -->|HTTP/HTTPS| Browser
    Browser -->|bootstraps| MainEntry
    MainEntry --> Router
    MainEntry --> Store
    Router --> Views
    Views --> Components
    Views --> Hooks
    Components --> Utils
    Components --> Types
    Views --> Locale
    Locale --> Hooks
    Views -->|"dispatch actions / call"| Store
    Views -->|"call"| API
    Components -->|"call"| API
    API --> Interceptor
    Interceptor -->|HTTP/REST JSON| AuthAPI
    Interceptor -->|HTTP/REST JSON| ParkingAPI
    Interceptor -->|HTTP/REST JSON| EVAPI
    Interceptor -->|HTTP/REST JSON| PropertyAPI
    API -->|mock? JSON| Mock
    Mock --> API
    AuthAPI -->|JSON| Store
    ParkingAPI -->|JSON| Store
    EVAPI -->|JSON| Store
    PropertyAPI -->|JSON| Store
    Store -->|state update| Components
    Store -->|state update| Views

    %% Build Flow
    EnvFiles --> ViteConfig
    ViteConfig --> Plugins
    Plugins --> Build
    Build --> CDN

    %% Click Events
    click Router "https://github.com/archttp/cfzhv3.0_public_admin/tree/main/src/router"
    click Store "https://github.com/archttp/cfzhv3.0_public_admin/tree/main/src/store"
    click API "https://github.com/archttp/cfzhv3.0_public_admin/tree/main/src/api"
    click Interceptor "https://github.com/archttp/cfzhv3.0_public_admin/blob/main/src/api/interceptor.ts"
    click Components "https://github.com/archttp/cfzhv3.0_public_admin/tree/main/src/components"
    click Views "https://github.com/archttp/cfzhv3.0_public_admin/tree/main/src/views"
    click Hooks "https://github.com/archttp/cfzhv3.0_public_admin/tree/main/src/hooks"
    click Utils "https://github.com/archttp/cfzhv3.0_public_admin/tree/main/src/utils"
    click Types "https://github.com/archttp/cfzhv3.0_public_admin/blob/main/src/types/echarts.ts"
    click Locale "https://github.com/archttp/cfzhv3.0_public_admin/tree/main/src/locale"
    click Assets "https://github.com/archttp/cfzhv3.0_public_admin/tree/main/src/assets"
    click Mock "https://github.com/archttp/cfzhv3.0_public_admin/tree/main/src/mock"
    click MainEntry "https://github.com/archttp/cfzhv3.0_public_admin/blob/main/src/main.ts"
    click MainEntry "https://github.com/archttp/cfzhv3.0_public_admin/blob/main/src/App.vue"
    click ViteConfig "https://github.com/archttp/cfzhv3.0_public_admin/blob/main/vite.config.ts"
    click ViteConfig "https://github.com/archttp/cfzhv3.0_public_admin/blob/main/config/vite.config.base.ts"
    click ViteConfig "https://github.com/archttp/cfzhv3.0_public_admin/blob/main/config/vite.config.dev.ts"
    click ViteConfig "https://github.com/archttp/cfzhv3.0_public_admin/blob/main/config/vite.config.prod.ts"
    click Plugins "https://github.com/archttp/cfzhv3.0_public_admin/tree/main/config/plugin"
    click EnvFiles "https://github.com/archttp/cfzhv3.0_public_admin/blob/main/.env.development"
    click EnvFiles "https://github.com/archttp/cfzhv3.0_public_admin/blob/main/.env.production"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#1E70BF,stroke-width:1px,color:#1E70BF
    classDef build fill:#DFFFE0,stroke:#3D8B05,stroke-width:1px,color:#3D8B05
    classDef backend fill:#FFEFD0,stroke:#BF7A1E,stroke-width:1px,color:#BF7A1E
```
