How lucasdoreac/investindo-2 works
Project type and purpose
• This is a React Native mobile application (built with Expo and TypeScript) whose purpose is to teach beginner investors about finance via:
• Interactive eBook content (markdown/JSON chapters).
• A glossary of terms.
• A profile questionnaire.
• Four financial simulators (compound interest, investment comparator, laddering strategy, portfolio builder).
File structure
• Top-level:
• app/ – file-based routing (Expo Router) with nested (tabs) and calculadora screens.
• components/ – reusable UI components and themed wrappers.
• assets/content/ – markdown and JSON content for chapters and examples.
• constants/, hooks/, scripts/ – theme constants, custom hooks, build scripts.
• __tests__/ – unit tests for each simulator.
• config: package.json, babel.config.js, tsconfig.json, eslint.config.js, jest/.
README for additional insights
• Core libraries: React Native, Expo, React Navigation (via Expo Router), mathjs (calculations), react-native-chart-kit (charts).
• No external backend – all content and computation live on the client.
a. Main components:
1. Mobile Device (iOS/Android)
2. Expo App Container
3. Navigation Layer (Tabs Navigator & Stack Navigator)
4. Feature Modules:
– Biblioteca Module (loads markdown/JSON from assets via EbookContent)
– Glossário Module (loads glossary entries)
– Perfil Module (questionnaire + saves profile to AsyncStorage)
– Simuladores Module:
• Juros Compostos
• Comparador de Investimentos
• Escada de Vencimentos
• Montador de Carteira
5. Shared Components & Services:
– UI Components (Collapsible, ParallaxScrollView, ThemedText/View, ExternalLink, IconSymbol)
– Calculation Engine (mathjs wrapper)
6. Data Sources:
– Local Assets (assets/content/*.md, .json; assets/images; fonts)
– AsyncStorage (user profile persistence)
7. Third-Party Libraries:
– Expo Router / React Navigation
– react-native-chart-kit
– mathjs
b. Relationships and data flows:
• User taps a tab → Navigation Layer routes to the appropriate Screen.
• Screen invokes shared services:
• Content Screens → read from assets folder via filesystem API (bundled).
• Simulator Screens → call calculation engine → return numerical results.
• Results passed to UI Components (charts, collapsible panels).
• Perfil Module stores/reads profile data in AsyncStorage.
• All screens themed via Theme & ColorScheme hooks.
c. Architectural patterns / design principles:
• Feature-based modularization: each major feature (biblioteca, simuladores, perfil, glossario) lives in its own screen subtree.
• Separation of concerns: UI components vs. business logic (calculations) vs. asset/content management.
• File-based routing courtesy of Expo Router for clear navigation mapping.
• Theming abstraction via custom hooks.
d. Key technologies/frameworks:
• Expo (app container, build/deploy)
• Expo Router / React Navigation (navigation)
• React Native + TypeScript (UI)
• mathjs (computation)
• react-native-chart-kit (visualization)
• AsyncStorage (persistence)
Detailed breakdown
• Expo App Container (top-level rectangle).
• Inside that, a “Navigation Layer” rectangle splitting into five branches (Tabs).
• Step 3: For each tab:
• Biblioteca → EbookContent & EnhancedEbookContent → Assets (chapters JSON/MD).
• Explore → (future/empty or search interface if any).
• Glossario → loads glossary terms via Content service.
• Perfil → Questionnaire flow → AsyncStorage.
• Simuladores → Stack or nested navigator → four calculator screens.
• Step 4: Show the Calculation Engine service (mathjs) connected to each simulator.
• Step 5: Show UI Components library consumed by all screens.
• Step 6: Show hook layer (useThemeColor, useColorScheme) feeding into UI Components.