How tauanmartins/frontend-techarena works
Project Type and Purpose
• This is a React Native mobile‐frontend (“Frontend‐TechArena”) for the TechArena application.
• It targets both Android and iOS (via the android/ and ios/ folders) and provides UI screens, navigation, theming, authentication contexts, and API integrations with a backend service.
File‐Structure Analysis
• Top‐level entries:
• App.tsx & index.js: entry point of the React Native JS application.
• android/ & ios/: native platform projects for Android (Gradle) and iOS (Xcode).
• src/: all JS/TS source code, subdivided into:
– components/: reusable UI widgets (buttons, avatars, dialogs, etc.)
– pages/: full‐screen views (Login, Home, CreateMatch, League, Social, Settings)
– navigation/: routing and navigator definitions (stack/tab navigators, types)
– utils/: network/API calls, authentication & model contexts, theming, token utilities.
– assets/: static images and fonts.
• Configuration & tooling:
• babel.config.js, metro.config.js: Metro bundler configuration.
• jest.config.js and __tests__/: test setup.
• .eslintrc.js, .prettierrc.js: linting and formatting.
Key Architectural Components
a. React Native JS Layer
– Entrypoint (index.js → App.tsx) initializes ContextProviders (Auth, Theme) and mounts the root Navigator.
– Navigation Layer (src/navigation/): organizes screens into stacks and tabs.
– UI Components (src/components/): building blocks used by pages.
– Pages (src/pages/): combine UI components to render full screens and handle user interactions.
b. State & Context Management
– AuthContext: provides authentication state and methods (login/logout, token storage).
– ThemeContext: handles light/dark theming across the app.
– Localization & Model Contexts: optional, for multi‐language support and shared models.
c. Network/API Layer
– API Utils (src/utils/API/): modules grouping REST calls by domain (Users, Teams, Chats, Arenas, etc.).
– Underlying HTTP client (fetch or Axios).
d. Native Bridges
– Android native code under android/app/src/... and iOS code under ios/app_techarena/: handle platform‐specific modules (e.g., Flipper debugging).
e. External Services
– Backend REST API: a remote server providing data for appointments, matches, chat, user profiles, etc.
– Potential third‐party services (analytics, push notifications) – not present now but typical in mobile apps.
1. User Device (Phone)
2. React Native Runtime
• JSCore / Hermes (for Android/iOS)
• Native Modules Bridge
3. JavaScript Layer
• App Entrypoint & Providers
• Navigation
• UI Components / Pages
• Context Providers (Auth, Theme)
• API Utilities
4. Native Platform
• Android (Gradle, Activities, Application)
• iOS (Xcode Project, AppDelegate)
5. External Backend (REST API)
• User touches UI → Navigation events → Page logic
• Page logic → Context (read/write state)
• API call initiation → API Utils → Network → Backend
• Backend response → API Utils → update Context → UI re‐render
• Native events (push notifications, device APIs) → Native → JS via Bridge
c. Architectural Patterns:
• Unidirectional Data Flow: UI → Actions → Context/State → UI.
• Layered Architecture: Presentation (Components/Pages), State (Contexts), Services (API), Platform (Native).
d. Technologies:
• React Native, TypeScript
• React Navigation
• Metro Bundler
• Jest (testing)
• Native platform languages (Java/Kotlin for Android, Objective-C/Swift for iOS)