# 0spol/shuemo architecture

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

- Interactive diagram: https://gitdiagram.com/0spol/shuemo
- Repository: https://github.com/0spol/shuemo

## Overview

##### Main Components

- Frontend Component:
- Located in the “React/shuemo” directory.
- Built using React, Tailwind CSS (configured via tailwind.config.js).
- Contains all the UI components (e.g., “pages”, “components”, “context”, “helpers”) used to render the user interface.

- Backend Component:
- Located in the “Spring/shuemo” directory.
- Built using Spring Boot, Hibernate, Lombok, with configuration files and controllers in multiple packages (such as account, cliente, empleado, empresa, infraestructura).
- Responsible for handling business logic, authentication (as seen in the presence of JWT filters and a TokenService), and providing REST endpoints for the frontend.

- Database:
- MySQL is used for data storage as stated in the README.
- The backend integrates with the database using Hibernate and JPA repositories.

- External Services/Integrations:
- Google Mail API integration for sending emails.
- Possibly additional integration points for email management provided in the backend controllers.

- Deployment/Containerization Details:
- Separate Dockerfiles exist for the React and Spring parts, suggesting containerized deployment.
- docker-compose.yml in the root might be used to coordinate the different service containers.

##### Relationships and Interactions Between Components

- The Frontend (React):
- Interacts with the backend through RESTful APIs.
- Implements client-side routing and state management using components and contexts.
- Provides a modern, responsive UI through Tailwind CSS.

- The Backend (Spring Boot):
- Exposes endpoints (organized in packages like “controller/rest/cliente”, “controller/rest/empleado”, etc.) for the frontend to perform CRUD operations.
- Uses Spring Security (via SecurityConfig and JwtRequestFilter) to protect endpoints.
- Integrates with MySQL using Hibernate/JPA (repositories and domain classes).
- Manages business logic and interacts with external APIs (e.g., messages via Google Mail API).

- Database (MySQL):
- Stores CRM data such as client information, emails, appointments (Citas), payments, and more.

- External Services:
- Spring’s business logic communicates with Google Mail API to handle email sending.

- Docker/Deployment:
- Containerization for isolated, reproducible environments with separate containers for the frontend and backend.

##### Architectural Patterns & Design Principles

- Separation of Concerns:
- Clear separation between the presentation layer (React UI) and business logic/data layer (Spring Boot).

- MVC/Microservices Elements:
- While both Spring (structured in controllers, services, repositories) and React have distinct layers, the overall design follows the principles of modularized components with defined responsibilities.

- REST Architecture:
- The backend uses well-defined RESTful endpoints to enable client-server communication.

- Security:
- Implementation of JWT-based authentication and Spring Security.

##### Final Recommendations for the Principal Software Engineer

- Then, detail each block further to show relationships, for example:
- Connections to MySQL along with external APIs.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend (React)"
        FE["React Frontend"]:::frontend
        FE_Tailwind["Tailwind CSS"]:::frontend
    end

    subgraph "Backend (Spring Boot)"
        BE["Spring Boot Backend"]:::backend
        BE_Security_Config["Security Config (JWT)"]:::backend
        BE_JwtFilter["JWT Filter"]:::backend
        BE_EmailConfig["Email Config"]:::backend
        BE_EmailController["Email Controller"]:::backend
        BE_Repo["Repositories"]:::backend
    end

    subgraph "Deployment (Docker)"
        COMPOSE["Docker Compose"]:::deployment
        Docker_React["React Docker Container"]:::deployment
        Docker_Spring["Spring Boot Docker Container"]:::deployment
    end

    DB["MySQL Database"]:::database
    GM["Google Mail API"]:::external

    %% Interactions between components
    FE -->|"REST_API_calls"| BE
    BE -->|"configures"| BE_Security_Config
    BE -->|"applies"| BE_JwtFilter
    BE -->|"integrates"| BE_EmailConfig
    BE -->|"handles"| BE_EmailController
    BE -->|"uses"| BE_Repo
    BE_Repo -->|"CRUD_operations"| DB
    BE_EmailController -->|"sendsEmail"| GM

    %% Deployment interactions
    COMPOSE --> Docker_React
    COMPOSE --> Docker_Spring
    FE ---|"deployed_in"| Docker_React
    BE ---|"deployed_in"| Docker_Spring

    %% Click Events (paths are for internal processing only)
    click FE "https://github.com/0spol/shuemo/tree/main/React/shuemo"
    click FE_Tailwind "https://github.com/0spol/shuemo/blob/main/React/shuemo/tailwind.config.js"
    click Docker_React "https://github.com/0spol/shuemo/tree/main/React/Dockerfile"
    click BE "https://github.com/0spol/shuemo/tree/main/Spring/shuemo"
    click BE_Security_Config "https://github.com/0spol/shuemo/blob/main/Spring/shuemo/src/main/java/shuemo/shuemo/config/SecurityConfig.java"
    click BE_JwtFilter "https://github.com/0spol/shuemo/blob/main/Spring/shuemo/src/main/java/shuemo/shuemo/config/JwtRequestFilter.java"
    click BE_EmailConfig "https://github.com/0spol/shuemo/blob/main/Spring/shuemo/src/main/java/shuemo/shuemo/config/EmailConfig.java"
    click BE_EmailController "https://github.com/0spol/shuemo/blob/main/Spring/shuemo/src/main/java/shuemo/shuemo/controller/email/EmailController.java"
    click BE_Repo "https://github.com/0spol/shuemo/tree/main/Spring/shuemo/src/main/java/shuemo/shuemo/repository"
    click COMPOSE "https://github.com/0spol/shuemo/blob/main/docker-compose.yml"
    click Docker_Spring "https://github.com/0spol/shuemo/tree/main/Spring/Dockerfile"

    %% Styles
    classDef frontend fill:#a2d2ff,stroke:#000,stroke-width:2px;
    classDef backend fill:#ffadad,stroke:#000,stroke-width:2px;
    classDef database fill:#c5c5c5,stroke:#000,stroke-width:2px;
    classDef external fill:#d0aaff,stroke:#000,stroke-width:2px;
    classDef deployment fill:#d3f8e2,stroke:#000,stroke-width:2px;

    class FE,FE_Tailwind frontend;
    class BE,BE_Security_Config,BE_JwtFilter,BE_EmailConfig,BE_EmailController,BE_Repo backend;
    class DB database;
    class GM external;
    class COMPOSE,Docker_React,Docker_Spring deployment;
```
