# tiobilito/registrohss architecture

> Architecture diagram of the GitHub repository tiobilito/registrohss, 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/tiobilito/registrohss
- Repository: https://github.com/tiobilito/registrohss

## Overview

##### Project type and its purpose
- The project is a mobile application whose primary function is recording user work hours while optionally verifying locations.
- It includes a user-facing interface (several screens such as login, registration, main activity, tables for hours and weeks, settings, and help) as well as a set of underlying logic modules (contained in the “Modulos” folder).
- Integration with external services is achieved through a Supabase connector (see supabase.ts), and there is support for data verification and legacy database operations.

##### File structure
- Top-Level Files like App.js and app.json hint at a typical React Native entry point and configuration. The babel.config.js, tsconfig.json, package.json, and package-lock.json indicate usage of JavaScript/TypeScript with build tools.
- The “Scenes” directory contains the various UI screens (Ajustes, Ayuda, Horario, Ingreso, ModificarUsuario, etc.) which individually handle different parts of the user interface.
- The “Modulos” directory holds several modules dealing with core functionalities such as:
◦ Cronometro.js – likely the timer functionality for hour registration.
◦ InfoUsuario.js and VerificacionUsuario.js – user management and validation processes.
◦ ModalFormularioHoras.js – interface module for entering hours manually.
◦ db.js, OperacionesBD.js, and Operaciones DB Legacy.txt – handle interactions with local and/or remote databases.
◦ gps.js – responsible for location-based services.
◦ supabase.ts – encapsulates interactions with Supabase for data synchronization.
- Other supportive files (e.g., eas.json, .gitignore) also round out the project’s structure.

##### README insights
- The README provides context by describing the application’s features and user workflow (registration, login, time recording, reviewing logged hours, adjusting user settings, and accessing help).
- The inclusion of screenshots shows how essential each “Scene” functions in the user journey.
- Clear instructions on installing and running the app reinforce that it is a mobile-focused project with real-time interactions.

