# thanhhangdang/ltnc architecture

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

- Interactive diagram: https://gitdiagram.com/thanhhangdang/ltnc
- Repository: https://github.com/thanhhangdang/ltnc

## Overview

##### Main Components
a. Frontend (Client) – Represent the LTNCfe folder:
- That this is a React-based client application.
- UI components such as login, admin dashboard, student and teacher interfaces.
- Directories like “public” and “src/components” to represent the different pages and features.

b. Backend (Server) – Represent the LTNCbe folder:
- Entry point (server.js) and router.js which handles API endpoints.
- Configuration modules (corsConfig.js, databaseConfig.js) to show how cross-origin and database settings are managed.
- Mention that the backend uses Node.js and integrates with MySQL (as suggested by the SQL database files).

c. Database:
- MySQL database system.
- “database.sql” file is used for setting up the schema and data.

##### Architectural Patterns and Design Principles
- Separation between presentation (frontend) and business logic/data access (backend).
- Although it is not explicitly microservices, the division into LTNCfe and LTNCbe signifies at least a two-tier architecture.
- Use of RESTful APIs if applicable (suggested by the routing file).
- You might also mention any common patterns used in React-based applications (component-based structure) and Node.js server setups.

##### Relevant Technologies, Frameworks, and Libraries
- Frontend: React, possibly create-react-app (inferred from project structure), with separate components for different roles (admin, student, teacher).
- Backend: Node.js and Express (assumed since server.js and router.js are present), with modules for CORS and database configuration.
- Database: MySQL (using the provided SQL file for database schema).
- Other: npm for dependency management (as seen from package.json files in both LTNCbe and LTNCfe).

## Diagram (Mermaid)

```mermaid
graph TD
    %% Frontend Subgraph
    subgraph "Frontend (Client)"
        FE1["React Client App"]:::frontend
        FE2["UI Components (Admin,Student,Teacher,Login)"]:::frontend
    end

    %% Backend Subgraph
    subgraph "Backend (Server)"
        BE0["Backend Application"]:::backend
        BE1["Server Entry Point (server.js)"]:::backend
        BE2["API Routing Module (router.js)"]:::backend
        BE3["CORS Configuration (corsConfig.js)"]:::backend
        BE4["Database Configuration (databaseConfig.js)"]:::backend
    end

    %% Database Node
    DB["MySQL Database Schema (database.sql)"]:::database

    %% Interactions
    FE2 -->|"composes"| FE1
    FE1 -->|"HTTP/REST_API_calls"| BE0
    BE0 -->|"starts"| BE1
    BE0 -->|"uses"| BE2
    BE0 -->|"applies"| BE3
    BE0 -->|"connects_via"| BE4
    BE1 -->|"MySQL_queries"| DB

    %% Click Events
    click FE1 "https://github.com/thanhhangdang/ltnc/tree/main/LTNCfe"
    click FE2 "https://github.com/thanhhangdang/ltnc/tree/main/LTNCfe/src/components"
    click BE0 "https://github.com/thanhhangdang/ltnc/tree/main/LTNCbe"
    click BE1 "https://github.com/thanhhangdang/ltnc/blob/main/LTNCbe/server.js"
    click BE2 "https://github.com/thanhhangdang/ltnc/blob/main/LTNCbe/router.js"
    click BE3 "https://github.com/thanhhangdang/ltnc/blob/main/LTNCbe/config/corsConfig.js"
    click BE4 "https://github.com/thanhhangdang/ltnc/blob/main/LTNCbe/config/databaseConfig.js"
    click DB "https://github.com/thanhhangdang/ltnc/blob/main/LTNCbe/database.sql"

    %% Styles
    classDef frontend fill:#ffe6e6,stroke:#cc0000,stroke-width:2px;
    classDef backend fill:#e6e6ff,stroke:#0000cc,stroke-width:2px;
    classDef database fill:#e6ffe6,stroke:#00cc00,stroke-width:2px;
```
