# mufaxp/mugalab architecture

> Architecture diagram of the GitHub repository mufaxp/mugalab, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mufaxp/mugalab
- Repository: https://github.com/mufaxp/mugalab

## Overview

MUGALAB is a school-laboratory management web app: public users view weekly schedules or submit schedule requests, which staff review and may turn into scheduled activities. The backend also manages inventory, borrowing, damage and practical-work reports, users, labs, and settings. README documents a WhatsApp chatbot, but its source is absent from this tree; chatbot internals and their wiring are therefore not mapped. Frontend and route behavior is represented only where supported by the tree and README.

Main entry points: [`backend/app.js`](https://github.com/mufaxp/mugalab/blob/main/backend/app.js) (Express API), [`backend/config/db.js`](https://github.com/mufaxp/mugalab/blob/main/backend/config/db.js) (MySQL database), [`backend/modules/pengajuan/pengajuan.controller.js`](https://github.com/mufaxp/mugalab/blob/main/backend/modules/pengajuan/pengajuan.controller.js) (Schedule requests), [`backend/modules/jadwal/jadwal.controller.js`](https://github.com/mufaxp/mugalab/blob/main/backend/modules/jadwal/jadwal.controller.js) (Schedule management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Web clients"]
  node_publicweb["Public frontend<br/>[main.js]"]
  node_loginweb["Login frontend<br/>[script.js]"]
end

subgraph group_api["API foundation"]
  node_apiapp["Express API<br/>[app.js]"]
  node_database[("MySQL database<br/>[db.js]")]
  node_whatsapp["WhatsApp notifications<br/>[whatsapp.js]"]
end

subgraph group_operations["Lab operations"]
  node_jadwal["Schedule management"]
  node_pengajuan["Schedule requests"]
  node_alat["Equipment inventory<br/>[alat.controller.js]"]
  node_bahan["Materials and usage"]
  node_sarana["Facilities inventory"]
  node_peminjaman["Loans and returns"]
  node_damage["Damage reports"]
  node_practicum["Practical-work reports"]
  node_pdf["PDF generation"]
end

subgraph group_admin["Administration"]
  node_auth["Authentication<br/>[auth.controller.js]"]
  node_labs["Lab management<br/>[lab.controller.js]"]
  node_users["User management<br/>[user.controller.js]"]
  node_settings["Web settings"]
end

node_visitors(("Public users"))
node_staff(("Admin, laboran, guru"))
node_fonnte["Fonnte service"]

node_visitors -->|"use"| node_publicweb
node_staff -->|"sign in"| node_loginweb
node_publicweb -->|"request API"| node_apiapp
node_loginweb -->|"request API"| node_apiapp
node_apiapp -->|"dispatches"| node_auth
node_apiapp -->|"dispatches"| node_jadwal
node_apiapp -->|"dispatches"| node_pengajuan
node_apiapp -->|"dispatches"| node_alat
node_apiapp -->|"dispatches"| node_bahan
node_apiapp -->|"dispatches"| node_sarana
node_apiapp -->|"dispatches"| node_peminjaman
node_apiapp -->|"dispatches"| node_damage
node_apiapp -->|"dispatches"| node_practicum
node_apiapp -->|"dispatches"| node_labs
node_apiapp -->|"dispatches"| node_users
node_apiapp -->|"dispatches"| node_settings
node_auth -->|"reads users"| node_database
node_jadwal -->|"reads/writes"| node_database
node_pengajuan -->|"reads/writes"| node_database
node_pengajuan -->|"creates schedule"| node_jadwal
node_alat -->|"reads/writes"| node_database
node_bahan -->|"reads/writes"| node_database
node_sarana -->|"reads/writes"| node_database
node_peminjaman -->|"reads/writes"| node_database
node_peminjaman -->|"records damage"| node_damage
node_damage -->|"reads/writes"| node_database
node_practicum -->|"reads/writes"| node_database
node_practicum -->|"generates PDF"| node_pdf
node_labs -->|"reads/writes"| node_database
node_users -->|"reads/writes"| node_database
node_settings -->|"reads/writes"| node_database
node_jadwal -->|"sends alerts"| node_whatsapp
node_pengajuan -->|"sends alerts"| node_whatsapp
node_whatsapp -.->|"sends messages"| node_fonnte

click node_publicweb "https://github.com/mufaxp/mugalab/blob/main/frontend/js/main.js"
click node_loginweb "https://github.com/mufaxp/mugalab/blob/main/frontend/login/script.js"
click node_apiapp "https://github.com/mufaxp/mugalab/blob/main/backend/app.js"
click node_database "https://github.com/mufaxp/mugalab/blob/main/backend/config/db.js"
click node_auth "https://github.com/mufaxp/mugalab/blob/main/backend/modules/auth/auth.controller.js"
click node_jadwal "https://github.com/mufaxp/mugalab/blob/main/backend/modules/jadwal/jadwal.controller.js"
click node_pengajuan "https://github.com/mufaxp/mugalab/blob/main/backend/modules/pengajuan/pengajuan.controller.js"
click node_alat "https://github.com/mufaxp/mugalab/blob/main/backend/modules/alat/alat.controller.js"
click node_bahan "https://github.com/mufaxp/mugalab/blob/main/backend/modules/bahan/bahan.controller.js"
click node_sarana "https://github.com/mufaxp/mugalab/blob/main/backend/modules/sarana/sarana.controller.js"
click node_peminjaman "https://github.com/mufaxp/mugalab/blob/main/backend/modules/peminjaman/peminjaman.controller.js"
click node_damage "https://github.com/mufaxp/mugalab/blob/main/backend/modules/laporan-kerusakan/laporan-kerusakan.controller.js"
click node_practicum "https://github.com/mufaxp/mugalab/blob/main/backend/modules/laporan-praktikum/laporan-praktikum.controller.js"
click node_pdf "https://github.com/mufaxp/mugalab/blob/main/backend/modules/laporan-praktikum/laporan-praktikum.pdf.service.js"
click node_labs "https://github.com/mufaxp/mugalab/blob/main/backend/modules/lab/lab.controller.js"
click node_users "https://github.com/mufaxp/mugalab/blob/main/backend/modules/user/user.controller.js"
click node_settings "https://github.com/mufaxp/mugalab/blob/main/backend/modules/settings/settings.controller.js"
click node_whatsapp "https://github.com/mufaxp/mugalab/blob/main/backend/shared/utils/whatsapp.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_publicweb,node_loginweb,node_visitors toneBlue
class node_apiapp,node_database,node_whatsapp toneAmber
class node_jadwal,node_pengajuan,node_alat,node_bahan,node_sarana,node_peminjaman,node_damage,node_practicum,node_pdf toneMint
class node_auth,node_labs,node_users,node_settings toneRose
class node_staff,node_fonnte toneIndigo
```

## Components

### Web clients

- [Public frontend](https://github.com/mufaxp/mugalab/blob/main/frontend/js/main.js): `frontend/js/main.js`
- [Login frontend](https://github.com/mufaxp/mugalab/blob/main/frontend/login/script.js): `frontend/login/script.js`

### API foundation

- [Express API](https://github.com/mufaxp/mugalab/blob/main/backend/app.js): `backend/app.js`
- [MySQL database](https://github.com/mufaxp/mugalab/blob/main/backend/config/db.js): `backend/config/db.js`
- [WhatsApp notifications](https://github.com/mufaxp/mugalab/blob/main/backend/shared/utils/whatsapp.js): `backend/shared/utils/whatsapp.js`

### Lab operations

- [Schedule management](https://github.com/mufaxp/mugalab/blob/main/backend/modules/jadwal/jadwal.controller.js): `backend/modules/jadwal/jadwal.controller.js`
- [Schedule requests](https://github.com/mufaxp/mugalab/blob/main/backend/modules/pengajuan/pengajuan.controller.js): `backend/modules/pengajuan/pengajuan.controller.js`
- [Equipment inventory](https://github.com/mufaxp/mugalab/blob/main/backend/modules/alat/alat.controller.js): `backend/modules/alat/alat.controller.js`
- [Materials and usage](https://github.com/mufaxp/mugalab/blob/main/backend/modules/bahan/bahan.controller.js): `backend/modules/bahan/bahan.controller.js`
- [Facilities inventory](https://github.com/mufaxp/mugalab/blob/main/backend/modules/sarana/sarana.controller.js): `backend/modules/sarana/sarana.controller.js`
- [Loans and returns](https://github.com/mufaxp/mugalab/blob/main/backend/modules/peminjaman/peminjaman.controller.js): `backend/modules/peminjaman/peminjaman.controller.js`
- [Damage reports](https://github.com/mufaxp/mugalab/blob/main/backend/modules/laporan-kerusakan/laporan-kerusakan.controller.js): `backend/modules/laporan-kerusakan/laporan-kerusakan.controller.js`
- [Practical-work reports](https://github.com/mufaxp/mugalab/blob/main/backend/modules/laporan-praktikum/laporan-praktikum.controller.js): `backend/modules/laporan-praktikum/laporan-praktikum.controller.js`
- [PDF generation](https://github.com/mufaxp/mugalab/blob/main/backend/modules/laporan-praktikum/laporan-praktikum.pdf.service.js): `backend/modules/laporan-praktikum/laporan-praktikum.pdf.service.js`

### Administration

- [Authentication](https://github.com/mufaxp/mugalab/blob/main/backend/modules/auth/auth.controller.js): `backend/modules/auth/auth.controller.js`
- [Lab management](https://github.com/mufaxp/mugalab/blob/main/backend/modules/lab/lab.controller.js): `backend/modules/lab/lab.controller.js`
- [User management](https://github.com/mufaxp/mugalab/blob/main/backend/modules/user/user.controller.js): `backend/modules/user/user.controller.js`
- [Web settings](https://github.com/mufaxp/mugalab/blob/main/backend/modules/settings/settings.controller.js): `backend/modules/settings/settings.controller.js`

### Other components

- **Public users**
- **Admin, laboran, guru**
- **Fonnte service**

## Connections

- Public users → Public frontend: use
- Admin, laboran, guru → Login frontend: sign in
- Public frontend → Express API: request API
- Login frontend → Express API: request API
- Express API → Authentication: dispatches
- Express API → Schedule management: dispatches
- Express API → Schedule requests: dispatches
- Express API → Equipment inventory: dispatches
- Express API → Materials and usage: dispatches
- Express API → Facilities inventory: dispatches
- Express API → Loans and returns: dispatches
- Express API → Damage reports: dispatches
- Express API → Practical-work reports: dispatches
- Express API → Lab management: dispatches
- Express API → User management: dispatches
- Express API → Web settings: dispatches
- Authentication → MySQL database: reads users
- Schedule management → MySQL database: reads/writes
- Schedule requests → MySQL database: reads/writes
- Schedule requests → Schedule management: creates schedule
- Equipment inventory → MySQL database: reads/writes
- Materials and usage → MySQL database: reads/writes
- Facilities inventory → MySQL database: reads/writes
- Loans and returns → MySQL database: reads/writes
- Loans and returns → Damage reports: records damage
- Damage reports → MySQL database: reads/writes
- Practical-work reports → MySQL database: reads/writes
- Practical-work reports → PDF generation: generates PDF
- Lab management → MySQL database: reads/writes
- User management → MySQL database: reads/writes
- Web settings → MySQL database: reads/writes
- Schedule management → WhatsApp notifications: sends alerts
- Schedule requests → WhatsApp notifications: sends alerts
- WhatsApp notifications → Fonnte service: sends messages
