# randysmc/sistema-citas architecture

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

- Interactive diagram: https://gitdiagram.com/randysmc/sistema-citas
- Repository: https://github.com/randysmc/sistema-citas

## Overview

##### Main Components
- Frontend – Angular Application:
- The “Frontend” directory shows a complete Angular project. It includes an app module, routing, multiple pages (admin, cliente, user, home, login, signup, etc.), and services (authentication, calendar, citas, etc.).
- Grouping related pages or modules (e.g., Admin module, Client module) and list key components like navigation bars, dashboards, and various forms.
- Services such as Authentication, HTTP interceptors for JWT, and guards for route protection.

- Backend – Spring Boot REST API:
- The “Backend” directory contains a Spring Boot application with the typical structure: controllers, services, repositories, entities, DTOs, and configuration files.
- Presentation layer (controllers), the business logic layer (services and their implementations), and the data access layer (repositories).
- That several controllers are present handling authentication, citas (appointments), comprobantes (receipts), and more. Also, there is extensive use of DTOs, exception handling (GlobalExceptionHandler), and security configurations (JWTAuthentication, Spring Security, Swagger for API documentation).
- Although a database is not explicitly represented by a separate “db” directory, it is implied by the use of repositories and entity classes, and configuration files like application.properties suggest connection details.

- External Services and Tools:
- JWT-based authentication and potential external API integrations (if any) are managed on the backend.
- Swagger is configured for API documentation.
- Use of Tailwind CSS on the frontend indicates styling technology.

##### Relationships and Interactions
- Controllers (API endpoints) at the top receive requests from the frontend.
- Services (business logic) are called by controllers.
- Repositories (data access) work underneath services to interact with the database.
- DTOs facilitate data transfer between layers.
- Security component (JWT Authentication Filter, Security Config) intercepting requests to protected endpoints.

- For the frontend, illustrate communication flow:
- Angular services use HTTP clients to access backend APIs.
- Authentication processes (login, two-factor) include interceptors (auth.interceptors.ts) and guard services (admin.guard.ts, normal.guard.ts).

##### Architectural Patterns and Design Principles
- The backend follows an MVC (or layered) architecture pattern where controllers, services, and repositories are clearly separated.
- The use of DTOs ensures a decoupled data transfer mechanism.
- Exception handling is centralized in the GlobalExceptionHandler.
- JWT authentication and Spring Security illustrate secure access control.
- The frontend leverages Angular’s component-based architecture and uses routing guards to protect routes.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend (Angular)"
        F1["Angular App Module & Routing"]:::frontend
        F2["Navigation Bar Component"]:::frontend
        F3["Pages (Admin,Cliente,User,Home,Login,Signup,Two-Factor,Calendar)"]:::frontend
        F4["Angular Services (Authentication,Calendar,Citas,etc.)"]:::frontend
        F5["Tailwind Config"]:::frontend
        F6["Tailwind CSS File"]:::frontend
    end

    subgraph "Backend (Spring Boot)"
        B1["Spring Boot Application Entry Point"]:::backend
        B2["REST API Controllers"]:::backend
        B3["Service Layer (Business Logic & Implementations)"]:::backend
        B4["Repository Layer (Data Access)"]:::backend
        B5["Data Transfer Objects (DTOs)"]:::backend
        B6["Security Configurations (JWT,Filters,Utils)"]:::backend
        B7["API Documentation (Swagger)"]:::backend
        B8["Exception Handling (GlobalExceptionHandler)"]:::backend
        B9["Database"]:::database
    end

    %% Frontend interactions
    F1 -->|"InitialLoad"| F2
    F3 -->|"UserActions"| F4
    F4 -->|"HTTPRequest"| B2

    %% Backend layer flow
    B1 -->|"invokes"| B2
    B2 -->|"delegatesTo"| B3
    B3 -->|"accesses"| B4
    B2 -->|"securedBy"| B6
    B2 -->|"handlesErrors"| B8
    B4 -->|"reads/writes"| B9

    %% Click Events for Frontend
    click F1 "https://github.com/randysmc/sistema-citas/blob/main/Frontend/src/app/app.module.ts"
    click F1 "https://github.com/randysmc/sistema-citas/blob/main/Frontend/src/app/app-routing.module.ts"
    click F2 "https://github.com/randysmc/sistema-citas/blob/main/Frontend/src/app/components/navbar/navbar.component.*"
    click F3 "https://github.com/randysmc/sistema-citas/tree/main/Frontend/src/app/pages"
    click F4 "https://github.com/randysmc/sistema-citas/tree/main/Frontend/src/app/services"
    click F5 "https://github.com/randysmc/sistema-citas/blob/main/Frontend/tailwind.config.js"
    click F6 "https://github.com/randysmc/sistema-citas/blob/main/Frontend/src/tailwind.css"

    %% Click Events for Backend
    click B1 "https://github.com/randysmc/sistema-citas/blob/main/Backend/src/main/java/com/sistema/examenes/sistema_examenes_backend/SistemaExamenesBackendApplication.java"
    click B2 "https://github.com/randysmc/sistema-citas/tree/main/Backend/src/main/java/com/sistema/examenes/sistema_examenes_backend/controladores"
    click B3 "https://github.com/randysmc/sistema-citas/tree/main/Backend/src/main/java/com/sistema/examenes/sistema_examenes_backend/servicios"
    click B4 "https://github.com/randysmc/sistema-citas/tree/main/Backend/src/main/java/com/sistema/examenes/sistema_examenes_backend/repositorios"
    click B5 "https://github.com/randysmc/sistema-citas/tree/main/Backend/src/main/java/com/sistema/examenes/sistema_examenes_backend/DTO"
    click B6 "https://github.com/randysmc/sistema-citas/tree/main/Backend/src/main/java/com/sistema/examenes/sistema_examenes_backend/configuraciones"
    click B7 "https://github.com/randysmc/sistema-citas/blob/main/Backend/src/main/java/com/sistema/examenes/sistema_examenes_backend/configuraciones/SwaggerConfig.java"
    click B8 "https://github.com/randysmc/sistema-citas/blob/main/Backend/src/main/java/com/sistema/examenes/sistema_examenes_backend/excepciones/GlobalExceptionHandler.java"

    %% Style definitions
    classDef frontend fill:#FFD700,stroke:#333,stroke-width:2px;
    classDef backend fill:#87CEEB,stroke:#333,stroke-width:2px;
    classDef database fill:#C0C0C0,stroke:#333,stroke-width:2px;
```
