# rohit-10-ui/library-management-system architecture

> Architecture diagram of the GitHub repository rohit-10-ui/library-management-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rohit-10-ui/library-management-system
- Repository: https://github.com/rohit-10-ui/library-management-system

## Overview

1. This repository is a two-tier full-stack system: a Spring Boot backend in the root `src/` tree and a separate React frontend in `frontend/`. The two halves are developed and run independently, with the frontend calling backend HTTP APIs.

2. The backend is the authoritative application layer. Its entry point is `LibraryManagementSystemApplication.java`, built with Gradle and configured through `src/main/resources/application.properties`. The only visible persistence target is MySQL, accessed through Spring Data JPA.

3. The backend is currently centered on authentication and user registration rather than the broader library features described in the README. The visible REST surface is `AuthController`, which is the main boundary between the frontend and backend.

4. User registration is split by user type. `StudentSignupService` and `LibrarianSignupService` implement the signup logic, and `SignupServiceFactory` selects the correct service. This suggests a strategy/factory pattern around registration workflows.

5. Domain state in the backend is modeled with `User`, `Role`, and `ApprovalStatus`. These entities imply that accounts have role-based behavior and that at least some registrations may require approval before becoming active.

6. Data access is isolated in `UserRepository`, which is the persistence boundary for user records. The service layer sits between controllers and the repository, so the flow is: React form input → controller → signup service/factory → repository → MySQL.

7. The frontend is a React single-page application with entry files in `frontend/src/index.js` and `App.jsx`/`App.js`. The visible UI pieces are `Landing`, `Login`, and `Signup`, plus styling files, which indicates the current frontend scope is user-facing onboarding/auth screens.

8. The frontend’s job is presentation and API invocation, not business rules. The README references Axios for HTTP calls, so the frontend likely posts signup/login data to the backend API and renders responses such as success, failure, or approval status.

9. Build and runtime boundaries are cleanly separated. Gradle handles the Java backend build and test lifecycle, while npm handles the React app. This makes the repo deployable as two artifacts: a backend service and a frontend static/client bundle.

10. Testing is also split by tier. There is a Spring Boot test class under `src/test/...`, and the React app includes `App.test.js` with standard React testing setup files.

11. The README describes a larger “library management system” with books, borrowing, admin dashboards, and search, but those subsystems are not present in the current file tree. For an architecture diagram, the accurate live system is the auth/registration slice, with the rest appearing to be planned or undocumented.

12. External infrastructure is minimal and important: a local MySQL database on port 3306, a backend API on port 8080, and a React development server on port 3000. Those are the key deployment/runtime nodes to show in a diagram.

