# mahe13185/student-management-api architecture

> Architecture diagram of the GitHub repository mahe13185/student-management-api, 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/mahe13185/student-management-api
- Repository: https://github.com/mahe13185/student-management-api

## Overview

This is a Spring Boot REST API for student and role management, with registration and Spring Security support. The main workflow accepts student requests, delegates CRUD and search operations through the service layer, and uses Spring Data repositories for persistence; registration and role management are separate API branches. The README also documents DTOs, validation, pagination, JPA relationships, MySQL, and Swagger UI. Some implementation files were not sampled, so links from service implementations to repositories and registration internals are not asserted.

Main entry points: [`src/main/java/org/mahendra/studentmanagementapi/Security/CustomUserDetailsService.java`](https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/Security/CustomUserDetailsService.java) (User Details Loader), [`src/main/java/org/mahendra/studentmanagementapi/controller/StudentController.java`](https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/controller/StudentController.java) (Student API), [`src/main/java/org/mahendra/studentmanagementapi/controller/AuthController.java`](https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/controller/AuthController.java) (Registration API), [`src/main/java/org/mahendra/studentmanagementapi/repository/UserRepository.java`](https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/repository/UserRepository.java) (User Repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["REST API"]
  node_student_controller["Student API"]
  node_role_controller["Role API"]
  node_auth_controller["Registration API"]
  node_home_controller["Home Endpoint"]
  node_student_dto["Student DTOs"]
  node_register_dto["Registration DTO"]
end

subgraph group_domain["Domain Services"]
  node_student_service["Student Service"]
  node_student_impl["Student Service Impl"]
  node_role_service["Role Service<br/>[RoleService.java]"]
  node_role_impl["Role Service Impl"]
  node_user_service["User Service<br/>[UserService.java]"]
  node_user_impl["User Service Impl"]
end

subgraph group_persistence["Persistence"]
  node_student_repo["Student Repository"]
  node_role_repo["Role Repository"]
  node_user_repo["User Repository"]
  node_mysql[("MySQL Database")]
  node_student_entity["Student Entity<br/>[Student.java]"]
  node_role_entity["Role Entity<br/>[Role.java]"]
end

subgraph group_security["Identity and Security"]
  node_user_entity["User Entity<br/>[User.java]"]
  node_details_service["User Details Loader"]
  node_user_details["Custom User Details"]
  node_security_config["Security Configuration"]
end

subgraph group_crosscut["Application Support"]
  node_cors["CORS Configuration<br/>[CorsConfig.java]"]
  node_exception_handler["Exception Handler"]
  node_error_dto["Error Response<br/>[ErrorResponse.java]"]
end

node_client(("API Client"))

node_client -->|"sends requests"| node_student_controller
node_client -->|"sends requests"| node_role_controller
node_client -->|"registers"| node_auth_controller
node_client -->|"requests greeting"| node_home_controller
node_student_controller -->|"accepts and returns"| node_student_dto
node_student_controller -->|"invokes"| node_student_service
node_role_controller -->|"invokes"| node_role_service
node_auth_controller -->|"accepts"| node_register_dto
node_auth_controller -->|"invokes"| node_user_service
node_student_repo -->|"persists entities"| node_mysql
node_role_repo -->|"persists entities"| node_mysql
node_user_repo -->|"persists entities"| node_mysql
node_student_repo -->|"loads and stores"| node_student_entity
node_role_repo -->|"loads and stores"| node_role_entity
node_user_repo -->|"loads and stores"| node_user_entity
node_details_service -->|"looks up username"| node_user_repo
node_details_service -->|"reads account"| node_user_entity
node_details_service -->|"creates details"| node_user_details
node_security_config -->|"configures authentication"| node_details_service
node_exception_handler -->|"formats not-found errors"| node_error_dto

click node_student_controller "https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/controller/StudentController.java"
click node_role_controller "https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/controller/RoleController.java"
click node_auth_controller "https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/controller/AuthController.java"
click node_home_controller "https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/controller/HomeController.java"
click node_student_dto "https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/dto/StudentRequestDTO.java"
click node_register_dto "https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/dto/RegisterRequestDTO.java"
click node_student_service "https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/service/StudentService.java"
click node_student_impl "https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/service/StudentServiceImpl.java"
click node_role_service "https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/service/RoleService.java"
click node_role_impl "https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/service/RoleServiceImpl.java"
click node_user_service "https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/service/UserService.java"
click node_user_impl "https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/service/UserServiceImpl.java"
click node_student_repo "https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/repository/StudentRepository.java"
click node_role_repo "https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/repository/RoleRepository.java"
click node_user_repo "https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/repository/UserRepository.java"
click node_student_entity "https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/entity/Student.java"
click node_role_entity "https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/entity/Role.java"
click node_user_entity "https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/entity/User.java"
click node_details_service "https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/Security/CustomUserDetailsService.java"
click node_user_details "https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/Security/CustomUserDetails.java"
click node_security_config "https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/SecurityConfig/SecurityConfig.java"
click node_cors "https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/config/CorsConfig.java"
click node_exception_handler "https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/exception/GlobalExceptionHandler.java"
click node_error_dto "https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/dto/ErrorResponse.java"

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_student_controller,node_role_controller,node_auth_controller,node_home_controller,node_student_dto,node_register_dto,node_client toneBlue
class node_student_service,node_student_impl,node_role_service,node_role_impl,node_user_service,node_user_impl toneAmber
class node_student_repo,node_role_repo,node_user_repo,node_mysql,node_student_entity,node_role_entity toneMint
class node_user_entity,node_details_service,node_user_details,node_security_config toneRose
class node_cors,node_exception_handler,node_error_dto toneIndigo
```

## Components

### REST API

- [Student API](https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/controller/StudentController.java): `src/main/java/org/mahendra/studentmanagementapi/controller/StudentController.java`
- [Role API](https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/controller/RoleController.java): `src/main/java/org/mahendra/studentmanagementapi/controller/RoleController.java`
- [Registration API](https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/controller/AuthController.java): `src/main/java/org/mahendra/studentmanagementapi/controller/AuthController.java`
- [Home Endpoint](https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/controller/HomeController.java): `src/main/java/org/mahendra/studentmanagementapi/controller/HomeController.java`
- [Student DTOs](https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/dto/StudentRequestDTO.java): `src/main/java/org/mahendra/studentmanagementapi/dto/StudentRequestDTO.java`
- [Registration DTO](https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/dto/RegisterRequestDTO.java): `src/main/java/org/mahendra/studentmanagementapi/dto/RegisterRequestDTO.java`

### Domain Services

- [Student Service](https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/service/StudentService.java): `src/main/java/org/mahendra/studentmanagementapi/service/StudentService.java`
- [Student Service Impl](https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/service/StudentServiceImpl.java): `src/main/java/org/mahendra/studentmanagementapi/service/StudentServiceImpl.java`
- [Role Service](https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/service/RoleService.java): `src/main/java/org/mahendra/studentmanagementapi/service/RoleService.java`
- [Role Service Impl](https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/service/RoleServiceImpl.java): `src/main/java/org/mahendra/studentmanagementapi/service/RoleServiceImpl.java`
- [User Service](https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/service/UserService.java): `src/main/java/org/mahendra/studentmanagementapi/service/UserService.java`
- [User Service Impl](https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/service/UserServiceImpl.java): `src/main/java/org/mahendra/studentmanagementapi/service/UserServiceImpl.java`

### Persistence

- [Student Repository](https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/repository/StudentRepository.java): `src/main/java/org/mahendra/studentmanagementapi/repository/StudentRepository.java`
- [Role Repository](https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/repository/RoleRepository.java): `src/main/java/org/mahendra/studentmanagementapi/repository/RoleRepository.java`
- [User Repository](https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/repository/UserRepository.java): `src/main/java/org/mahendra/studentmanagementapi/repository/UserRepository.java`
- **MySQL Database**
- [Student Entity](https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/entity/Student.java): `src/main/java/org/mahendra/studentmanagementapi/entity/Student.java`
- [Role Entity](https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/entity/Role.java): `src/main/java/org/mahendra/studentmanagementapi/entity/Role.java`

### Identity and Security

- [User Entity](https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/entity/User.java): `src/main/java/org/mahendra/studentmanagementapi/entity/User.java`
- [User Details Loader](https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/Security/CustomUserDetailsService.java): `src/main/java/org/mahendra/studentmanagementapi/Security/CustomUserDetailsService.java`
- [Custom User Details](https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/Security/CustomUserDetails.java): `src/main/java/org/mahendra/studentmanagementapi/Security/CustomUserDetails.java`
- [Security Configuration](https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/SecurityConfig/SecurityConfig.java): `src/main/java/org/mahendra/studentmanagementapi/SecurityConfig/SecurityConfig.java`

### Application Support

- [CORS Configuration](https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/config/CorsConfig.java): `src/main/java/org/mahendra/studentmanagementapi/config/CorsConfig.java`
- [Exception Handler](https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/exception/GlobalExceptionHandler.java): `src/main/java/org/mahendra/studentmanagementapi/exception/GlobalExceptionHandler.java`
- [Error Response](https://github.com/mahe13185/student-management-api/blob/main/src/main/java/org/mahendra/studentmanagementapi/dto/ErrorResponse.java): `src/main/java/org/mahendra/studentmanagementapi/dto/ErrorResponse.java`

### Other components

- **API Client**

## Connections

- API Client → Student API: sends requests
- API Client → Role API: sends requests
- API Client → Registration API: registers
- API Client → Home Endpoint: requests greeting
- Student API → Student DTOs: accepts and returns
- Student API → Student Service: invokes
- Role API → Role Service: invokes
- Registration API → Registration DTO: accepts
- Registration API → User Service: invokes
- Student Repository → MySQL Database: persists entities
- Role Repository → MySQL Database: persists entities
- User Repository → MySQL Database: persists entities
- Student Repository → Student Entity: loads and stores
- Role Repository → Role Entity: loads and stores
- User Repository → User Entity: loads and stores
- User Details Loader → User Repository: looks up username
- User Details Loader → User Entity: reads account
- User Details Loader → Custom User Details: creates details
- Security Configuration → User Details Loader: configures authentication
- Exception Handler → Error Response: formats not-found errors
