# aturtle4/flashfeed architecture

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

- Interactive diagram: https://gitdiagram.com/aturtle4/flashfeed
- Repository: https://github.com/aturtle4/flashfeed

## Overview

##### Project type and purpose
- FlashFeed is a full-stack news-aggregator system consisting of:
– An Android client (Jetpack Compose + MVVM + Room)
– A Python backend API (simple service providing /news/fetch)
– External news‐source integrations (e.g., Inshorts or other providers)
- The client delivers personalized, vertical-reel “TikTok-style” news in multiple languages; the backend fetches and normalizes news from upstream sources.

##### File structure
– Top-level:
- app/… → Android application module using Gradle/Kotlin
- backend/flashfeed-api/app/… → Python service code + requirements.txt
- build.gradle.kts, settings.gradle.kts → multi-module Gradle project
– Android app:
- src/main/java/com/example/flashfeed/API → Retrofit or HTTP client wrappers
- view layers: Home, Explore, Profile, Misc, reel_mechanism, topBar, ui/theme
- ViewModels under Profile and NewsReelViewModel
- Local Room database under database/ (Entities + DAOs)
- Activities: MainActivity, WebViewActivity, SplashActivity
– Backend:
- main.py – server entrypoint (Flask/FastAPI/Starlette)
- news.py, data.py, inshorts.py – fetch & transform logic for each upstream source

##### README for additional insights
– Architecture: explicitly MVVM on Android
– Lists key entities (UserPreferencesEntity, CategoryEntity, SavedReelEntity)
– Describes adaptive loading, TTS, WebView, multi-language

##### Elements
- Blue rectangles for Android components
- Green rectangles for backend components
- Clouds for external services

