# kevincito20/tourin-panama architecture

> Architecture diagram of the GitHub repository kevincito20/tourin-panama, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kevincito20/tourin-panama
- Repository: https://github.com/kevincito20/tourin-panama

## Overview

##### Main Components
- Mobile Runtime & Build
- Expo Dev Tools & Metro Bundler
- Android native wrapper (android/ folder with Gradle, MainActivity.kt, MainApplication.kt)
- JavaScript Layers
- Presentation Layer
– File-based Routing (app/ directory)
– Screens & Layouts (_layout.tsx, index.tsx, tab screens, auth screens, modals)
– UI Components (components/ui, components/actividades, components/mapa, etc.)
- Business Logic Layer
– Custom Hooks (hooks/useActividades, useAutentication, useConocerPanama, etc.)
– State & Storage (useAlmacenamiento for local caching)
- Data & Services Layer
– REST clients (components/services/ActividadesService.ts, authService.ts, registroService.ts)
– Static assets & configs (assets/configuracionMapbox.ts, provinces JSON, fonts, images)
- External Systems
- Mapbox API
- Backend REST endpoints for activities, user registration, authentication

##### Relationships & Data Flows
- App launch: Expo CLI → Metro → JS bundle → Mobile runtime (Android/iOS)
- Screen navigation: app/ router → screen components → render UI
- UI interaction: Screens call Hooks → Hooks invoke Services → Services issue HTTP calls → External APIs respond → Data flows back up to UI
- Integration: Map screens import Mapbox config & province JSON → render markers and routes
- Authentication flow: Auth screens → authService → backend → token stored via useAlmacenamiento

##### Architectural Patterns & Principles
- Layered Architecture: clear separation of Presentation, Logic, Data
- File-based routing courtesy of Expo Router—treat the app/ directory as the navigation map
- Modular component design: domain-specific components grouped under components/
- Hooks encapsulate business logic and side effects, keep screens declarative

##### Key Technologies & Frameworks
- React Native + Expo (JavaScript runtime, cross-platform UI)
- TypeScript for static typing
- Expo Router / React Navigation for routing
- Mapbox for map rendering
- Gradle & native Kotlin code for Android support

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Mobile Runtime & Build
    subgraph "Mobile Runtime & Build"
        Metro["Expo Dev Tools & Metro Bundler"]:::native
        JSRuntime["JS Bundle & Runtime"]:::native
        subgraph "Android Native Wrapper"
            MainActivity["MainActivity.kt"]:::native
            MainApplication["MainApplication.kt"]:::native
        end
    end

    %% JavaScript Layers
    subgraph "Presentation Layer"
        FileRouting["File-based Routing (app/)"]:::ui
        subgraph "Routes"
            AuthRoutes["Authentication Routes"]:::ui
            TabRoutes["Tabbed Navigation Routes"]:::ui
            Modals["Modals"]:::ui
        end
        UIComponents["UI Components"]:::ui
    end

    subgraph "Business Logic Layer"
        Hooks["Custom Hooks"]:::logic
        Storage["State & Storage"]:::logic
    end

    subgraph "Data & Services Layer"
        Services["REST Clients"]:::data
        Assets["Static Assets & Configs"]:::data
    end

    %% External Systems
    subgraph "External Systems"
        MapboxAPI["Mapbox API"]:::external
        BackendAPI["Backend REST Endpoints"]:::external
    end

    %% Data Flows & Relationships
    Metro --> JSRuntime
    JSRuntime --> FileRouting
    JSRuntime --> UIComponents
    JSRuntime --> Hooks

    FileRouting --> AuthRoutes
    FileRouting --> TabRoutes
    FileRouting --> Modals
    UIComponents --> Hooks

    AuthRoutes --> Hooks
    TabRoutes --> Hooks
    Modals --> Hooks

    Hooks --> Storage
    Hooks --> Services

    Services --> BackendAPI
    Services --> MapboxAPI
    Assets --> UIComponents
    Assets --> Hooks
    Assets --> Services

    %% Click Events
    click MainActivity "https://github.com/kevincito20/tourin-panama/blob/master/android/app/src/main/java/com/anonymous/TourInPanama/MainActivity.kt"
    click MainApplication "https://github.com/kevincito20/tourin-panama/blob/master/android/app/src/main/java/com/anonymous/TourInPanama/MainApplication.kt"
    click FileRouting "https://github.com/kevincito20/tourin-panama/blob/master/app/_layout.tsx"
    click AuthRoutes "https://github.com/kevincito20/tourin-panama/blob/master/app/(autenticacion)/_layout.tsx"
    click TabRoutes "https://github.com/kevincito20/tourin-panama/blob/master/app/(tabs)/_layout.tsx"
    click Modals "https://github.com/kevincito20/tourin-panama/blob/master/app/modales/ScreenFormulario.tsx"
    click UIComponents "https://github.com/kevincito20/tourin-panama/blob/master/components/ui/boton.tsx"
    click Hooks "https://github.com/kevincito20/tourin-panama/blob/master/hooks/useActividades.ts"
    click Storage "https://github.com/kevincito20/tourin-panama/blob/master/hooks/useAlmacenamiento.ts"
    click Services "https://github.com/kevincito20/tourin-panama/blob/master/components/services/ActividadesService.ts"
    click Assets "https://github.com/kevincito20/tourin-panama/blob/master/assets/configuracionMapbox.ts"

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#1E90FF,color:#000;
    classDef logic fill:#DFFFD0,stroke:#32CD32,color:#000;
    classDef data fill:#FFF5BA,stroke:#FFD700,color:#000;
    classDef native fill:#FFE4B5,stroke:#FF8C00,color:#000;
    classDef external fill:#EAD0FF,stroke:#800080,color:#000;
```
