# ohiayame/gsc-portal architecture

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

- Interactive diagram: https://gitdiagram.com/ohiayame/gsc-portal
- Repository: https://github.com/ohiayame/gsc-portal

## Overview

##### Project type and purpose
- This is a full-stack web application: a university department portal that combines a Vue 3 frontend (Vite, Pinia, Vue Router, Axios) with an Express.js backend and MySQL database.
- It offers role-based access (student, professor, admin), timetable management, level assignment, notices, Google Calendar integration, LINE notifications, and government holiday API integration.

##### File structure
- Top-level “vue-project/” directory splits into “backend/” (Express server) and “src/” (Vue frontend), matching a clear frontend–backend separation.
- Backend:
- controllers/ (business logic per feature)
- routes/ (REST endpoints)
- models/ (SQL query modules)
- middleware/ (authentication via JWT & Google OAuth)
- utils/ (external API wrappers: Google Calendar, LINE, holiday API)
- server.js (app entry)
- Frontend:
- App.vue & main.js (entry, router/store init)
- pages/ (Vue Router views)
- components/ (reusable UI)
- stores/ (Pinia state modules)
- router/ (route definitions)
- services/ (Axios API helpers)
- External configuration files: .env (dotenv), CORS, package.json, vite.config.js

##### Extract key architecture insights from README
- Auth flow: Google OAuth2 → backend issues JWT + refresh token, cookie-based refresh.
- Data flows: Vue UI ↔ Express REST API ↔ MySQL; backend ↔ Google Calendar API; backend ↔ LINE Messaging API; backend ↔ government holiday API.
- No ORM: models use raw SQL.
- Drag & drop UI indicates client-side state and event handling.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "UI Layer" 
        direction TB
        Main["main.js"]:::frontend
        App["App.vue"]:::frontend
        Router["Router (index.js)"]:::frontend
        subgraph "Stores" 
            direction TB
            Stores["Pinia Stores"]:::frontend
        end
        subgraph "Pages" 
            direction TB
            Pages["Pages (src/pages/)"]:::frontend
        end
        subgraph "Components" 
            direction TB
            Components["UI Components"]:::frontend
        end
        Composable["useGoogleLogin.js"]:::frontend
        subgraph "Config & Tooling"
            direction TB
            IndexHTML["index.html"]:::frontend
            ViteConfig["vite.config.js"]:::frontend
            FEPackage["package.json"]:::frontend
        end
    end

    %% Backend Layer
    subgraph "Backend Layer"
        direction TB
        Server["server.js"]:::backend
        DBConfig["db.js"]:::backend
        AuthMW["auth.js"]:::backend
        subgraph "Controllers"
            direction TB
            Controllers["controllers/"]:::backend
        end
        subgraph "Routes"
            direction TB
            Routes["routes/"]:::backend
        end
        subgraph "Models"
            direction TB
            Models["models/"]:::backend
        end
        subgraph "Utils"
            direction TB
            Utils["utils/"]:::backend
        end
        BEPackage["package.json"]:::backend
        ESLint["eslint.config.js"]:::backend
    end

    %% Database
    MySQLDB["MySQL DB"]:::database

    %% External Services
    subgraph "External Services"
        direction TB
        GoogleOAuth["Google OAuth2"]:::external
        GoogleCal["Google Calendar API"]:::external
        LINEAPI["LINE Messaging API"]:::external
        HolidayAPI["Holiday API"]:::external
    end

    %% Connections
    App -->|"REST API (Axios/JSON)"| Server
    Server -->|"uses config"| DBConfig
    Server -->|"SQL queries"| MySQLDB
    Server -->|"Auth redirect & token exchange"| GoogleOAuth
    Server -->|"Event CRUD"| GoogleCal
    Server -.->|"Push notifications"| LINEAPI
    Server -->|"Fetch holiday list"| HolidayAPI

    %% Click Events
    click Main "https://github.com/ohiayame/gsc-portal/blob/main/vue-project/src/main.js"
    click App "https://github.com/ohiayame/gsc-portal/blob/main/vue-project/src/App.vue"
    click Router "https://github.com/ohiayame/gsc-portal/blob/main/vue-project/src/router/index.js"
    click Stores "https://github.com/ohiayame/gsc-portal/tree/main/vue-project/src/stores/"
    click Pages "https://github.com/ohiayame/gsc-portal/tree/main/vue-project/src/pages/"
    click Components "https://github.com/ohiayame/gsc-portal/tree/main/vue-project/src/components/"
    click Composable "https://github.com/ohiayame/gsc-portal/blob/main/vue-project/src/composables/useGoogleLogin.js"
    click IndexHTML "https://github.com/ohiayame/gsc-portal/blob/main/vue-project/index.html"
    click ViteConfig "https://github.com/ohiayame/gsc-portal/blob/main/vue-project/vite.config.js"
    click FEPackage "https://github.com/ohiayame/gsc-portal/blob/main/vue-project/package.json"
    click Server "https://github.com/ohiayame/gsc-portal/blob/main/vue-project/backend/server.js"
    click DBConfig "https://github.com/ohiayame/gsc-portal/blob/main/vue-project/backend/config/db.js"
    click AuthMW "https://github.com/ohiayame/gsc-portal/blob/main/vue-project/backend/middleware/auth.js"
    click Controllers "https://github.com/ohiayame/gsc-portal/tree/main/vue-project/backend/controllers/"
    click Routes "https://github.com/ohiayame/gsc-portal/tree/main/vue-project/backend/routes/"
    click Models "https://github.com/ohiayame/gsc-portal/tree/main/vue-project/backend/models/"
    click Utils "https://github.com/ohiayame/gsc-portal/tree/main/vue-project/backend/utils/"
    click BEPackage "https://github.com/ohiayame/gsc-portal/blob/main/vue-project/backend/package.json"
    click ESLint "https://github.com/ohiayame/gsc-portal/blob/main/vue-project/eslint.config.js"

    %% Styles
    classDef frontend fill:#E0F7FA,stroke:#00838F,color:#004D40
    classDef backend fill:#E8F5E9,stroke:#2E7D32,color:#1B5E20
    classDef database fill:#FFF3E0,stroke:#EF6C00,color:#E65100
    classDef external fill:#F3E5F5,stroke:#6A1B9A,color:#4A148C
```