##### Detail
– Capture every module/folder as a distinct component (API client, DAOs, Entities, modules in backend)
– Label relationships (e.g., “writes to”, “reads from”, “invokes HTTP GET”)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Android Client Tier
    subgraph "Android Client" 
        direction TB
        subgraph "UI Layer" 
            direction TB
            Home["Home.kt"]:::android
            Explore["Explore.kt"]:::android
            ProfileScreen["Profile.kt"]:::android
            About["AboutTheApp.kt"]:::android
            Privacy["PrivacyPolicy.kt"]:::android
            Terms["TermsAndConditions.kt"]:::android
            NewsReelScreen["NewsReelScreen.kt"]:::android
            SetupAccount["SetupAccountScreen.kt"]:::android
            StartingPage["StartingPage.kt"]:::android
        end
        subgraph "ViewModel Layer"
            direction TB
            NewsReelVM["NewsReelViewModel.kt"]:::android
            CategoryVM["CategoryViewModel.kt"]:::android
            UserPrefsVM["UserPreferencesViewModel.kt"]:::android
        end
        subgraph "Data Layer"
            direction TB
            subgraph "Local DB (Room)" 
                direction TB
                FlashFeedDB["FlashFeedDatabase.kt"]:::db
                CategoryEntityDAO["CategoryEntity.kt & CategoryDao.kt"]:::db
                UserPrefsEntityDAO["UserPreferencesEntity.kt & UserPreferencesDao.kt"]:::db
                SavedReelEntityDAO["SavedReelEntity.kt & SavedReelDao.kt"]:::db
            end
            RemoteAPI["NewsAPI.kt"]:::android
        end
        subgraph "Activities & Theming"
            direction TB
            MainActivity["MainActivity.kt"]:::android
            WebViewActivity["WebViewActivity.kt"]:::android
            SplashLayout["activity_splash.xml"]:::android
            CategoryTopBar["CategoryTopBar.kt"]:::android
            ColorTheme["Color.kt"]:::android
            ThemeFile["Theme.kt"]:::android
            TypeFile["Type.kt"]:::android
        end
    end

    %% Backend Service Tier
    subgraph "Backend Service"
        direction TB
        subgraph "API Layer"
            direction TB
            APIGateway["main.py"]:::backend
        end
        subgraph "Service Layer"
            direction TB
            InshortsModule["inshorts.py"]:::backend
            NewsModule["news.py"]:::backend
            DataModule["data.py"]:::backend
        end
        Dependencies["requirements.txt"]:::backend
    end

    %% External Providers
    External["External News Providers"]:::external

    %% Relationships
    Home -->|uses| NewsReelVM
    Explore -->|uses| CategoryVM
    ProfileScreen -->|uses| UserPrefsVM
    NewsReelVM -->|reads from| FlashFeedDB
    NewsReelVM -->|writes to| SavedReelEntityDAO
    CategoryVM -->|reads/writes| CategoryEntityDAO
    UserPrefsVM -->|reads/writes| UserPrefsEntityDAO
    RemoteAPI -->|"HTTP GET /news/fetch"| APIGateway
    APIGateway -->|"invokes"| InshortsModule
    APIGateway -->|"invokes"| NewsModule
    APIGateway -->|"invokes"| DataModule
    InshortsModule -->|calls/scrapes| External
    NewsModule -->|calls/scrapes| External
    DataModule -->|calls/scrapes| External
    MainActivity -->|launches| WebViewActivity
    WebViewActivity -->|loads URL| External
    About -->|navigation| Privacy
    Terms -->|navigation| Privacy

    %% Click Events
    click Home "https://github.com/aturtle4/flashfeed/blob/main/app/src/main/java/com/example/flashfeed/Home/Home.kt"
    click Explore "https://github.com/aturtle4/flashfeed/blob/main/app/src/main/java/com/example/flashfeed/Explore/Explore.kt"
    click ProfileScreen "https://github.com/aturtle4/flashfeed/blob/main/app/src/main/java/com/example/flashfeed/Profile/Profile.kt"
    click About "https://github.com/aturtle4/flashfeed/blob/main/app/src/main/java/com/example/flashfeed/Misc/AboutTheApp.kt"
    click Privacy "https://github.com/aturtle4/flashfeed/blob/main/app/src/main/java/com/example/flashfeed/Misc/PrivacyPolicy.kt"
    click Terms "https://github.com/aturtle4/flashfeed/blob/main/app/src/main/java/com/example/flashfeed/Misc/TermsAndConditions.kt"
    click NewsReelScreen "https://github.com/aturtle4/flashfeed/blob/main/app/src/main/java/com/example/flashfeed/reel_mechanism/NewsReelScreen.kt"
    click SetupAccount "https://github.com/aturtle4/flashfeed/blob/main/app/src/main/java/com/example/flashfeed/SetupAccountScreen.kt"
    click StartingPage "https://github.com/aturtle4/flashfeed/blob/main/app/src/main/java/com/example/flashfeed/StartingPage.kt"
    click NewsReelVM "https://github.com/aturtle4/flashfeed/blob/main/app/src/main/java/com/example/flashfeed/Profile/NewsReelViewModel.kt"
    click CategoryVM "https://github.com/aturtle4/flashfeed/blob/main/app/src/main/java/com/example/flashfeed/Profile/CategoryViewModel.kt"
    click UserPrefsVM "https://github.com/aturtle4/flashfeed/blob/main/app/src/main/java/com/example/flashfeed/Profile/UserPreferencesViewModel.kt"
    click FlashFeedDB "https://github.com/aturtle4/flashfeed/blob/main/app/src/main/java/com/example/flashfeed/database/FlashFeedDatabase.kt"
    click CategoryEntityDAO "https://github.com/aturtle4/flashfeed/blob/main/app/src/main/java/com/example/flashfeed/database/CategoryEntity.kt"
    click UserPrefsEntityDAO "https://github.com/aturtle4/flashfeed/blob/main/app/src/main/java/com/example/flashfeed/database/UserPreferencesEntity.kt"
    click SavedReelEntityDAO "https://github.com/aturtle4/flashfeed/blob/main/app/src/main/java/com/example/flashfeed/database/SavedReelEntity.kt"
    click RemoteAPI "https://github.com/aturtle4/flashfeed/blob/main/app/src/main/java/com/example/flashfeed/API/NewsAPI.kt"
    click MainActivity "https://github.com/aturtle4/flashfeed/blob/main/app/src/main/java/com/example/flashfeed/MainActivity.kt"
    click WebViewActivity "https://github.com/aturtle4/flashfeed/blob/main/app/src/main/java/com/example/flashfeed/reel_mechanism/WebViewActivity.kt"
    click SplashLayout "https://github.com/aturtle4/flashfeed/blob/main/app/src/main/res/layout/activity_splash.xml"
    click CategoryTopBar "https://github.com/aturtle4/flashfeed/blob/main/app/src/main/java/com/example/flashfeed/topBar/CategoryTopBar.kt"
    click ColorTheme "https://github.com/aturtle4/flashfeed/blob/main/app/src/main/java/com/example/flashfeed/ui/theme/Color.kt"
    click ThemeFile "https://github.com/aturtle4/flashfeed/blob/main/app/src/main/java/com/example/flashfeed/ui/theme/Theme.kt"
    click TypeFile "https://github.com/aturtle4/flashfeed/blob/main/app/src/main/java/com/example/flashfeed/ui/theme/Type.kt"
    click APIGateway "https://github.com/aturtle4/flashfeed/blob/main/backend/flashfeed-api/app/main.py"
    click InshortsModule "https://github.com/aturtle4/flashfeed/blob/main/backend/flashfeed-api/app/inshorts.py"
    click NewsModule "https://github.com/aturtle4/flashfeed/blob/main/backend/flashfeed-api/app/news.py"
    click DataModule "https://github.com/aturtle4/flashfeed/blob/main/backend/flashfeed-api/app/data.py"
    click Dependencies "https://github.com/aturtle4/flashfeed/blob/main/backend/flashfeed-api/requirements.txt"

    %% Styles
    classDef android fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef backend fill:#90EE90,stroke:#000,stroke-width:1px
    classDef db fill:#F0E68C,stroke:#000,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#000,stroke-width:1px
```
