# lucasdoreac/investindo architecture

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

- Interactive diagram: https://gitdiagram.com/lucasdoreac/investindo
- Repository: https://github.com/lucasdoreac/investindo

## Overview

##### Project Type and Purpose
- This is a mobile full-stack (front-end only) educational finance application built with React Native (Expo) and TypeScript.
- Purpose: present ebook content, interactive glossaries, user profiles, and finance simulators (juros compostos, comparador, escada de vencimentos, montador de carteira).

##### File Structure
- Top-level configuration:
- app.json (Expo config)
- babel.config.js, tsconfig.json, package.json
- scripts/ (build helpers: LaTeX converter, project reset)
- jest/ & __tests__ (unit tests for calculator logic)
- Key source folders:
- app/ – file-based routing (expo-router) providing screen components under tabs and nested `/calculadora/*` routes
- assets/ – static content (markdown, JSON chapters, fonts, images, LaTeX)
- components/ – shared UI and theming components (Collapsible, EbookContent, ThemedView/text, ui/IconSymbol, etc.)

##### README Insights
- Confirms the four main simulator tools and the eBook-based curriculum.
- Lists core technologies: Expo, React Native, TypeScript, expo-router, react-native-chart-kit (charts), mathjs (calculations).

##### Main Components and Interactions
a. Presentation Layer
- Screens (tabs: Biblioteca, Explore, Glossário, Perfil, Simuladores)
- Calculator pages under `/app/calculadora`
b. Navigation Layer
- expo-router’s file-based routing tying app/* files to Navigation
c. Business Logic Layer
- Calculator modules (in `/app/calculadora`) that invoke mathjs
- Profile questionnaire logic (inside Perfil.tsx)
d. Data Layer
- Static content loader: reads markdown/JSON from assets/content (via script-converted JSON)
- Local storage or state management (React Context or local state) for user profile and selections
e. External Libraries & Services
- mathjs for finance formulas
- react-native-chart-kit for graphing results
- Expo APIs (Haptics, assets, font loading)

##### Architectural Patterns & Design Principles
- File-based routing: Each screen is a file in `app/`
- Component composition: small, reusable UI primitives in `components/ui`
- Separation of concerns: UI vs. business logic vs. static data
- Build step for static content: `scripts/latex-converter.js` transforms LaTeX/Markdown into JSON for faster runtime loading

##### Additional Details to Capture
- Build-time script that converts LaTeX/Markdown to JSON under “Build Process.”
- Testing harness (`__tests__`) as a side component validating calculator logic.
- Theming hooks (`useThemeColor`, `useColorScheme`) under the presentation layer.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Build Process
    subgraph "Build Process"
        BC["LaTeX/Markdown Converter"]:::build
    end
    click BC "https://github.com/lucasdoreac/investindo/blob/main/scripts/latex-converter.js"

    %% App Container and Routing
    subgraph "Runtime Environment"
        AC["App Container (Expo)"]:::infra
        RL["Root Layout"]:::nav
        TL["Tabs Layout"]:::nav
        NF["Not Found Screen"]:::presentation
        AC --> RL
        RL --> TL
        RL --> NF
    end
    click AC "https://github.com/lucasdoreac/investindo/blob/main/app.json"
    click RL "https://github.com/lucasdoreac/investindo/blob/main/app/_layout.tsx"
    click TL "https://github.com/lucasdoreac/investindo/blob/main/app/(tabs)/_layout.tsx"
    click NF "https://github.com/lucasdoreac/investindo/blob/main/app/+not-found.tsx"

    %% Presentation Layer
    subgraph "Presentation Layer" 
        direction TB
        subgraph "Tabs"
            BIB["Biblioteca Screen"]:::presentation
            EXP["Explore Screen"]:::presentation
            GLO["Glossário Screen"]:::presentation
            PER["Perfil Screen"]:::presentation
            SIM["Simuladores Screen"]:::presentation
            IDX["Default Tab Index"]:::presentation
        end
        RL --> IDX
        IDX --> BIB
        IDX --> EXP
        IDX --> GLO
        IDX --> PER
        IDX --> SIM
    end
    click BIB "https://github.com/lucasdoreac/investindo/blob/main/app/(tabs)/biblioteca.tsx"
    click EXP "https://github.com/lucasdoreac/investindo/blob/main/app/(tabs)/explore.tsx"
    click GLO "https://github.com/lucasdoreac/investindo/blob/main/app/(tabs)/glossario.tsx"
    click PER "https://github.com/lucasdoreac/investindo/blob/main/app/(tabs)/perfil.tsx"
    click SIM "https://github.com/lucasdoreac/investindo/blob/main/app/(tabs)/simuladores.tsx"
    click IDX "https://github.com/lucasdoreac/investindo/blob/main/app/(tabs)/index.tsx"

    %% Shared UI & Theming
    subgraph "Shared UI & Theming"
        direction TB
        subgraph "Components"
            COL["Collapsible"]:::component
            EBC["Ebook Content Renderer"]:::component
            EEBC["Enhanced Ebook Content"]:::component
            TV["Themed View"]:::component
            TT["Themed Text"]:::component
            ICON["Icon Library"]:::component
            TBB["Tab Bar Background"]:::component
        end
        subgraph "Hooks"
            UCS["useColorScheme"]:::hook
            UTC["useThemeColor"]:::hook
        end
        subgraph "Constants"
            COLORS["Colors"]:::constant
        end
        SIM --> COL
        SIM --> EBC
        SIM --> EEBC
        SIM --> TV
        SIM --> TT
        SIM --> ICON
        SIM --> TBB
        SIM --> UCS
        SIM --> UTC
        colink-->COL
        colink-->EBC
        colink-->EEBC
        colink-->TV
        colink-->TT
        colink-->ICON
        colink-->TBB
        UCS --> COLORS
        UTC --> COLORS
    end
    click COL "https://github.com/lucasdoreac/investindo/blob/main/components/Collapsible.tsx"
    click EBC "https://github.com/lucasdoreac/investindo/blob/main/components/EbookContent.tsx"
    click EEBC "https://github.com/lucasdoreac/investindo/blob/main/components/EnhancedEbookContent.tsx"
    click TV "https://github.com/lucasdoreac/investindo/blob/main/components/ThemedView.tsx"
    click TT "https://github.com/lucasdoreac/investindo/blob/main/components/ThemedText.tsx"
    click ICON "https://github.com/lucasdoreac/investindo/blob/main/components/ui/IconSymbol.tsx"
    click TBB "https://github.com/lucasdoreac/investindo/blob/main/components/ui/TabBarBackground.tsx"
    click UCS "https://github.com/lucasdoreac/investindo/blob/main/hooks/useColorScheme.ts"
    click UTC "https://github.com/lucasdoreac/investindo/blob/main/hooks/useThemeColor.ts"
    click UCS "https://github.com/lucasdoreac/investindo/blob/main/hooks/useColorScheme.web.ts"
    click COLORS "https://github.com/lucasdoreac/investindo/blob/main/constants/Colors.ts"

    %% Business Logic Layer
    subgraph "Calculators" 
        direction TB
        JC["Juros Compostos"]:::logic
        CMP["Comparador"]:::logic
        EV["Escada de Vencimentos"]:::logic
        MC["Montador de Carteira"]:::logic
        SIM --> JC
        SIM --> CMP
        SIM --> EV
        SIM --> MC
    end
    click JC "https://github.com/lucasdoreac/investindo/blob/main/app/calculadora/juros-compostos.tsx"
    click CMP "https://github.com/lucasdoreac/investindo/blob/main/app/calculadora/comparador.tsx"
    click EV "https://github.com/lucasdoreac/investindo/blob/main/app/calculadora/escada-vencimentos.tsx"
    click MC "https://github.com/lucasdoreac/investindo/blob/main/app/calculadora/montador-carteira.tsx"

    %% Data / Assets
    subgraph "Data Layer (Static Content)"
        direction TB
        DS["Content Store"]:::data
    end
    BC --> DS
    BIB -->|"fetch chapter JSON"| DS
    EXP --> DS
    GLO --> DS

    click DS "https://github.com/lucasdoreac/investindo/blob/main/assets/content/capitulo1.json"
    click DS "https://github.com/lucasdoreac/investindo/blob/main/assets/content/capitulo1.md"
    click DS "https://github.com/lucasdoreac/investindo/blob/main/assets/content/capitulo2.md"
    click DS "https://github.com/lucasdoreac/investindo/blob/main/assets/content/capitulo3.md"
    click DS "https://github.com/lucasdoreac/investindo/blob/main/assets/content/capitulo4.md"
    click DS "https://github.com/lucasdoreac/investindo/blob/main/assets/content/capitulo5.md"
    click DS "https://github.com/lucasdoreac/investindo/blob/main/assets/content/capitulo6.md"
    click DS "https://github.com/lucasdoreac/investindo/blob/main/assets/content/exemplo.json"

    %% External Libraries & Services
    subgraph "External Libraries" 
        direction TB
        MJ["mathjs"]:::external
        RK["react-native-chart-kit"]:::external
        EXAPI["Expo APIs"]:::external
        JC --> MJ
        CMP --> MJ
        EV --> MJ
        MC --> MJ
        JC --> RK
        CMP --> RK
        EV --> RK
        MC --> RK
        AC --> EXAPI
    end

    %% Testing Harness
    subgraph "Testing"
        TH["Calculator Unit Tests"]:::test
    end
    TH --> JC
    TH --> CMP
    TH --> EV
    TH --> MC
    click TH "https://github.com/lucasdoreac/investindo/blob/main/__tests__/calculadoras/*.test.js"

    %% Styles
    classDef presentation fill:#D0E8FF,stroke:#0366d6
    classDef nav fill:#D8F8D8,stroke:#28a745
    classDef logic fill:#FFE4B2,stroke:#db8b00
    classDef data fill:#E5D0FF,stroke:#6f42c1
    classDef component fill:#F0F0F0,stroke:#6c757d
    classDef hook fill:#FFF5CC,stroke:#d39e00
    classDef constant fill:#EDEDED,stroke:#343A40
    classDef build fill:#E0E0E0,stroke:#5A5A5A
    classDef infra fill:#FFF7E6,stroke:#FAAD14
    classDef external fill:#FFF0F0,stroke:#D73A49
    classDef test fill:#F5F5F5,stroke:#6c757d
```
