# syafariarigayo/sdm-yayasan-app architecture

> Architecture diagram of the GitHub repository syafariarigayo/sdm-yayasan-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/syafariarigayo/sdm-yayasan-app
- Repository: https://github.com/syafariarigayo/sdm-yayasan-app

## Overview

SDM Yayasan is a web app for managing foundation personnel records. Users sign in, then reach a dashboard summarizing personnel by unit and gender or manage SDM records, including PDF attachments. The frontend routes and guards these views; API requests reach an Express server, whose auth and SDM routes use JWT verification and a MySQL connection pool. The README documents the API and database capabilities; some frontend relationships rely on the SOURCE INDEX because not all source was excerpted.

Main entry points: [`frontend/src/App.jsx`](https://github.com/syafariarigayo/sdm-yayasan-app/blob/main/frontend/src/App.jsx) (Routes and access), [`backend/server.js`](https://github.com/syafariarigayo/sdm-yayasan-app/blob/main/backend/server.js) (Express server), [`backend/routes/sdm.js`](https://github.com/syafariarigayo/sdm-yayasan-app/blob/main/backend/routes/sdm.js) (SDM endpoints), [`frontend/src/api/axios.js`](https://github.com/syafariarigayo/sdm-yayasan-app/blob/main/frontend/src/api/axios.js) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_app["Routes and access<br/>[App.jsx]"]
  node_login["Login screen<br/>[Login.jsx]"]
  node_authstate["Auth state<br/>[AuthContext.jsx]"]
  node_layout["Navigation layout<br/>[Layout.jsx]"]
  node_dashboard["SDM dashboard<br/>[Dashboard.jsx]"]
  node_sdmview["SDM management<br/>[DataSDM.jsx]"]
  node_httpclient["API client<br/>[axios.js]"]
end

subgraph group_api["Backend API"]
  node_server["Express server<br/>[server.js]"]
  node_authroutes["Auth endpoints<br/>[auth.js]"]
  node_sdmroutes["SDM endpoints<br/>[sdm.js]"]
  node_jwt["JWT verification<br/>[auth.js]"]
end

subgraph group_data["Persistence"]
  node_pool["MySQL connection pool<br/>[db.js]"]
  node_mysql[("MySQL database")]
end

subgraph group_files["PDF files"]
  node_pdfstore[("Uploaded PDFs")]
end

node_user(("Admin user"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_layout
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_sdmview
node_app -->|"provides auth"| node_authstate
node_login -->|"submits credentials"| node_httpclient
node_login -->|"sets session"| node_authstate
node_layout -->|"reads session"| node_authstate
node_dashboard -->|"requests SDM"| node_httpclient
node_sdmview -->|"manages records"| node_httpclient
node_httpclient -->|"sends API requests"| node_server
node_server -->|"mounts /auth"| node_authroutes
node_server -->|"mounts /sdm"| node_sdmroutes
node_authroutes -->|"queries users"| node_pool
node_sdmroutes -->|"verifies requests"| node_jwt
node_sdmroutes -->|"queries SDM"| node_pool
node_pool -->|"connects to"| node_mysql
node_sdmroutes -->|"stores and deletes PDFs"| node_pdfstore
node_server -->|"serves uploads"| node_pdfstore

click node_app "https://github.com/syafariarigayo/sdm-yayasan-app/blob/main/frontend/src/App.jsx"
click node_login "https://github.com/syafariarigayo/sdm-yayasan-app/blob/main/frontend/src/pages/Login.jsx"
click node_authstate "https://github.com/syafariarigayo/sdm-yayasan-app/blob/main/frontend/src/context/AuthContext.jsx"
click node_layout "https://github.com/syafariarigayo/sdm-yayasan-app/blob/main/frontend/src/components/Layout.jsx"
click node_dashboard "https://github.com/syafariarigayo/sdm-yayasan-app/blob/main/frontend/src/pages/Dashboard.jsx"
click node_sdmview "https://github.com/syafariarigayo/sdm-yayasan-app/blob/main/frontend/src/pages/DataSDM.jsx"
click node_httpclient "https://github.com/syafariarigayo/sdm-yayasan-app/blob/main/frontend/src/api/axios.js"
click node_server "https://github.com/syafariarigayo/sdm-yayasan-app/blob/main/backend/server.js"
click node_authroutes "https://github.com/syafariarigayo/sdm-yayasan-app/blob/main/backend/routes/auth.js"
click node_sdmroutes "https://github.com/syafariarigayo/sdm-yayasan-app/blob/main/backend/routes/sdm.js"
click node_jwt "https://github.com/syafariarigayo/sdm-yayasan-app/blob/main/backend/middleware/auth.js"
click node_pool "https://github.com/syafariarigayo/sdm-yayasan-app/blob/main/backend/db.js"
click node_pdfstore "https://github.com/syafariarigayo/sdm-yayasan-app/tree/main/backend/uploads"

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_app,node_login,node_authstate,node_layout,node_dashboard,node_sdmview,node_httpclient,node_user toneBlue
class node_server,node_authroutes,node_sdmroutes,node_jwt toneAmber
class node_pool,node_mysql toneMint
class node_pdfstore toneRose
```

## Components

### Web application

- [Routes and access](https://github.com/syafariarigayo/sdm-yayasan-app/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Login screen](https://github.com/syafariarigayo/sdm-yayasan-app/blob/main/frontend/src/pages/Login.jsx): `frontend/src/pages/Login.jsx`
- [Auth state](https://github.com/syafariarigayo/sdm-yayasan-app/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Navigation layout](https://github.com/syafariarigayo/sdm-yayasan-app/blob/main/frontend/src/components/Layout.jsx): `frontend/src/components/Layout.jsx`
- [SDM dashboard](https://github.com/syafariarigayo/sdm-yayasan-app/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [SDM management](https://github.com/syafariarigayo/sdm-yayasan-app/blob/main/frontend/src/pages/DataSDM.jsx): `frontend/src/pages/DataSDM.jsx`
- [API client](https://github.com/syafariarigayo/sdm-yayasan-app/blob/main/frontend/src/api/axios.js): `frontend/src/api/axios.js`

### Backend API

- [Express server](https://github.com/syafariarigayo/sdm-yayasan-app/blob/main/backend/server.js): `backend/server.js`
- [Auth endpoints](https://github.com/syafariarigayo/sdm-yayasan-app/blob/main/backend/routes/auth.js): `backend/routes/auth.js`
- [SDM endpoints](https://github.com/syafariarigayo/sdm-yayasan-app/blob/main/backend/routes/sdm.js): `backend/routes/sdm.js`
- [JWT verification](https://github.com/syafariarigayo/sdm-yayasan-app/blob/main/backend/middleware/auth.js): `backend/middleware/auth.js`

### Persistence

- [MySQL connection pool](https://github.com/syafariarigayo/sdm-yayasan-app/blob/main/backend/db.js): `backend/db.js`
- **MySQL database**

### PDF files

- [Uploaded PDFs](https://github.com/syafariarigayo/sdm-yayasan-app/tree/main/backend/uploads): `backend/uploads`

### Other components

- **Admin user**

## Connections

- Admin user → Routes and access: uses (evidence: `frontend/src/App.jsx`)
- Routes and access → Login screen: routes to (evidence: `frontend/src/App.jsx`)
- Routes and access → Navigation layout: routes to (evidence: `frontend/src/App.jsx`)
- Routes and access → SDM dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Routes and access → SDM management: routes to (evidence: `frontend/src/App.jsx`)
- Routes and access → Auth state: provides auth (evidence: `frontend/src/App.jsx`)
- Login screen → API client: submits credentials (evidence: `frontend/src/pages/Login.jsx`)
- Login screen → Auth state: sets session (evidence: `frontend/src/pages/Login.jsx`)
- Navigation layout → Auth state: reads session (evidence: `frontend/src/components/Layout.jsx`)
- SDM dashboard → API client: requests SDM (evidence: `frontend/src/pages/Dashboard.jsx`)
- SDM management → API client: manages records (evidence: `frontend/src/pages/DataSDM.jsx`)
- API client → Express server: sends API requests (evidence: `README.md`)
- Express server → Auth endpoints: mounts /auth (evidence: `backend/server.js`)
- Express server → SDM endpoints: mounts /sdm (evidence: `backend/server.js`)
- Auth endpoints → MySQL connection pool: queries users (evidence: `backend/routes/auth.js`)
- SDM endpoints → JWT verification: verifies requests (evidence: `backend/routes/sdm.js`)
- SDM endpoints → MySQL connection pool: queries SDM (evidence: `backend/routes/sdm.js`)
- MySQL connection pool → MySQL database: connects to (evidence: `backend/db.js`)
- SDM endpoints → Uploaded PDFs: stores and deletes PDFs (evidence: `backend/routes/sdm.js`)
- Express server → Uploaded PDFs: serves uploads (evidence: `backend/server.js`)
