# y0i7/full-stack-jwt-user-manager architecture

> Architecture diagram of the GitHub repository y0i7/full-stack-jwt-user-manager, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/y0i7/full-stack-jwt-user-manager
- Repository: https://github.com/y0i7/full-stack-jwt-user-manager

## Overview

1. This repository contains two separate applications that work together: a Spring Boot backend in `Backen_Modules/` and a React frontend in `frontend_components/`. The architecture is a classic client–server split: the frontend handles user interaction, while the backend owns authentication, user data, and persistence.

2. The backend is a Java 17 / Spring Boot 3 service built around a REST-style flow. Its main entry point is `BackenModulesApplication.java`, and the backend is organized into controller, service, repository, model, and security/config layers.

3. The core backend business domain is “usuario” management. `Usuario` is the main entity, while `LoginDTO` and `RegistroDTO` are request payloads used to separate API input from the persistence model. This keeps authentication and registration data distinct from the database entity.

4. Request handling flows through two controllers: `AuthenticationController` for login/registration-related endpoints, and `UsuarioController` for user/profile-related endpoints. These controllers delegate business logic to `UsuarioService`, with the concrete implementation in `UsuarioServiceImpl`.

5. Persistence is handled through `UsuarioRepository`, which is the data-access boundary to SQL Server via Spring Data JPA/Hibernate. The repository/service separation suggests the application reads and writes user records primarily through a single database-backed aggregate.

6. Security is centered on JWT. `WebSecurityConfig` defines the Spring Security setup, `JwtAuthorizationFilter` intercepts requests to validate tokens, and `JwtUtils` encapsulates token creation/parsing. `JwtRequest` and `JwtResponse` are support models for the auth handshake. This means authenticated requests are authorized at the filter layer before reaching controllers.

7. Error handling is centralized in `GlobalException`, which acts as a cross-cutting boundary for API failures. That keeps controller logic simpler and makes auth/data validation errors more consistent for the frontend.

8. Backend configuration is externalized in `src/main/resources/application.properties`. The README indicates this file holds sensitive/runtime settings such as the JWT secret and SQL Server connection details, so the backend is environment-configured rather than hardcoded.

9. The frontend is a React application structured by feature area. `Auth/LoginForm.jsx` and `Auth/RegisterForm.jsx` handle authentication UI, `Profile/Profile.jsx` displays authenticated user data, `Home/Home.jsx` is the landing page, and `Layout/Navbar.jsx` plus `Footer.jsx` provide shared chrome.

10. Frontend state and route protection are handled in two key places: `context/AuthContext.js` stores auth/session state, and `utils/ProtectedRoute.jsx` gates access to protected screens. This indicates the UI both stores the JWT/session client-side and uses route-level checks to prevent unauthenticated navigation.

11. The frontend communicates with the backend through API calls, likely using Axios as noted in the README. The data flow is: user submits credentials in React, the backend authenticates and returns a JWT, the frontend stores that auth state, and subsequent protected requests include the token to fetch user/profile data.

12. From an architecture-diagram perspective, the important boundaries are: browser/UI, auth state management, route protection, REST API controllers, JWT security filter chain, service layer, and SQL Server persistence. The repo is also testable at both ends, with a Spring Boot test module on the backend and React testing setup on the frontend.

Main entry points: [`frontend_components/src/App.jsx`](https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/frontend_components/src/App.jsx) (React app), [`Backen_Modules/src/main/java/com/DEMO/Backen_Modules/Controller/AuthenticationController.java`](https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/Backen_Modules/src/main/java/com/DEMO/Backen_Modules/Controller/AuthenticationController.java) (Auth API), [`Backen_Modules/src/main/java/com/DEMO/Backen_Modules/Controller/UsuarioController.java`](https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/Backen_Modules/src/main/java/com/DEMO/Backen_Modules/Controller/UsuarioController.java) (User API), [`Backen_Modules/src/main/java/com/DEMO/Backen_Modules/config/security/WebSecurityConfig.java`](https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/Backen_Modules/src/main/java/com/DEMO/Backen_Modules/config/security/WebSecurityConfig.java) (JWT security)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_frontend_app["React app<br/>client app<br/>[App.jsx]"]
  node_auth_context(("Auth state<br/>react context<br/>[AuthContext.js]"))
  node_protected_route(("Route guard<br/>route protection<br/>[ProtectedRoute.jsx]"))
  node_login_form["Login form<br/>auth ui<br/>[LoginForm.jsx]"]
  node_register_form["Register form<br/>auth ui<br/>[RegisterForm.jsx]"]
  node_profile_view["Profile view<br/>user screen<br/>[Profile.jsx]"]
  node_layout_ui["Shared chrome<br/>layout components<br/>[Navbar.jsx]"]
  node_home_view["Home page<br/>landing screen<br/>[Home.jsx]"]
