# hoangson27/intern-project architecture

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

- Interactive diagram: https://gitdiagram.com/hoangson27/intern-project
- Repository: https://github.com/hoangson27/intern-project

## Overview

##### Main Components
- Frontend: Located in the "frontend" directory, this is built using Vue.js (with single-file components like App.vue, Admin.vue, Home.vue, etc.). It handles user interactions and renders views for both customers and administrative roles.
- Backend: Found in the "backend" directory and clearly built as a Node.js (likely Express-based) application. It has a modular structure with controllers (billdetails.js, booktable.js, food.js, etc.), models (BillDetailsModel.js, UserModel.js, etc.), routes (routes.js), and configuration files (database.js).
- Database: Although not explicitly defined in a separate directory, the existence of a “db_restaurant.sql” file in the frontend resources suggests that the project uses a relational database (perhaps MySQL) which stores restaurant data, user orders, table reservations, and food-related info.
- External dependencies & configuration management: Various configuration files like .gitignore, package.json (for both backend and frontend), and deployment-related configurations (vue.config.js, babel.config.js) indicate environment management and build pipeline details.

##### Relationships and Interactions
- The frontend communicates with the backend via HTTP APIs. The Vue application makes API calls (likely using the axios instance defined in src/axios.js) to the Node service.
- The backend follows a Model-View-Controller (MVC) separation:
- Routes receive requests and delegate responsibility to controllers.
- Controllers interact with models to execute business logic or database operations.
- Data flows from the backend to the database and vice versa. The SQL file helps establish schema requirements for the restaurant’s data.

##### Architectural Patterns
- Client-Server Architecture: The separation between the Vue-powered frontend and Node.js backend encourages clear separation of concerns.
- Modularization: The division of components in both frontend and backend into distinct directories highlights a modular approach.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Subgraph
    subgraph "Frontend"
        F1["App.vue"]:::frontend
        F2["main.js"]:::frontend
        F3["Pages"]:::frontend
        F4["Admin Views"]:::frontend
        F5["Components"]:::frontend
        F6["Axios Instance"]:::frontend
    end

    %% Backend Subgraph
    subgraph "Backend"
        B1["Backend Core"]:::backend
        B2["Controllers"]:::backend
        B3["Models"]:::backend
        B4["Routes"]:::backend
    end

    %% Database Subgraph
    subgraph "Database"
        D1["Restaurant Database"]:::database
    end

    %% Configurations Subgraph
    subgraph "Configurations"
        C1["Backend Package"]:::config
        C2["Frontend Package"]:::config
        C3["Vue Config"]:::config
        C4["Babel Config"]:::config
        C5["Database Config"]:::config
    end

    %% Relationships and Data Flow
    F1 -->|"API_call"| B1
    F6 -->|"calls_API"| B1
    F3 -->|"renders"| F1
    F4 -->|"renders"| F1

    B4 -->|"delegates_to"| B2
    B2 -->|"executes_logic_with"| B3
    B1 -->|"queries"| D1

    %% External Configurations Connections
    C2 -->|"builds"| F1
    C3 -->|"sets_up"| F1
    C4 -->|"transpiles"| F1
    C1 -->|"configures"| B1
    C5 -->|"connects_to_DB"| B1

    %% Click Events for Frontend Components
    click F1 "https://github.com/hoangson27/intern-project/blob/main/frontend/src/App.vue"
    click F2 "https://github.com/hoangson27/intern-project/blob/main/frontend/src/main.js"
    click F3 "https://github.com/hoangson27/intern-project/tree/main/frontend/src/pages"
    click F4 "https://github.com/hoangson27/intern-project/tree/main/frontend/src/admin"
    click F5 "https://github.com/hoangson27/intern-project/tree/main/frontend/src/components"
    click F6 "https://github.com/hoangson27/intern-project/blob/main/frontend/src/axios.js"

    %% Click Events for Backend Components
    click B1 "https://github.com/hoangson27/intern-project/tree/main/backend"
    click B2 "https://github.com/hoangson27/intern-project/tree/main/backend/controllers"
    click B3 "https://github.com/hoangson27/intern-project/tree/main/backend/models"
    click B4 "https://github.com/hoangson27/intern-project/blob/main/backend/routes/routes.js"

    %% Click Events for Database Schema
    click D1 "https://github.com/hoangson27/intern-project/blob/main/frontend/src/resources/db_restaurant.sql"

    %% Click Events for Configuration Files
    click C1 "https://github.com/hoangson27/intern-project/blob/main/backend/package.json"
    click C2 "https://github.com/hoangson27/intern-project/blob/main/frontend/package.json"
    click C3 "https://github.com/hoangson27/intern-project/blob/main/frontend/vue.config.js"
    click C4 "https://github.com/hoangson27/intern-project/blob/main/frontend/babel.config.js"
    click C5 "https://github.com/hoangson27/intern-project/blob/main/backend/config/database.js"

    %% Styles
    classDef frontend fill:#ccf,stroke:#333,stroke-width:2px;
    classDef backend fill:#cfc,stroke:#333,stroke-width:2px;
    classDef database fill:#fcc,stroke:#333,stroke-width:2px;
    classDef config fill:#fcf,stroke:#333,stroke-width:2px;
```
