# nycs86/libsync architecture

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

- Interactive diagram: https://gitdiagram.com/nycs86/libsync
- Repository: https://github.com/nycs86/libsync

## Overview

LibSync is a library-management application with role-specific entry points for administrators, librarians, and students. Users select a role and enter its login/dashboard flow; the clearest sampled operational workflow is a librarian fetching and deciding student borrow requests, which the backend persists alongside QR-enabled request batches. The tree also shows separate user, book, borrowing, and student API modules, though their detailed behavior was not sampled. Student book selection and QR display are evidenced in the dashboard excerpt; its connection to the request API is not established.

Main entry points: [`frontend/src/App.jsx`](https://github.com/nycs86/libsync/blob/main/frontend/src/App.jsx) (Role entry), [`backend/app.py`](https://github.com/nycs86/libsync/blob/main/backend/app.py) (Flask API), [`backend/routes/borrow_requests.py`](https://github.com/nycs86/libsync/blob/main/backend/routes/borrow_requests.py) (Borrow requests), [`backend/routes/auth.py`](https://github.com/nycs86/libsync/blob/main/backend/routes/auth.py) (Login and roles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_app["Role entry<br/>[App.jsx]"]
  node_role["Role choice<br/>[role.jsx]"]
  node_adminlogin["Admin login<br/>[admin_login.jsx]"]
  node_librarianlogin["Librarian login"]
  node_studentlogin["Student login<br/>[student_login.jsx]"]
  node_admindash["Admin dashboard"]
  node_librariandash["Librarian dashboard"]
  node_studentdash["Student dashboard"]
end

subgraph group_backend["API service"]
  node_api["Flask API<br/>[app.py]"]
  node_borrowrequests["Borrow requests<br/>[borrow_requests.py]"]
  node_borrowings["Borrowing records<br/>[borrowings.py]"]
  node_studentroutes["Student routes<br/>[student.py]"]
end

subgraph group_identity["Identity and access"]
  node_auth["Login and roles<br/>[auth.py]"]
  node_users["User routes<br/>[users.py]"]
end

subgraph group_librarydata["Library data"]
  node_books["Book routes<br/>[books.py]"]
  node_dbaccess["Database access<br/>[database.py]"]
  node_mysql[("Library database")]
end

node_user(("Library user"))

node_user -->|"opens"| node_app
node_app -->|"renders"| node_role
node_app -->|"renders"| node_adminlogin
node_app -->|"renders"| node_librarianlogin
node_app -->|"renders"| node_studentlogin
node_app -->|"renders"| node_admindash
node_app -->|"renders"| node_librariandash
node_app -->|"renders"| node_studentdash
node_api -->|"registers"| node_auth
node_api -->|"registers"| node_users
node_api -->|"registers"| node_books
node_api -->|"registers"| node_borrowrequests
node_api -->|"registers"| node_borrowings
node_api -->|"registers"| node_studentroutes
node_librariandash -->|"fetches and decides"| node_borrowrequests
node_borrowrequests -->|"checks roles"| node_auth
node_borrowrequests -->|"queries and updates"| node_dbaccess
node_auth -->|"looks up users"| node_dbaccess
node_dbaccess -->|"connects"| node_mysql

click node_app "https://github.com/nycs86/libsync/blob/main/frontend/src/App.jsx"
click node_role "https://github.com/nycs86/libsync/blob/main/frontend/src/components/role.jsx"
click node_adminlogin "https://github.com/nycs86/libsync/blob/main/frontend/src/components/admin_login.jsx"
click node_librarianlogin "https://github.com/nycs86/libsync/blob/main/frontend/src/components/librarian_login.jsx"
click node_studentlogin "https://github.com/nycs86/libsync/blob/main/frontend/src/components/student_login.jsx"
click node_admindash "https://github.com/nycs86/libsync/blob/main/frontend/src/components/admin_dashboard.jsx"
click node_librariandash "https://github.com/nycs86/libsync/blob/main/frontend/src/components/librarian_dashboard.jsx"
click node_studentdash "https://github.com/nycs86/libsync/blob/main/frontend/src/components/student_dashboard.jsx"
click node_api "https://github.com/nycs86/libsync/blob/main/backend/app.py"
click node_auth "https://github.com/nycs86/libsync/blob/main/backend/routes/auth.py"
click node_users "https://github.com/nycs86/libsync/blob/main/backend/routes/users.py"
click node_books "https://github.com/nycs86/libsync/blob/main/backend/routes/books.py"
click node_borrowrequests "https://github.com/nycs86/libsync/blob/main/backend/routes/borrow_requests.py"
click node_borrowings "https://github.com/nycs86/libsync/blob/main/backend/routes/borrowings.py"
click node_studentroutes "https://github.com/nycs86/libsync/blob/main/backend/routes/student.py"
click node_dbaccess "https://github.com/nycs86/libsync/blob/main/backend/database.py"

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_role,node_adminlogin,node_librarianlogin,node_studentlogin,node_admindash,node_librariandash,node_studentdash,node_user toneBlue
class node_api,node_borrowrequests,node_borrowings,node_studentroutes toneAmber
class node_auth,node_users toneMint
class node_books,node_dbaccess,node_mysql toneRose
```

## Components

### Web application

- [Role entry](https://github.com/nycs86/libsync/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Role choice](https://github.com/nycs86/libsync/blob/main/frontend/src/components/role.jsx): `frontend/src/components/role.jsx`
- [Admin login](https://github.com/nycs86/libsync/blob/main/frontend/src/components/admin_login.jsx): `frontend/src/components/admin_login.jsx`
- [Librarian login](https://github.com/nycs86/libsync/blob/main/frontend/src/components/librarian_login.jsx): `frontend/src/components/librarian_login.jsx`
- [Student login](https://github.com/nycs86/libsync/blob/main/frontend/src/components/student_login.jsx): `frontend/src/components/student_login.jsx`
- [Admin dashboard](https://github.com/nycs86/libsync/blob/main/frontend/src/components/admin_dashboard.jsx): `frontend/src/components/admin_dashboard.jsx`
- [Librarian dashboard](https://github.com/nycs86/libsync/blob/main/frontend/src/components/librarian_dashboard.jsx): `frontend/src/components/librarian_dashboard.jsx`
- [Student dashboard](https://github.com/nycs86/libsync/blob/main/frontend/src/components/student_dashboard.jsx): `frontend/src/components/student_dashboard.jsx`

### API service

- [Flask API](https://github.com/nycs86/libsync/blob/main/backend/app.py): `backend/app.py`
- [Borrow requests](https://github.com/nycs86/libsync/blob/main/backend/routes/borrow_requests.py): `backend/routes/borrow_requests.py`
- [Borrowing records](https://github.com/nycs86/libsync/blob/main/backend/routes/borrowings.py): `backend/routes/borrowings.py`
- [Student routes](https://github.com/nycs86/libsync/blob/main/backend/routes/student.py): `backend/routes/student.py`

### Identity and access

- [Login and roles](https://github.com/nycs86/libsync/blob/main/backend/routes/auth.py): `backend/routes/auth.py`
- [User routes](https://github.com/nycs86/libsync/blob/main/backend/routes/users.py): `backend/routes/users.py`

### Library data

- [Book routes](https://github.com/nycs86/libsync/blob/main/backend/routes/books.py): `backend/routes/books.py`
- [Database access](https://github.com/nycs86/libsync/blob/main/backend/database.py): `backend/database.py`
- **Library database**

### Other components

- **Library user**

## Connections

- Library user → Role entry: opens
- Role entry → Role choice: renders
- Role entry → Admin login: renders
- Role entry → Librarian login: renders
- Role entry → Student login: renders
- Role entry → Admin dashboard: renders
- Role entry → Librarian dashboard: renders
- Role entry → Student dashboard: renders
- Flask API → Login and roles: registers
- Flask API → User routes: registers
- Flask API → Book routes: registers
- Flask API → Borrow requests: registers
- Flask API → Borrowing records: registers
- Flask API → Student routes: registers
- Librarian dashboard → Borrow requests: fetches and decides
- Borrow requests → Login and roles: checks roles
- Borrow requests → Database access: queries and updates
- Login and roles → Database access: looks up users
- Database access → Library database: connects