Main entry points: [`frontend/src/App.js`](https://github.com/rohit-10-ui/library-management-system/blob/main/frontend/src/App.js) (Main shell), [`src/main/java/com/example/library_management_system/repository/UserRepository.java`](https://github.com/rohit-10-ui/library-management-system/blob/main/src/main/java/com/example/library_management_system/repository/UserRepository.java) (User repository), [`src/main/java/com/example/library_management_system/service/SignupServiceFactory.java`](https://github.com/rohit-10-ui/library-management-system/blob/main/src/main/java/com/example/library_management_system/service/SignupServiceFactory.java) (Signup factory), [`src/main/java/com/example/library_management_system/entity/User.java`](https://github.com/rohit-10-ui/library-management-system/blob/main/src/main/java/com/example/library_management_system/entity/User.java) (User)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_backend["Spring Boot backend"]
  node_backend_app(("Backend app<br/>spring-boot entry"))
  node_backend_controller["Auth API<br/>rest controller"]
  node_backend_factory{{"Signup factory<br/>service factory"}}
  node_backend_student_service["Student signup<br/>signup service"]
  node_backend_librarian_service["Librarian signup<br/>signup service"]
  node_backend_user_repo[("User repository<br/>jpa repository")]
  node_backend_user["User<br/>entity<br/>[User.java]"]
  node_backend_role["Role<br/>enum<br/>[Role.java]"]
  node_backend_status["Approval status<br/>enum"]
  node_backend_config["App config<br/>spring config"]
end

subgraph group_frontend["React frontend"]
  node_frontend_app(("React app<br/>spa entry<br/>[index.js]"))
  node_frontend_main["Main shell<br/>ui shell<br/>[App.js]"]
  node_frontend_landing["Landing page<br/>ui screen<br/>[Landing.jsx]"]
  node_frontend_login["Login screen<br/>ui screen<br/>[Login.jsx]"]
  node_frontend_signup["Signup screen<br/>ui screen<br/>[Signup.jsx]"]
end

subgraph group_runtime["Runtime & data"]
  node_runtime_api(("Backend API<br/>http service"))
  node_runtime_db[("MySQL<br/>database")]
  node_runtime_dev(("React dev server<br/>http client"))
end

node_frontend_app -->|"mounts"| node_frontend_main
node_frontend_main -->|"renders"| node_frontend_landing
node_frontend_main -->|"renders"| node_frontend_login
node_frontend_main -->|"renders"| node_frontend_signup
node_frontend_signup -->|"POST signup"| node_runtime_api
node_frontend_login -->|"POST login"| node_runtime_api
node_runtime_dev -->|"serves"| node_frontend_app
node_runtime_api -->|"runs"| node_backend_app
node_backend_app -->|"exposes"| node_backend_controller
node_backend_controller -->|"delegates"| node_backend_factory
node_backend_factory -->|"selects"| node_backend_student_service
node_backend_factory -->|"selects"| node_backend_librarian_service
node_backend_student_service -->|"persists"| node_backend_user_repo
node_backend_librarian_service -->|"persists"| node_backend_user_repo
node_backend_user_repo -->|"maps"| node_backend_user
node_backend_user -->|"uses"| node_backend_role
node_backend_user -->|"uses"| node_backend_status
node_backend_user_repo -->|"reads/writes"| node_runtime_db
node_backend_config -->|"configures"| node_runtime_db

click node_backend_app "https://github.com/rohit-10-ui/library-management-system/blob/main/src/main/java/com/example/library_management_system/LibraryManagementSystemApplication.java"
click node_backend_controller "https://github.com/rohit-10-ui/library-management-system/blob/main/src/main/java/com/example/library_management_system/conroller/AuthController.java"
click node_backend_factory "https://github.com/rohit-10-ui/library-management-system/blob/main/src/main/java/com/example/library_management_system/service/SignupServiceFactory.java"
click node_backend_student_service "https://github.com/rohit-10-ui/library-management-system/blob/main/src/main/java/com/example/library_management_system/service/StudentSignupService.java"
click node_backend_librarian_service "https://github.com/rohit-10-ui/library-management-system/blob/main/src/main/java/com/example/library_management_system/service/LibrarianSignupService.java"
click node_backend_user_repo "https://github.com/rohit-10-ui/library-management-system/blob/main/src/main/java/com/example/library_management_system/repository/UserRepository.java"
click node_backend_user "https://github.com/rohit-10-ui/library-management-system/blob/main/src/main/java/com/example/library_management_system/entity/User.java"
click node_backend_role "https://github.com/rohit-10-ui/library-management-system/blob/main/src/main/java/com/example/library_management_system/entity/Role.java"
click node_backend_status "https://github.com/rohit-10-ui/library-management-system/blob/main/src/main/java/com/example/library_management_system/entity/ApprovalStatus.java"
click node_backend_config "https://github.com/rohit-10-ui/library-management-system/blob/main/src/main/resources/application.properties"
click node_frontend_app "https://github.com/rohit-10-ui/library-management-system/blob/main/frontend/src/index.js"
click node_frontend_main "https://github.com/rohit-10-ui/library-management-system/blob/main/frontend/src/App.js"
click node_frontend_landing "https://github.com/rohit-10-ui/library-management-system/blob/main/frontend/src/Landing.jsx"
click node_frontend_login "https://github.com/rohit-10-ui/library-management-system/blob/main/frontend/src/Login.jsx"
click node_frontend_signup "https://github.com/rohit-10-ui/library-management-system/blob/main/frontend/src/Signup.jsx"

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_backend_app,node_backend_controller,node_backend_factory,node_backend_student_service,node_backend_librarian_service,node_backend_user_repo,node_backend_user,node_backend_role,node_backend_status,node_backend_config toneBlue
class node_frontend_app,node_frontend_main,node_frontend_landing,node_frontend_login,node_frontend_signup toneAmber
class node_runtime_api,node_runtime_db,node_runtime_dev toneMint
```

## Components

### Spring Boot backend

Auth and registration API with JPA persistence

- [Backend app](https://github.com/rohit-10-ui/library-management-system/blob/main/src/main/java/com/example/library_management_system/LibraryManagementSystemApplication.java): spring-boot entry · Application bootstrap for the backend service · `src/main/java/com/example/library_management_system/LibraryManagementSystemApplication.java`
- [Auth API](https://github.com/rohit-10-ui/library-management-system/blob/main/src/main/java/com/example/library_management_system/conroller/AuthController.java): rest controller · Main HTTP boundary for login and signup · `src/main/java/com/example/library_management_system/conroller/AuthController.java`
- [Signup factory](https://github.com/rohit-10-ui/library-management-system/blob/main/src/main/java/com/example/library_management_system/service/SignupServiceFactory.java): service factory · Selects the registration workflow by user type · `src/main/java/com/example/library_management_system/service/SignupServiceFactory.java`
- [Student signup](https://github.com/rohit-10-ui/library-management-system/blob/main/src/main/java/com/example/library_management_system/service/StudentSignupService.java): signup service · Handles student registration logic · `src/main/java/com/example/library_management_system/service/StudentSignupService.java`
- [Librarian signup](https://github.com/rohit-10-ui/library-management-system/blob/main/src/main/java/com/example/library_management_system/service/LibrarianSignupService.java): signup service · Handles librarian registration logic · `src/main/java/com/example/library_management_system/service/LibrarianSignupService.java`
- [User repository](https://github.com/rohit-10-ui/library-management-system/blob/main/src/main/java/com/example/library_management_system/repository/UserRepository.java): jpa repository · Persistence boundary for user records · `src/main/java/com/example/library_management_system/repository/UserRepository.java`
- [User](https://github.com/rohit-10-ui/library-management-system/blob/main/src/main/java/com/example/library_management_system/entity/User.java): entity · Core account record · `src/main/java/com/example/library_management_system/entity/User.java`
- [Role](https://github.com/rohit-10-ui/library-management-system/blob/main/src/main/java/com/example/library_management_system/entity/Role.java): enum · Role-based access state · `src/main/java/com/example/library_management_system/entity/Role.java`
- [Approval status](https://github.com/rohit-10-ui/library-management-system/blob/main/src/main/java/com/example/library_management_system/entity/ApprovalStatus.java): enum · Registration approval state · `src/main/java/com/example/library_management_system/entity/ApprovalStatus.java`
- [App config](https://github.com/rohit-10-ui/library-management-system/blob/main/src/main/resources/application.properties): spring config · Backend runtime and datasource configuration · `src/main/resources/application.properties`

### React frontend

Client-side onboarding and API calls

- [React app](https://github.com/rohit-10-ui/library-management-system/blob/main/frontend/src/index.js): spa entry · Client-side application bootstrap · `frontend/src/index.js`
- [Main shell](https://github.com/rohit-10-ui/library-management-system/blob/main/frontend/src/App.js): ui shell · Top-level React component tree · `frontend/src/App.js`
- [Landing page](https://github.com/rohit-10-ui/library-management-system/blob/main/frontend/src/Landing.jsx): ui screen · Entry screen for the public site · `frontend/src/Landing.jsx`
- [Login screen](https://github.com/rohit-10-ui/library-management-system/blob/main/frontend/src/Login.jsx): ui screen · Authentication form for existing users · `frontend/src/Login.jsx`
- [Signup screen](https://github.com/rohit-10-ui/library-management-system/blob/main/frontend/src/Signup.jsx): ui screen · Registration form for new users · `frontend/src/Signup.jsx`

### Runtime & data

Local development endpoints and database

- **Backend API**: http service · Spring Boot service exposed to the frontend
- **MySQL**: database · Local persistence store on port 3306
- **React dev server**: http client · Frontend development server on port 3000

## Connections

- React app → Main shell: mounts · Bootstraps the SPA shell
- Main shell → Landing page: renders · Shows the landing experience
- Main shell → Login screen: renders · Routes to login UI
- Main shell → Signup screen: renders · Routes to signup UI
- Signup screen → Backend API: POST signup · Submits registration data to the backend
- Login screen → Backend API: POST login · Sends authentication requests
- React dev server → React app: serves · Hosts the React client during development
- Backend API → Backend app: runs · Backend service runtime
- Backend app → Auth API: exposes · Starts the REST API surface
- Auth API → Signup factory: delegates · Routes registration by user type
- Signup factory → Student signup: selects · Student signup workflow
- Signup factory → Librarian signup: selects · Librarian signup workflow
- Student signup → User repository: persists · Stores new student accounts
- Librarian signup → User repository: persists · Stores new librarian accounts
- User repository → User: maps · Repository operates on user entities
- User → Role: uses · Associates accounts with roles
- User → Approval status: uses · Tracks approval state
- User repository → MySQL: reads/writes · JPA persistence against MySQL
- App config → MySQL: configures · Datasource settings point to MySQL
