# lalitlohani07/hymdalll architecture

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

- Interactive diagram: https://gitdiagram.com/lalitlohani07/hymdalll
- Repository: https://github.com/lalitlohani07/hymdalll

## Overview

Hymdall is a Spring-based user authentication API. Clients submit registration or login requests to the auth controller; registration normalizes and checks the email, hashes the password, and saves a user, while login verifies credentials and account status before issuing an access token. The graph also shows persistence, token generation, and centralized API error handling. Source excerpts establish the main service calls; security wiring and database configuration are represented by their existing paths, but their connections are not inferred where the excerpts do not show them.

Main entry points: [`src/main/java/com/lalit/hymdall/controller/AuthController.java`](https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/controller/AuthController.java) (Auth controller), [`src/main/java/com/lalit/hymdall/service/UserRegistrationService.java`](https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/service/UserRegistrationService.java) (User registration), [`src/main/java/com/lalit/hymdall/repository/UserRepository.java`](https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/repository/UserRepository.java) (User repository), [`src/main/java/com/lalit/hymdall/service/AuthenticationServiceImpl.java`](https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/service/AuthenticationServiceImpl.java) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API boundary"]
  node_auth_controller["Auth controller"]
  node_registration_request["Registration request"]
  node_login_request["Login request<br/>[LoginRequest.java]"]
  node_registration_response["Registration response"]
  node_login_response["Login response<br/>[LoginResponse.java]"]
  node_api_error["Error response"]
  node_application["Application entry"]
end

subgraph group_identity["Identity workflows"]
  node_registration_service["User registration"]
  node_authentication_service["Authentication"]
  node_user["User account<br/>[User.java]"]
end

subgraph group_security["Security"]
  node_password_config["Password configuration"]
  node_jwt_service["JWT generation<br/>[JwtService.java]"]
  node_jwt_config["JWT configuration<br/>[JwtConfig.java]"]
  node_security_config["Security configuration"]
end

subgraph group_persistence["Persistence and errors"]
  node_user_repository["User repository"]
  node_user_database[("Users database")]
  node_exception_handler["API error handling"]
  node_email_exception["Duplicate email error"]
end

node_client(("API client"))

node_client -->|"sends requests"| node_auth_controller
node_auth_controller -->|"registers user"| node_registration_service
node_auth_controller -->|"authenticates"| node_authentication_service
node_auth_controller -->|"accepts payload"| node_registration_request
node_auth_controller -->|"accepts payload"| node_login_request
node_auth_controller -->|"returns payload"| node_registration_response
node_auth_controller -->|"returns payload"| node_login_response
node_registration_service -->|"checks and saves"| node_user_repository
node_registration_service -->|"creates account"| node_user
node_registration_service -->|"throws duplicate error"| node_email_exception
node_authentication_service -->|"finds account"| node_user_repository
node_authentication_service -->|"generates token"| node_jwt_service
node_user_repository -->|"loads entity"| node_user
node_user_repository -.->|"persists accounts"| node_user_database
node_exception_handler -->|"builds response"| node_api_error
node_exception_handler -->|"handles exception"| node_email_exception

