# amithm7/web-sis architecture

> Architecture diagram of the GitHub repository amithm7/web-sis, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/amithm7/web-sis
- Repository: https://github.com/amithm7/web-sis

## Overview

##### Main Components

A. Client Layer:
- Web Browser Interface (HTML/CSS/JS)
- Two main views: Login (login.html) and Main App (app.html)
- Static assets (public folder with css, js, and img)

B. Server Layer:
- Node.js Server (server.js)
- API Endpoints
- Authentication System (evident from login.html)

C. Data Layer:
- MySQL Database (SIS)
- Relational Tables (defined in relations.sql)

**┌─────────────────┐**
- Presentation   │ (Browser Layer)
- ┬────────┘

**┌────────┴────────┐**
- Application    │ (Node.js Server)
- ┬────────┘

**┌────────┴────────┐**
- Database     │ (MySQL)
- ┘

##### Detailed Component Breakdown

A. Presentation Layer (Top):
- Login Interface
- Main Application Interface
- Static asset containers:
- CSS Files (common.css, login.css, app.css)
- JavaScript (app.js)
- Images

B. Application Layer (Middle):
- Node.js Server
- API Routes
- Authentication Handler
- Session Management

C. Data Layer (Bottom):
- MySQL Database (SIS)
- Relational Tables (from relations.sql)

##### Connection and Flow Indicators

- HTTP/HTTPS requests between browser and server
- Database queries between server and MySQL
- Authentication flow from login page through server to database
- Static asset delivery paths

##### Additional Elements

- User session flow
- API endpoint groupings
- Database connection pool
- Static file serving path

##### Specific Implementation Details

**→ HTTP Request**
**⇢ Database Query**
**⇄ Two-way Communication**

- The separation between static content (in app/public) and dynamic server responses
- The authentication flow from login.html to the main app.html
- The database relationship with the API user 'sisAPI'
- The connection between server.js and the MySQL database

## Diagram (Mermaid)

```mermaid
graph TB
    %% Client Layer
    subgraph Client
        WI[Web Interface]
        SA[Static Assets]
        subgraph Browser["Browser Components"]
            LP["Login Page"]:::page
            AP["App Page"]:::page
        end
        subgraph Assets["Asset Components"]
            CSS["Stylesheets"]:::static
            JS["JavaScript"]:::static
            IMG["Images"]:::static
        end
    end

    %% Application Layer
    subgraph Server
        NS["Node.js Server"]:::server
        API["API Layer"]:::api
        AUTH["Authentication"]:::security
    end

    %% Data Layer
    subgraph Database
        DB[(MySQL Database)]:::database
        REL["Database Relations"]:::database
    end

    %% Connections
    WI --> |HTTP/HTTPS| API
    SA --> |Static Files| WI
    API --> AUTH
    AUTH --> DB
    API --> DB
    Browser --> WI
    Assets --> SA

    %% Component Relationships
    LP --> AUTH
    AP --> API
    CSS --> SA
    JS --> SA
    IMG --> SA

    %% Styles
    classDef page fill:#ddf,stroke:#333,stroke-width:2px
    classDef static fill:#fdd,stroke:#333,stroke-width:2px
    classDef server fill:#dfd,stroke:#333,stroke-width:2px
    classDef api fill:#ffd,stroke:#333,stroke-width:2px
    classDef security fill:#fdf,stroke:#333,stroke-width:2px
    classDef database fill:#dff,stroke:#333,stroke-width:2px

    %% Click Events
    click AP "https://github.com/amithm7/web-sis/blob/master/app/app.html"
    click LP "https://github.com/amithm7/web-sis/blob/master/app/login.html"
    click CSS "https://github.com/amithm7/web-sis/tree/master/app/public/css/"
    click JS "https://github.com/amithm7/web-sis/tree/master/app/public/js/"
    click IMG "https://github.com/amithm7/web-sis/tree/master/app/public/img/"
    click NS "https://github.com/amithm7/web-sis/blob/master/server.js"
    click REL "https://github.com/amithm7/web-sis/blob/master/db/relations.sql"

    %% Legend
    subgraph Legend
        L1[Frontend Pages]:::page
        L2[Static Assets]:::static
        L3[Server Components]:::server
        L4[API Components]:::api
        L5[Security Components]:::security
        L6[(Database Components)]:::database
    end
```