end

subgraph group_backend["Backend"]
  node_auth_controller["Auth API<br/>spring controller"]
  node_usuario_controller["User API<br/>spring controller"]
  node_usuario_service["User service<br/>service interface"]
  node_usuario_service_impl["Service impl"]
  node_usuario_repo[("User repo<br/>data access")]
  node_usuario_model{{"Usuario<br/>entity<br/>[Usuario.java]"}}
  node_auth_security["JWT security<br/>security config"]
  node_auth_dto["Auth DTOs<br/>request/response models<br/>[LoginDTO.java]"]
  node_global_exception["Error handling<br/>exception advice"]
  node_app_config["Runtime config<br/>properties"]
  node_backend_main["Spring Boot app<br/>application entrypoint"]
end

subgraph group_shared["Cross-cutting"]
  node_api_flow["API calls<br/>http client"]
end

node_frontend_app -->|"renders"| node_home_view
node_frontend_app -->|"routes to"| node_login_form
node_frontend_app -->|"routes to"| node_register_form
node_frontend_app -->|"routes to"| node_profile_view
node_frontend_app -->|"wraps"| node_layout_ui
node_auth_context -->|"feeds"| node_protected_route
node_login_form -->|"updates"| node_auth_context
node_register_form -->|"updates"| node_auth_context
node_login_form -->|"calls"| node_api_flow
node_register_form -->|"calls"| node_api_flow
node_profile_view -->|"calls"| node_api_flow
node_api_flow -->|"auth requests"| node_auth_controller
node_api_flow -->|"profile requests"| node_usuario_controller
node_auth_controller -->|"delegates"| node_usuario_service
node_usuario_controller -->|"delegates"| node_usuario_service
node_usuario_service -->|"implemented by"| node_usuario_service_impl
node_usuario_service_impl -->|"persists via"| node_usuario_repo
node_usuario_repo -->|"maps"| node_usuario_model
node_auth_security -->|"secures"| node_auth_controller
node_auth_security -->|"secures"| node_usuario_controller
node_auth_security -->|"reads"| node_app_config
node_backend_main -->|"boots"| node_auth_security
node_backend_main -->|"includes"| node_global_exception
node_auth_controller -->|"uses"| node_auth_dto
node_usuario_controller -->|"uses"| node_auth_dto
node_global_exception -.->|"handles"| node_auth_controller
node_global_exception -.->|"handles"| node_usuario_controller