click node_auth_controller "https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/controller/AuthController.java"
click node_registration_request "https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/dto/UserRegistrationRequest.java"
click node_login_request "https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/dto/LoginRequest.java"
click node_registration_response "https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/dto/UserRegistrationResponse.java"
click node_login_response "https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/dto/LoginResponse.java"
click node_registration_service "https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/service/UserRegistrationService.java"
click node_authentication_service "https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/service/AuthenticationServiceImpl.java"
click node_user "https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/entity/User.java"
click node_user_repository "https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/repository/UserRepository.java"
click node_user_database "https://github.com/lalitlohani07/hymdalll/blob/main/src/main/resources/db/migration/V1__create_users_table.sql"
click node_password_config "https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/security/PasswordConfig.java"
click node_jwt_service "https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/security/JwtService.java"
click node_jwt_config "https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/security/JwtConfig.java"
click node_security_config "https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/security/SecurityConfig.java"
click node_exception_handler "https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/exception/GlobalExceptionHandler.java"
click node_api_error "https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/dto/ApiErrorResponse.java"
click node_email_exception "https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/exception/EmailAlreadyExistsException.java"
click node_application "https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/HymdallApplication.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_auth_controller,node_registration_request,node_login_request,node_registration_response,node_login_response,node_api_error,node_application,node_client toneBlue
class node_registration_service,node_authentication_service,node_user toneAmber
class node_password_config,node_jwt_service,node_jwt_config,node_security_config toneMint
class node_user_repository,node_user_database,node_exception_handler,node_email_exception toneRose
```

## Components

### API boundary

- [Auth controller](https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/controller/AuthController.java): `src/main/java/com/lalit/hymdall/controller/AuthController.java`
- [Registration request](https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/dto/UserRegistrationRequest.java): `src/main/java/com/lalit/hymdall/dto/UserRegistrationRequest.java`
- [Login request](https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/dto/LoginRequest.java): `src/main/java/com/lalit/hymdall/dto/LoginRequest.java`
- [Registration response](https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/dto/UserRegistrationResponse.java): `src/main/java/com/lalit/hymdall/dto/UserRegistrationResponse.java`
- [Login response](https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/dto/LoginResponse.java): `src/main/java/com/lalit/hymdall/dto/LoginResponse.java`
- [Error response](https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/dto/ApiErrorResponse.java): `src/main/java/com/lalit/hymdall/dto/ApiErrorResponse.java`
- [Application entry](https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/HymdallApplication.java): `src/main/java/com/lalit/hymdall/HymdallApplication.java`

### Identity workflows

- [User registration](https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/service/UserRegistrationService.java): `src/main/java/com/lalit/hymdall/service/UserRegistrationService.java`
- [Authentication](https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/service/AuthenticationServiceImpl.java): `src/main/java/com/lalit/hymdall/service/AuthenticationServiceImpl.java`
- [User account](https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/entity/User.java): `src/main/java/com/lalit/hymdall/entity/User.java`

### Security

- [Password configuration](https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/security/PasswordConfig.java): `src/main/java/com/lalit/hymdall/security/PasswordConfig.java`
- [JWT generation](https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/security/JwtService.java): `src/main/java/com/lalit/hymdall/security/JwtService.java`
- [JWT configuration](https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/security/JwtConfig.java): `src/main/java/com/lalit/hymdall/security/JwtConfig.java`
- [Security configuration](https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/security/SecurityConfig.java): `src/main/java/com/lalit/hymdall/security/SecurityConfig.java`

### Persistence and errors

- [User repository](https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/repository/UserRepository.java): `src/main/java/com/lalit/hymdall/repository/UserRepository.java`
- [Users database](https://github.com/lalitlohani07/hymdalll/blob/main/src/main/resources/db/migration/V1__create_users_table.sql): `src/main/resources/db/migration/V1__create_users_table.sql`
- [API error handling](https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/exception/GlobalExceptionHandler.java): `src/main/java/com/lalit/hymdall/exception/GlobalExceptionHandler.java`
- [Duplicate email error](https://github.com/lalitlohani07/hymdalll/blob/main/src/main/java/com/lalit/hymdall/exception/EmailAlreadyExistsException.java): `src/main/java/com/lalit/hymdall/exception/EmailAlreadyExistsException.java`

### Other components

- **API client**

## Connections

- API client → Auth controller: sends requests (evidence: `src/main/java/com/lalit/hymdall/controller/AuthController.java`)
- Auth controller → User registration: registers user (evidence: `src/main/java/com/lalit/hymdall/controller/AuthController.java`)
- Auth controller → Authentication: authenticates (evidence: `src/main/java/com/lalit/hymdall/controller/AuthController.java`)
- Auth controller → Registration request: accepts payload (evidence: `src/main/java/com/lalit/hymdall/controller/AuthController.java`)
- Auth controller → Login request: accepts payload (evidence: `src/main/java/com/lalit/hymdall/controller/AuthController.java`)
- Auth controller → Registration response: returns payload (evidence: `src/main/java/com/lalit/hymdall/controller/AuthController.java`)
- Auth controller → Login response: returns payload (evidence: `src/main/java/com/lalit/hymdall/controller/AuthController.java`)
- User registration → User repository: checks and saves (evidence: `src/main/java/com/lalit/hymdall/service/UserRegistrationService.java`)
- User registration → User account: creates account (evidence: `src/main/java/com/lalit/hymdall/service/UserRegistrationService.java`)
- User registration → Duplicate email error: throws duplicate error (evidence: `src/main/java/com/lalit/hymdall/service/UserRegistrationService.java`)
- Authentication → User repository: finds account (evidence: `src/main/java/com/lalit/hymdall/service/AuthenticationServiceImpl.java`)
- Authentication → JWT generation: generates token (evidence: `src/main/java/com/lalit/hymdall/service/AuthenticationServiceImpl.java`)
- User repository → User account: loads entity (evidence: `src/main/java/com/lalit/hymdall/repository/UserRepository.java`)
- User repository → Users database: persists accounts
- API error handling → Error response: builds response (evidence: `src/main/java/com/lalit/hymdall/exception/GlobalExceptionHandler.java`)
- API error handling → Duplicate email error: handles exception (evidence: `src/main/java/com/lalit/hymdall/exception/GlobalExceptionHandler.java`)
