# github1586/nuxt-bnhcp architecture

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

- Interactive diagram: https://gitdiagram.com/github1586/nuxt-bnhcp
- Repository: https://github.com/github1586/nuxt-bnhcp

## Overview

##### Main System Components

a) Client-Side (Frontend):
- Nuxt.js Framework Layer
- Vue Components Structure
- State Management (Vuex Store)
- Static Assets & Resources

b) Server-Side:
- Express.js Server
- API Controllers
- Database Layer (MySQL)
- Redis Cache Layer

c) External Services:
- Tencent Cloud Serverless
- Nginx (Reverse Proxy)

**[Client Browsers/Devices]**
- ↓
**[Nginx Reverse Proxy]**
- ↓
**[Tencent Cloud Serverless]**

**[Nuxt.js SSR Engine]**
- ↙          ↘
**[Frontend]    [Backend]**

**[MySQL Database] ← → [Redis Cache]**

##### Component Relationships to Highlight

- Data flow between the API controllers and the database
- Caching mechanism with Redis
- Demonstrate the frontend routing system
- Vuex store interactions

##### Specific Implementation Details

Frontend Structure:
- Pages directory structure (/pages)
- Components hierarchy (/components)
- Layout system (/layouts)
- Plugin system (/plugins)

Backend Structure:
- API Controllers (/server/api/controller)
- Database Models (/server/api/model)
- Redis Cache Implementation (/server/api/redis)

##### Key Features to Highlight

- SSR Implementation
- Authentication flow
- Shopping cart system
- Course management
- Order processing
- Payment integration
- Redis caching for homepage and pagination

##### Technical Stack Labels

**Frontend:**
- Nuxt.js/Vue.js
- Vuex
- Axios

**Backend:**
- Express.js
- Node.js
- MySQL
- Redis

**Infrastructure:**
- Tencent Cloud Serverless
- Nginx

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser[Client Browser]
    end

    subgraph Infrastructure
        Nginx[Nginx Reverse Proxy]:::proxy
        TCloud[Tencent Cloud Serverless]:::cloud
    end

    subgraph "Nuxt SSR Engine"
        NuxtSSR[Nuxt.js SSR]:::nuxt
        click NuxtSSR "https://github.com/github1586/nuxt-bnhcp/tree/master/nuxt"
    end

    subgraph "Frontend Layer"
        Components[Vue Components]:::frontend
        click Components "https://github.com/github1586/nuxt-bnhcp/tree/master/components"
        Pages[Frontend Routes]:::frontend
        click Pages "https://github.com/github1586/nuxt-bnhcp/tree/master/pages"
        Layouts[Layout System]:::frontend
        click Layouts "https://github.com/github1586/nuxt-bnhcp/tree/master/layouts"
        Store[Vuex Store]:::frontend
        click Store "https://github.com/github1586/nuxt-bnhcp/tree/master/store"
        Static[Static Assets]:::frontend
        click Static "https://github.com/github1586/nuxt-bnhcp/tree/master/static"
        
        CourseComp[Course Components]:::frontend
        click CourseComp "https://github.com/github1586/nuxt-bnhcp/tree/master/components/common/courseDetail"
        CartUI[Shopping Cart UI]:::frontend
        click CartUI "https://github.com/github1586/nuxt-bnhcp/blob/master/pages/shoppingCart.vue"
        PaymentUI[Payment UI]:::frontend
        click PaymentUI "https://github.com/github1586/nuxt-bnhcp/blob/master/pages/order/payOrder.vue"
        
        HTTPClient[Axios Client]:::frontend
        click HTTPClient "https://github.com/github1586/nuxt-bnhcp/blob/master/plugins/axios.js"
    end

    subgraph "Backend Layer"
        Express[Express.js Server]:::backend
        click Express "https://github.com/github1586/nuxt-bnhcp/blob/master/server/index.js"
        
        subgraph "API Controllers"
            APIInterface[API Interface]:::api
            click APIInterface "https://github.com/github1586/nuxt-bnhcp/blob/master/server/api/controller/interface.js"
            Auth[Authentication]:::api
            click Auth "https://github.com/github1586/nuxt-bnhcp/tree/master/server/api/controller/login"
            Cart[Shopping Cart]:::api
            click Cart "https://github.com/github1586/nuxt-bnhcp/tree/master/server/api/controller/cart"
            Course[Course Management]:::api
            click Course "https://github.com/github1586/nuxt-bnhcp/tree/master/server/api/controller/course"
            Order[Order Processing]:::api
            click Order "https://github.com/github1586/nuxt-bnhcp/tree/master/server/api/controller/order"
        end
    end

    subgraph "Data Layer"
        MySQL[(MySQL Database)]:::database
        click MySQL "https://github.com/github1586/nuxt-bnhcp/tree/master/server/api/model"
        Redis[(Redis Cache)]:::cache
        click Redis "https://github.com/github1586/nuxt-bnhcp/blob/master/server/api/redis/redis.js"
        DBConfig[Database Config]:::database
        click DBConfig "https://github.com/github1586/nuxt-bnhcp/blob/master/server/api/model/settings.js"
    end

    Browser --> Nginx
    Nginx --> TCloud
    TCloud --> NuxtSSR
    NuxtSSR <--> Express
    
    Components --> Store
    Pages --> Store
    Store --> HTTPClient
    HTTPClient --> APIInterface
    
    CourseComp --> Store
    CartUI --> Store
    PaymentUI --> Store
    
    Express --> APIInterface
    APIInterface --> Auth
    APIInterface --> Cart
    APIInterface --> Course
    APIInterface --> Order
    
    Auth --> MySQL
    Cart --> MySQL
    Course --> MySQL
    Order --> MySQL
    
    MySQL <--> Redis
    MySQL --> DBConfig

    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef database fill:#f1c40f,stroke:#f39c12,color:black
    classDef cache fill:#e67e22,stroke:#d35400,color:white
    classDef api fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef proxy fill:#9b59b6,stroke:#8e44ad,color:white
    classDef cloud fill:#34495e,stroke:#2c3e50,color:white
    classDef nuxt fill:#e74c3c,stroke:#c0392b,color:white
```