click node_frontend_app "https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/frontend_components/src/App.jsx"
click node_auth_context "https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/frontend_components/src/context/AuthContext.js"
click node_protected_route "https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/frontend_components/src/utils/ProtectedRoute.jsx"
click node_login_form "https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/frontend_components/src/components/Auth/LoginForm.jsx"
click node_register_form "https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/frontend_components/src/components/Auth/RegisterForm.jsx"
click node_profile_view "https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/frontend_components/src/components/Profile/Profile.jsx"
click node_layout_ui "https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/frontend_components/src/components/Layout/Navbar.jsx"
click node_home_view "https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/frontend_components/src/components/Home/Home.jsx"
click node_auth_controller "https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/Backen_Modules/src/main/java/com/DEMO/Backen_Modules/Controller/AuthenticationController.java"
click node_usuario_controller "https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/Backen_Modules/src/main/java/com/DEMO/Backen_Modules/Controller/UsuarioController.java"
click node_usuario_service "https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/Backen_Modules/src/main/java/com/DEMO/Backen_Modules/Service/UsuarioService.java"
click node_usuario_service_impl "https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/Backen_Modules/src/main/java/com/DEMO/Backen_Modules/Service/impl/UsuarioServiceImpl.java"
click node_usuario_repo "https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/Backen_Modules/src/main/java/com/DEMO/Backen_Modules/Repository/UsuarioRepository.java"
click node_usuario_model "https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/Backen_Modules/src/main/java/com/DEMO/Backen_Modules/Model/Usuario.java"
click node_auth_security "https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/Backen_Modules/src/main/java/com/DEMO/Backen_Modules/config/security/WebSecurityConfig.java"
click node_auth_dto "https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/Backen_Modules/src/main/java/com/DEMO/Backen_Modules/Model/dto/LoginDTO.java"
click node_global_exception "https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/Backen_Modules/src/main/java/com/DEMO/Backen_Modules/config/GlobalException.java"
click node_app_config "https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/Backen_Modules/src/main/resources/application.properties"
click node_backend_main "https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/Backen_Modules/src/main/java/com/DEMO/Backen_Modules/BackenModulesApplication.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_frontend_app,node_auth_context,node_protected_route,node_login_form,node_register_form,node_profile_view,node_layout_ui,node_home_view toneBlue
class node_auth_controller,node_usuario_controller,node_usuario_service,node_usuario_service_impl,node_usuario_repo,node_usuario_model,node_auth_security,node_auth_dto,node_global_exception,node_app_config,node_backend_main toneAmber
class node_api_flow toneMint
```

## Components

### Frontend

React app for authentication, profile access, and shared UI.

- [React app](https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/frontend_components/src/App.jsx): client app · Browser-facing UI for login, registration, profile, and navigation. · `frontend_components/src/App.jsx`
- [Auth state](https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/frontend_components/src/context/AuthContext.js): react context · Client-side session and JWT/auth state management. · `frontend_components/src/context/AuthContext.js`
- [Route guard](https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/frontend_components/src/utils/ProtectedRoute.jsx): route protection · Prevents unauthenticated access to protected screens. · `frontend_components/src/utils/ProtectedRoute.jsx`
- [Login form](https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/frontend_components/src/components/Auth/LoginForm.jsx): auth ui · Collects credentials and starts the sign-in flow. · `frontend_components/src/components/Auth/LoginForm.jsx`
- [Register form](https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/frontend_components/src/components/Auth/RegisterForm.jsx): auth ui · Collects registration data and creates new users. · `frontend_components/src/components/Auth/RegisterForm.jsx`
- [Profile view](https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/frontend_components/src/components/Profile/Profile.jsx): user screen · Displays authenticated user data from the backend. · `frontend_components/src/components/Profile/Profile.jsx`
- [Shared chrome](https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/frontend_components/src/components/Layout/Navbar.jsx): layout components · Navbar and footer used across the app. · `frontend_components/src/components/Layout/Navbar.jsx`
- [Home page](https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/frontend_components/src/components/Home/Home.jsx): landing screen · Public landing page and entry screen. · `frontend_components/src/components/Home/Home.jsx`

### Backend

Spring Boot API, security, and persistence for usuario management.

- [Auth API](https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/Backen_Modules/src/main/java/com/DEMO/Backen_Modules/Controller/AuthenticationController.java): spring controller · REST endpoints for login and registration. · `Backen_Modules/src/main/java/com/DEMO/Backen_Modules/Controller/AuthenticationController.java`
- [User API](https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/Backen_Modules/src/main/java/com/DEMO/Backen_Modules/Controller/UsuarioController.java): spring controller · REST endpoints for user/profile operations. · `Backen_Modules/src/main/java/com/DEMO/Backen_Modules/Controller/UsuarioController.java`
- [User service](https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/Backen_Modules/src/main/java/com/DEMO/Backen_Modules/Service/UsuarioService.java): service interface · Business contract for usuario operations. · `Backen_Modules/src/main/java/com/DEMO/Backen_Modules/Service/UsuarioService.java`
- [Service impl](https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/Backen_Modules/src/main/java/com/DEMO/Backen_Modules/Service/impl/UsuarioServiceImpl.java): service implementation · Implements authentication and user business logic. · `Backen_Modules/src/main/java/com/DEMO/Backen_Modules/Service/impl/UsuarioServiceImpl.java`
- [User repo](https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/Backen_Modules/src/main/java/com/DEMO/Backen_Modules/Repository/UsuarioRepository.java): data access · Spring Data JPA boundary to the database. · `Backen_Modules/src/main/java/com/DEMO/Backen_Modules/Repository/UsuarioRepository.java`
- [Usuario](https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/Backen_Modules/src/main/java/com/DEMO/Backen_Modules/Model/Usuario.java): entity · Persistent user aggregate stored in SQL Server. · `Backen_Modules/src/main/java/com/DEMO/Backen_Modules/Model/Usuario.java`
- [JWT security](https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/Backen_Modules/src/main/java/com/DEMO/Backen_Modules/config/security/WebSecurityConfig.java): security config · Security configuration, JWT filter chain, and token utilities. · `Backen_Modules/src/main/java/com/DEMO/Backen_Modules/config/security/WebSecurityConfig.java`
- [Auth DTOs](https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/Backen_Modules/src/main/java/com/DEMO/Backen_Modules/Model/dto/LoginDTO.java): request/response models · Login and registration payloads plus JWT request/response models. · `Backen_Modules/src/main/java/com/DEMO/Backen_Modules/Model/dto/LoginDTO.java`
- [Error handling](https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/Backen_Modules/src/main/java/com/DEMO/Backen_Modules/config/GlobalException.java): exception advice · Centralized API failure handling. · `Backen_Modules/src/main/java/com/DEMO/Backen_Modules/config/GlobalException.java`
- [Runtime config](https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/Backen_Modules/src/main/resources/application.properties): properties · Externalized settings such as database and JWT secret. · `Backen_Modules/src/main/resources/application.properties`
- [Spring Boot app](https://github.com/y0i7/full-stack-jwt-user-manager/blob/main/Backen_Modules/src/main/java/com/DEMO/Backen_Modules/BackenModulesApplication.java): application entrypoint · Backend application bootstrap and runtime entry point. · `Backen_Modules/src/main/java/com/DEMO/Backen_Modules/BackenModulesApplication.java`

### Cross-cutting

Shared request/response and auth boundary concepts.

- **API calls**: http client · Frontend-to-backend requests for login, registration, and profile data.

## Connections

- React app → Home page: renders · The React app composes the landing page.
- React app → Login form: routes to · Public auth navigation reaches the login screen.
- React app → Register form: routes to · Public auth navigation reaches the registration screen.
- React app → Profile view: routes to · Protected navigation reaches the profile screen.
- React app → Shared chrome: wraps · Shared header/footer frame the UI.
- Auth state → Route guard: feeds · Route guard checks client auth state.
- Login form → Auth state: updates · Successful login stores session/JWT state.
- Register form → Auth state: updates · Registration can update auth state after signup.
- Login form → API calls: calls · Sends credentials to backend auth endpoints.
- Register form → API calls: calls · Sends registration data to backend endpoints.
- Profile view → API calls: calls · Fetches authenticated user/profile data.
- API calls → Auth API: auth requests · Login and registration requests enter the auth controller.
- API calls → User API: profile requests · Authenticated user data requests enter the user controller.
- Auth API → User service: delegates · Controllers rely on the service contract.
- User API → User service: delegates · Controllers rely on the service contract.
- User service → Service impl: implemented by · Concrete business logic lives in the implementation.
- Service impl → User repo: persists via · Service reads and writes through the repository boundary.
- User repo → Usuario: maps · Repository operates on the usuario entity.
- JWT security → Auth API: secures · JWT configuration protects controller access.
- JWT security → User API: secures · JWT configuration protects user endpoints.
- JWT security → Runtime config: reads · Security settings come from externalized properties.
- Spring Boot app → JWT security: boots · Application startup wires security and web configuration.
- Spring Boot app → Error handling: includes · Application exposes centralized exception handling.
- Auth API → Auth DTOs: uses · Auth endpoints exchange dedicated request/response payloads.
- User API → Auth DTOs: uses · User flow shares DTO boundary for API payloads.
- Error handling → Auth API: handles · Cross-cutting error handling applies to API failures.
- Error handling → User API: handles · Cross-cutting error handling applies to API failures.
