# krtk-dev/translators architecture

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

- Interactive diagram: https://gitdiagram.com/krtk-dev/translators
- Repository: https://github.com/krtk-dev/translators

## Overview

##### Main Components

A. Frontend Layer
- Mobile App (React Native)
- iOS Application
- Android Application
- Web Application (React)
- Shared Components between platforms

B. Core Features Layer
- Translation Services Integration
- Google Translate
- Papago
- Kakao Translate
- History Management
- Card Sequence System

C. State Management Layer
- Context Providers
- TranslateContext
- CardSequenceContext
- HistoryContext

**┌─ Client Layer ─────────────────────┐**
- ┌─ Web ─────┐    ┌─ Mobile ─────┐ │
- React SPA  │    │React Native  │ │
- Components │    │iOS & Android │ │
- ┘    └─────────────┘ │
- ┘

- ▼            ▼
**┌─ Core Services Layer ─────────────┐**
- ┌─ Translation Services ────────┐ │
- Google Translate          │ │
- Papago                    │ │
- Kakao Translate          │ │
- ┘ │
- ┘

- ▼            ▼
**┌─ State Management Layer ─────────┐**
- ┌─ Context Providers ──────────┐ │
- TranslateContext         │ │
- CardSequenceContext      │ │
- HistoryContext          │ │
- ┘ │
- ┘

##### Important Details to Highlight

A. Shared Logic:
- How `src/util` and common components are shared
- Common TypeScript types and constants

B. Navigation Flow:
- Navigation structure (RootStackNavigation, HomeDrawerNavigation)
- Screen hierarchy and relationships

C. Testing Infrastructure:
- Jest testing setup
- CI/CD workflow integration

##### Key Architectural Patterns to Emphasize

- Context-based state management
- Component composition pattern
- Screen-based organization
- Shared utilities and types
- Cross-platform code sharing

##### Implementation Notes

- The separation between mobile and web implementations
- Common business logic sharing
- Translation service integration points
- State management flow
- Navigation structure

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        MobileApp["Mobile App"]:::mobile
        WebApp["Web Application"]:::web
        
        subgraph MobileComponents
            iOS["iOS App"]:::mobile
            Android["Android App"]:::mobile
            BaseButton["Base Button"]:::component
            BaseInput["Base Input"]:::component
            Typography["Typography"]:::component
            Navigation["Navigation System"]:::component
        end
        
        subgraph Screens
            HistoryScreen["History Screen"]:::screen
            CardSequenceScreen["Card Sequence"]:::screen
        end
    end

    subgraph CoreFeatures
        subgraph TranslationServices
            GoogleTranslate["Google Translate"]:::translation
            Papago["Papago"]:::translation
            KakaoTranslate["Kakao Translate"]:::translation
        end
        
        subgraph SharedLogic
            Types["Core Types"]:::util
            Constants["Constants"]:::util
            LanguageUtil["Language Utilities"]:::util
        end
    end

    subgraph StateManagement
        TranslateContext["Translate Context"]:::context
        CardSequenceContext["Card Sequence Context"]:::context
        HistoryContext["History Context"]:::context
    end

    subgraph Infrastructure
        CIApp["CI App Workflow"]:::infra
        CIWeb["CI Web Workflow"]:::infra
        CDWeb["CD Web Workflow"]:::infra
    end

    MobileApp --> iOS
    MobileApp --> Android
    iOS & Android --> Navigation
    Navigation --> HistoryScreen
    Navigation --> CardSequenceScreen
    iOS & Android --> BaseButton & BaseInput & Typography
    
    MobileApp & WebApp --> TranslationServices
    TranslationServices --> TranslateContext
    
    HistoryScreen --> HistoryContext
    CardSequenceScreen --> CardSequenceContext
    
    SharedLogic --> MobileApp
    SharedLogic --> WebApp

    click MobileApp "https://github.com/krtk-dev/translators/tree/main/app"
    click WebApp "https://github.com/krtk-dev/translators/tree/main/web"
    click TranslateContext "https://github.com/krtk-dev/translators/blob/main/app/src/context/TranslateContext.tsx"
    click HistoryContext "https://github.com/krtk-dev/translators/blob/main/app/src/context/HistoryContext.tsx"
    click CardSequenceContext "https://github.com/krtk-dev/translators/blob/main/app/src/context/CardSequenceContext.tsx"
    click HistoryScreen "https://github.com/krtk-dev/translators/tree/main/app/src/screens/HistoryScreen"
    click CardSequenceScreen "https://github.com/krtk-dev/translators/tree/main/app/src/screens/CardSequenceScreen"
    click Navigation "https://github.com/krtk-dev/translators/blob/main/app/src/navigations/RootStackNavigation.tsx"
    click BaseButton "https://github.com/krtk-dev/translators/blob/main/app/src/components/BaseButton.tsx"
    click BaseInput "https://github.com/krtk-dev/translators/blob/main/app/src/components/BaseInput.tsx"
    click Typography "https://github.com/krtk-dev/translators/blob/main/app/src/components/Typography.tsx"
    click Types "https://github.com/krtk-dev/translators/blob/main/app/src/constants/types.ts"
    click Constants "https://github.com/krtk-dev/translators/blob/main/app/src/constants/values.ts"
    click LanguageUtil "https://github.com/krtk-dev/translators/blob/main/app/src/util/languageTo.ts"
    click CIApp "https://github.com/krtk-dev/translators/blob/main//.github/workflows/ci-app.yml"
    click CIWeb "https://github.com/krtk-dev/translators/blob/main//.github/workflows/ci-web.yml"
    click CDWeb "https://github.com/krtk-dev/translators/blob/main//.github/workflows/cd-web.yml"

    classDef mobile fill:#4a90e2,stroke:#2e5b99,color:white
    classDef web fill:#5d9cec,stroke:#2e5b99,color:white
    classDef component fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef screen fill:#3498db,stroke:#2980b9,color:white
    classDef translation fill:#2ecc71,stroke:#27ae60,color:white
    classDef context fill:#e67e22,stroke:#d35400,color:white
    classDef util fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef infra fill:#7f8c8d,stroke:#666666,color:white

    %% Legend
    subgraph Legend
        L1["Mobile Components"]:::mobile
        L2["Web Components"]:::web
        L3["UI Components"]:::component
        L4["Screens"]:::screen
        L5["Translation Services"]:::translation
        L6["Context Providers"]:::context
        L7["Utilities"]:::util
        L8["Infrastructure"]:::infra
    end
```
