# joshivrush/user-manager architecture

> Architecture diagram of the GitHub repository joshivrush/user-manager, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/joshivrush/user-manager
- Repository: https://github.com/joshivrush/user-manager

## Overview

##### Project Type Analysis
This is a backend-only Spring Boot application focused on user management with JWT authentication. It's a REST API service with security implementations and database integration.

##### Main Components

A. Client Layer (External)
- REST API Consumers (shown as external systems)

B. API Layer
- AuthResource (Authentication endpoints)
- UserResource (User management endpoints)

C. Security Layer
- JwtAuthenticationFilter
- JwtAuthenticationEntryPoint
- TokenProvider
- WebSecurityConfig

D. Service Layer
- UserService
- RoleService

E. Data Access Layer
- UserDao
- RoleDao

F. Database Layer
- MySQL Database

##### Detailed Component Descriptions

**┌─────────────────────────────────────┐**
- External Clients          │
- ┘
- ↓
**┌─────────────────────────────────────┐**
- JWT Security Filter          │
- ┘
- ↓
**┌─────────────────────────────────────┐**
- AuthResource     UserResource      │
- ┘
- ↓
**┌─────────────────────────────────────┐**
- UserService      RoleService       │
- ┘
- ↓
**┌─────────────────────────────────────┐**
- UserDao          RoleDao         │
- ┘
- ↓
**┌─────────────────────────────────────┐**
- MySQL Database             │
- ┘

##### Additional Elements

a) Data Models:
- User and Role entities with their relationship
- DTOs (UserDto, RoleDTO) in the service layer

b) Security Components:
- JWT token flow
- Authentication entry points
- Secured vs public endpoints

c) Configuration:
- WebConfig and WebSecurityConfig influence
- Application properties configuration

##### Important Notes

- Notes about the JWT token lifecycle
- Database schema relationships
- Port number (9090) for the service

##### Technical Details to Highlight

- Spring Security integration
- JWT token-based authentication
- RESTful API design
- DAO pattern implementation
- Service layer abstraction
- DTOs for data transfer

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef external fill:#a8d1f0,stroke:#000
    classDef api fill:#90EE90,stroke:#000
    classDef security fill:#ffeb99,stroke:#000
    classDef service fill:#ffb366,stroke:#000
    classDef dao fill:#e6b3ff,stroke:#000
    classDef database fill:#d9d9d9,stroke:#000
    classDef model fill:#ff9999,stroke:#000
    classDef config fill:#b3e6cc,stroke:#000

    %% External Layer
    Client["External Client"]:::external

    %% Security Layer
    subgraph Security
        JwtFilter["JWT Authentication Filter"]
        JwtEntry["JWT Entry Point"]
        TokenProv["Token Provider"]
        SecConfig["Web Security Config"]
    end

    %% API Layer
    subgraph Controllers
        AuthRes["Auth Resource"]
        UserRes["User Resource"]
    end

    %% Service Layer
    subgraph Services
        UserServ["User Service"]
        RoleServ["Role Service"]
    end

    %% Data Access Layer
    subgraph DAOs
        UserDAO["User DAO"]
        RoleDAO["Role DAO"]
    end

    %% Model Layer
    subgraph Models
        User["User Entity"]
        Role["Role Entity"]
        UserDTO["User DTO"]
        RoleDTO["Role DTO"]
        AuthToken["Auth Token"]
        LoginUser["Login User"]
    end

    %% Configuration
    subgraph Config
        WebConf["Web Config"]
        AppProps["Application Properties"]
    end

    %% Database Layer
    DB[(MySQL Database)]:::database

    %% Relationships
    Client --> JwtFilter
    JwtFilter --> Controllers
    JwtFilter --> TokenProv
    JwtFilter --> JwtEntry
    
    AuthRes --> UserServ
    UserRes --> UserServ
    UserServ --> UserDAO
    RoleServ --> RoleDAO
    
    UserDAO --> DB
    RoleDAO --> DB

    %% Click Events
    click JwtFilter "https://github.com/joshivrush/User-Manager/blob/master/src/main/java/com/vrush/security/JwtAuthenticationFilter.java"
    click JwtEntry "https://github.com/joshivrush/User-Manager/blob/master/src/main/java/com/vrush/security/JwtAuthenticationEntryPoint.java"
    click TokenProv "https://github.com/joshivrush/User-Manager/blob/master/src/main/java/com/vrush/security/TokenProvider.java"
    click SecConfig "https://github.com/joshivrush/User-Manager/blob/master/src/main/java/com/vrush/config/WebSecurityConfig.java"
    click AuthRes "https://github.com/joshivrush/User-Manager/blob/master/src/main/java/com/vrush/controller/AuthResource.java"
    click UserRes "https://github.com/joshivrush/User-Manager/blob/master/src/main/java/com/vrush/controller/UserResource.java"
    click UserServ "https://github.com/joshivrush/User-Manager/blob/master/src/main/java/com/vrush/service/UserService.java"
    click RoleServ "https://github.com/joshivrush/User-Manager/blob/master/src/main/java/com/vrush/service/RoleService.java"
    click UserDAO "https://github.com/joshivrush/User-Manager/blob/master/src/main/java/com/vrush/dao/UserDao.java"
    click RoleDAO "https://github.com/joshivrush/User-Manager/blob/master/src/main/java/com/vrush/dao/RoleDao.java"
    click User "https://github.com/joshivrush/User-Manager/blob/master/src/main/java/com/vrush/model/User.java"
    click UserDTO "https://github.com/joshivrush/User-Manager/blob/master/src/main/java/com/vrush/model/UserDto.java"
    click Role "https://github.com/joshivrush/User-Manager/blob/master/src/main/java/com/vrush/model/Role.java"
    click RoleDTO "https://github.com/joshivrush/User-Manager/blob/master/src/main/java/com/vrush/model/RoleDTO.java"
    click AuthToken "https://github.com/joshivrush/User-Manager/blob/master/src/main/java/com/vrush/model/AuthToken.java"
    click LoginUser "https://github.com/joshivrush/User-Manager/blob/master/src/main/java/com/vrush/model/LoginUser.java"
    click WebConf "https://github.com/joshivrush/User-Manager/blob/master/src/main/java/com/vrush/config/WebConfig.java"
    click AppProps "https://github.com/joshivrush/User-Manager/blob/master/src/main/resources/application.properties"
```