a. Main components:
- User Interface Layer – Represented by the “Scenes” folder. This covers screens for Ingreso (Login), Registro (Registration), Principal (Main with timer control), TablaHoras, TablaSemanas, Ajustes, and Ayuda.
- Business Logic Layer – Encompassing the “Modulos” folder. Components here include:
▪ Chronometer control (Cronometro.js)
▪ User and session verification (VerificacionUsuario.js, VerificacionCad.js, InfoUsuario.js)
▪ Database interaction and operations (db.js, OperacionesBD.js)
▪ Location management (gps.js)
▪ Data synchronization with external services (supabase.ts)
- External Services:
▪ Supabase (remote database service for syncing records)
▪ Possibly external location services (via gps.js)
b. Relationships and interactions:
- The UI screens (Scenes) interact with business logic modules for functionalities such as starting/stopping the chronometer, performing user authentication, and updating records.
- The modules then communicate with the Supabase service (through supabase.ts) for data storage and retrieval.
c. Architectural patterns:
- Separation of concerns: One layer dedicated to UI (display and user interactions) and another for business logic.
- Modular design: Each function (timer, user verification, location tracking, database operations) is implemented in a separate module, making it easier to test, maintain, and scale.
- Integration with external services via a dedicated module (supabase.ts) to abstract the communication with the Supabase API.
d. Relevant technologies:
- React Native or a similar mobile app framework (as indicated by App.js and app configuration files).
- JavaScript and TypeScript (use of .js and .ts files along with tsconfig.json).
- Supabase for backend data management.
- Any libraries for biometric authentication, mapping/geolocation (implied by gps.js), and data synchronization.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interface Layer
    subgraph "User Interface (Scenes)"
        scene1["Ingreso Screen"]:::ui
        scene2["Registro Screen"]:::ui
        scene3["Principal Screen"]:::ui
        scene4["Ajustes Screen"]:::ui
        scene5["Ayuda Screen"]:::ui
        scene6["Horario Screen"]:::ui
        scene7["Hour Table (TablaHoras)"]:::ui
        scene8["Week Table (TablaSemanas)"]:::ui
        scene9["User Modification Screen"]:::ui
        scene10["Change Password Screen"]:::ui
        scene11["Hour Component"]:::ui
    end

    %% Business Logic Layer
    subgraph "Business Logic (Modulos)"
        chrono["Chronometer Module"]:::logic
        
        subgraph "User Management & Verification"
            info["Info Usuario"]:::logicSub
            verif["Verif Usuario"]:::logicSub
            verifCad["Verif CAD"]:::logicSub
        end

        modalEntry["Manual Hour Entry Module"]:::logic
        dbInt["Database Interaction Module"]:::logic
        gps["Location Services Module"]:::logic
        supaModule["Supabase Integration Module"]:::logic
    end

    %% External Services Layer
    subgraph "External Services"
        supaDB["Supabase Service"]:::external
    end

    %% UI to Business Logic Connections
    scene1 -->|"authenticates"| info
    scene2 -->|"registers"| info
    scene3 -->|"starts_timer"| chrono
    scene3 -->|"verifies_location"| gps
    scene6 -->|"manual_entry"| modalEntry
    scene7 -->|"queries_hours"| dbInt
    scene8 -->|"queries_weeks"| dbInt
    scene4 -->|"updates_user"| info

    %% Business Logic Internal Connections
    dbInt -->|"syncs_data"| supaModule
    supaModule -->|"synchronizes"| supaDB

    %% Styles
    classDef ui fill:#ffcc99,stroke:#d57643,stroke-width:2px;
    classDef logic fill:#cfe2f3,stroke:#6c8ebf,stroke-width:2px;
    classDef logicSub fill:#bfd7ea,stroke:#4682b4,stroke-width:2px;
    classDef external fill:#d4edda,stroke:#155724,stroke-width:2px;

    %% Click Events for UI Components
    click scene1 "https://github.com/tiobilito/registrohss/blob/AppReboot/Scenes/Ingreso.js"
    click scene2 "https://github.com/tiobilito/registrohss/blob/AppReboot/Scenes/Registro.js"
    click scene3 "https://github.com/tiobilito/registrohss/blob/AppReboot/Scenes/Principal.js"
    click scene4 "https://github.com/tiobilito/registrohss/blob/AppReboot/Scenes/Ajustes.js"
    click scene5 "https://github.com/tiobilito/registrohss/blob/AppReboot/Scenes/Ayuda.js"
    click scene6 "https://github.com/tiobilito/registrohss/blob/AppReboot/Scenes/Horario.js"
    click scene7 "https://github.com/tiobilito/registrohss/blob/AppReboot/Scenes/TablaHoras.js"
    click scene8 "https://github.com/tiobilito/registrohss/blob/AppReboot/Scenes/TablaSemanas.js"
    click scene9 "https://github.com/tiobilito/registrohss/blob/AppReboot/Scenes/ModificarUsuario.js"
    click scene10 "https://github.com/tiobilito/registrohss/blob/AppReboot/Scenes/changePassword.js"
    click scene11 "https://github.com/tiobilito/registrohss/blob/AppReboot/Scenes/TablaHorasComponent.js"

    %% Click Events for Business Logic Modules
    click chrono "https://github.com/tiobilito/registrohss/blob/AppReboot/Modulos/Cronometro.js"
    click info "https://github.com/tiobilito/registrohss/blob/AppReboot/Modulos/InfoUsuario.js"
    click verif "https://github.com/tiobilito/registrohss/blob/AppReboot/Modulos/VerificacionUsuario.js"
    click verifCad "https://github.com/tiobilito/registrohss/blob/AppReboot/Modulos/VerificacionCad.js"
    click modalEntry "https://github.com/tiobilito/registrohss/blob/AppReboot/Modulos/ModalFormularioHoras.js"
    click dbInt "https://github.com/tiobilito/registrohss/blob/AppReboot/Modulos/db.js"
    click dbInt "https://github.com/tiobilito/registrohss/blob/AppReboot/Modulos/OperacionesBD.js"
    click dbInt "https://github.com/tiobilito/registrohss/blob/AppReboot/Modulos/Operaciones DB Legacy.txt"
    click gps "https://github.com/tiobilito/registrohss/blob/AppReboot/Modulos/gps.js"
    click supaModule "https://github.com/tiobilito/registrohss/blob/AppReboot/Modulos/supabase.ts"
```
