# juliethcp/jan-fit architecture

> Architecture diagram of the GitHub repository juliethcp/jan-fit, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/juliethcp/jan-fit
- Repository: https://github.com/juliethcp/jan-fit

## Overview

A good approach for diagramming the JAN-Fit application is to think of it as a mobile-front end interacting with an external API backed by a PostgreSQL database. Below is a step-by-step explanation tailored to the project’s structure:

##### Project Type and Purpose
- JAN-Fit is clearly a mobile exercise application built with React Native. Its purpose is to allow users to view and use a variety of pre-defined exercise routines and track their workout sessions (with features like a built-in chronometer).
- The README indicates that while the mobile app handles the user interface and interaction, a separate REST API (in another repository) manages exercise data via a PostgreSQL backend.

##### Analyzing the File Structure
- Top-level files like App.js and configuration files (app.json, eas.json, metro.config.js, babel.config.js) indicate a React Native project.
- The “src” directory houses all UI elements:
- The assets subdirectory provides fonts and image resources.
- “components” include both common UI elements (e.g., Cronometro, CustomButton, InputField) and more domain-specific components (e.g., DatosUsuario, Ejercicios, Rutinas).
- “screens” comprise distinct views like LoginScreen.js and RegisterScreen.js.
- The SQL files (inserciones.sql, tablas.sql) hint at the structure or seed data for the PostgreSQL database, even though the database management is handled on the backend API side.

##### Main Components
a. Mobile Application (Frontend):
- React Native app as the primary client.
- Components like App.js (entry point), screens (LoginScreen, RegisterScreen), and the various shared UI components.
- Submodules or grouped areas (for instance, “UI Components” and “Asset Management”) to represent organization within the “src” directory.

b. API REST Server (Backend):
- External API that the mobile app connects to. Even though its code is in a separate repository, it is a central part of the system.
- That this server handles business logic, exercise data processing, and interfacing with the database.

c. PostgreSQL Database:
- Database that stores exercise details (names, descriptions, GIFs, and other metadata).
- This component visually to the REST API server.

##### Relationships and Interactions
- The mobile app sends requests (e.g., user authentication, exercise data queries) to the REST API.
- The REST API processes requests, performs necessary CRUD operations on the PostgreSQL database, and returns responses.

##### Architectural Patterns and Design Principles
- The separation of concerns is essential: the mobile app focuses on presentation and user interaction while the external API (and ultimately the PostgreSQL database) handles data management.
- The UI is modularized into reusable components (as seen in the “components” directory), adhering to component-based design principles common in React projects.
- The RESTful design of the backend encourages clear separation between client and server.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Mobile Application (Frontend)"
        EntryPoint["App.js"]:::entry
        UIComponents["UI Components"]:::component
        Screens["Screens"]:::screen
        Assets["Asset Management"]:::asset
    end

    subgraph "Backend"
        API["REST API Server"]:::api
        Database["PostgreSQL Database"]:::database
    end

    EntryPoint -->|"initiates"| UIComponents
    EntryPoint -->|"navigates to"| Screens
    Screens -->|"UserRequests/DataSubmission"| API
    API -->|"SQLQueries/Commands"| Database

    click EntryPoint "https://github.com/juliethcp/jan-fit/blob/master/App.js"
    click UIComponents "https://github.com/juliethcp/jan-fit/tree/master/src/components"
    click Screens "https://github.com/juliethcp/jan-fit/tree/master/src/screens"
    click Assets "https://github.com/juliethcp/jan-fit/tree/master/src/assets"

classDef entry fill:#E1F5FE,stroke:#0277BD,stroke-width:2px;
classDef component fill:#E8F5E9,stroke:#2E7D32,stroke-width:2px;
classDef screen fill:#FFF3E0,stroke:#F57C00,stroke-width:2px;
classDef asset fill:#F3E5F5,stroke:#8E24AA,stroke-width:2px;
classDef api fill:#FBE9E7,stroke:#D84315,stroke-width:2px;
classDef database fill:#E0F7FA,stroke:#00838F,stroke-width:2px;
```
