# talktolisten/talktolisten-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/talktolisten/talktolisten-frontend
- Repository: https://github.com/talktolisten/talktolisten-frontend

## Overview

##### Project Type & Purpose
- This is a mobile front‑end application built with Expo/React Native.
- It provides chat, group chat, character creation, and voice‐streaming features.
- It calls out to backend REST services (user, chat, voice, etc.), uses Firebase (auth/notifications), and integrates with Deepgram for voice processing.

##### Key Architectural Layers
a. Presentation Layer (UI & Navigation)
– components/… and screens/… hold all visual elements and page layouts.
– navigation/… contains React Navigation stacks and tab navigators.
b. State Management Layer
– redux/store, redux/actions, redux/reducers implement global state, action dispatching, and side‑effects.
c. Networking Layer
– axios/*.jsx modules wrap REST API calls (user, chat, groupchat, voice).
d. Utilities & Config
– util/*.js houses shared constants, helpers, token management.
– firebase.js initializes Firebase SDK.
– babel.config.js, metro.config.js and app.json govern build tooling & Expo.
e. External Services
– Backend API endpoints (authentication, chat, voice).
– Firebase for authentication and possibly push notifications.
– Deepgram for voice transcription/streaming.

##### Detail
- Which axios module each screen uses.
- Flow of authentication tokens (util/tokenUtils → axios interceptors).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Mobile App Container
    subgraph "Mobile App (Expo/React Native)"
        direction TB

        %% UI & Navigation Layer
        subgraph "UI & Navigation" 
            direction TB
            ComponentsDir["Components Directory"]:::ui
            ScreensDir["Screens Directory"]:::ui

            subgraph "Screens" 
                direction TB
                CharacterProfileScreen["CharacterProfileScreen.jsx"]:::ui
                ChatScreen["ChatScreen.jsx"]:::ui
                Chat["Chat.jsx"]:::ui
                GroupChat["GroupChat.jsx"]:::ui
                SearchBar["SearchBar.jsx"]:::ui
                VoiceScreen["VoiceScreen.jsx"]:::ui
                VoiceGroupScreen["VoiceGroupScreen.jsx"]:::ui
                VoiceStreamingJS["VoiceStreaming.js"]:::ui
                VoiceTalk["VoiceTalk.jsx"]:::ui
                VoiceHook["hook.jsx"]:::ui
                DataStreaming["dataStreaming.js"]:::ui
                DeepgramSetup["deepgram.js"]:::ui
            end

            subgraph "Navigation" 
                direction TB
                AuthStack["AuthStack.jsx"]:::ui
                ChatStack["ChatStack.jsx"]:::ui
                CreateCharacter["CreateCharacter.jsx"]:::ui
                HomeStack["HomeStack.jsx"]:::ui
                Nav["Nav.jsx"]:::ui
                ProfileStack["ProfileStack.jsx"]:::ui
                RandomStack["RandomStack.jsx"]:::ui
                TabNavigator["TabNavigator.jsx"]:::ui
            end
        end

        %% State Management Layer
        subgraph "State Management (Redux)" 
            direction TB
            Store["store/index.js"]:::state
            Actions["actions/userActions.js & actionTypes.js"]:::state
            Reducers["reducers/index.js & userReducer.js"]:::state
        end

        %% Networking Layer
        subgraph "API Layer (Axios Modules)" 
            direction TB
            API["api.jsx"]:::apiLayer
            Bots["bots.jsx"]:::apiLayer
            ChatAPI["chat.jsx"]:::apiLayer
            GroupChatAPI["groupchat.jsx"]:::apiLayer
            Guest["guest.jsx"]:::apiLayer
            UserAPI["user.jsx"]:::apiLayer
            VoiceAPI["voice.jsx"]:::apiLayer
        end

        %% Utilities & Config Layer
        subgraph "Utilities & Config" 
            direction TB
            Constants["constants.js"]:::util
            Helpers["helpers.js"]:::util
            TokenUtils["tokenUtils.js"]:::util
            FirebaseInit["firebase.js"]:::util
            BabelConfig["babel.config.js"]:::util
            MetroConfig["metro.config.js"]:::util
            AppConfig["app.json"]:::util
        end
    end

    %% External Services
    BackendAPI[(Backend API Server)]:::external
    Firebase[(Firebase Auth & Messaging)]:::external
    Deepgram[(Deepgram Service)]:::external
    EAS[(EAS Build & Expo Servers)]:::external

    %% Data Flows
    ComponentsDir -->|uses screens| ScreensDir
    ScreensDir -->|renders| CharacterProfileScreen
    CharacterProfileScreen -->|dispatches| Store
    ChatScreen -->|dispatches| Store
    VoiceScreen -->|dispatches| Store

    Store -->|dispatch actions to| Actions
    Actions -->|update via| Reducers
    Reducers -->|update state| Store

    Store -->|calls| API
    Store -->|calls| ChatAPI
    Store -->|calls| VoiceAPI

    API -->|HTTP requests| BackendAPI
    ChatAPI -->|HTTP requests| BackendAPI
    GroupChatAPI -->|HTTP requests| BackendAPI
    UserAPI -->|HTTP requests| BackendAPI
    VoiceAPI -->|HTTP requests| BackendAPI

    UserAPI -->|auth & data| Firebase
    VoiceAPI -->|streaming| Deepgram
    EAS -->|build & deploy| MobileApp["Mobile App (Expo/React Native)"]

    BackendAPI -->|response| API
    Deepgram -->|response| VoiceAPI
    Firebase -->|tokens & notifications| UserAPI

    API -->|response| Store
    Store -->|state update| ScreensDir
    ScreensDir -->|UI update| ComponentsDir

    %% Click Events
    click ComponentsDir "https://github.com/talktolisten/talktolisten-frontend/tree/main/components/"
    click ScreensDir "https://github.com/talktolisten/talktolisten-frontend/tree/main/screens/"
    click CharacterProfileScreen "https://github.com/talktolisten/talktolisten-frontend/blob/main/components/CharacterProfileScreen/CharacterProfileScreen.jsx"
    click ChatScreen "https://github.com/talktolisten/talktolisten-frontend/blob/main/components/ChatScreen/ChatScreen.jsx"
    click Chat "https://github.com/talktolisten/talktolisten-frontend/blob/main/components/ChatScreen/Chat.jsx"
    click GroupChat "https://github.com/talktolisten/talktolisten-frontend/blob/main/components/ChatScreen/GroupChat.jsx"
    click SearchBar "https://github.com/talktolisten/talktolisten-frontend/blob/main/components/ChatScreen/SearchBar.jsx"
    click VoiceScreen "https://github.com/talktolisten/talktolisten-frontend/blob/main/components/VoiceScreen/VoiceScreen.jsx"
    click VoiceGroupScreen "https://github.com/talktolisten/talktolisten-frontend/blob/main/components/VoiceScreen/VoiceGroupScreen.jsx"
    click VoiceStreamingJS "https://github.com/talktolisten/talktolisten-frontend/blob/main/components/VoiceScreen/VoiceStreaming.js"
    click VoiceTalk "https://github.com/talktolisten/talktolisten-frontend/blob/main/components/VoiceScreen/VoiceTalk.jsx"
    click VoiceHook "https://github.com/talktolisten/talktolisten-frontend/blob/main/components/VoiceScreen/hook.jsx"
    click DataStreaming "https://github.com/talktolisten/talktolisten-frontend/blob/main/components/VoiceScreen/setup/dataStreaming.js"
    click DeepgramSetup "https://github.com/talktolisten/talktolisten-frontend/blob/main/components/VoiceScreen/setup/deepgram.js"
    click AuthStack "https://github.com/talktolisten/talktolisten-frontend/blob/main/navigation/AuthStack.jsx"
    click ChatStack "https://github.com/talktolisten/talktolisten-frontend/blob/main/navigation/ChatStack.jsx"
    click CreateCharacter "https://github.com/talktolisten/talktolisten-frontend/blob/main/navigation/CreateCharacter.jsx"
    click HomeStack "https://github.com/talktolisten/talktolisten-frontend/blob/main/navigation/HomeStack.jsx"
    click Nav "https://github.com/talktolisten/talktolisten-frontend/blob/main/navigation/Nav.jsx"
    click ProfileStack "https://github.com/talktolisten/talktolisten-frontend/blob/main/navigation/ProfileStack.jsx"
    click RandomStack "https://github.com/talktolisten/talktolisten-frontend/blob/main/navigation/RandomStack.jsx"
    click TabNavigator "https://github.com/talktolisten/talktolisten-frontend/blob/main/navigation/TabNavigator.jsx"
    click Store "https://github.com/talktolisten/talktolisten-frontend/blob/main/redux/store/index.js"
    click Actions "https://github.com/talktolisten/talktolisten-frontend/blob/main/redux/actions/userActions.js"
    click Actions "https://github.com/talktolisten/talktolisten-frontend/blob/main/redux/actionTypes.js"
    click Reducers "https://github.com/talktolisten/talktolisten-frontend/blob/main/redux/reducers/index.js"
    click Reducers "https://github.com/talktolisten/talktolisten-frontend/blob/main/redux/reducers/userReducer.js"
    click API "https://github.com/talktolisten/talktolisten-frontend/blob/main/axios/api.jsx"
    click Bots "https://github.com/talktolisten/talktolisten-frontend/blob/main/axios/bots.jsx"
    click ChatAPI "https://github.com/talktolisten/talktolisten-frontend/blob/main/axios/chat.jsx"
    click GroupChatAPI "https://github.com/talktolisten/talktolisten-frontend/blob/main/axios/groupchat.jsx"
    click Guest "https://github.com/talktolisten/talktolisten-frontend/blob/main/axios/guest.jsx"
    click UserAPI "https://github.com/talktolisten/talktolisten-frontend/blob/main/axios/user.jsx"
    click VoiceAPI "https://github.com/talktolisten/talktolisten-frontend/blob/main/axios/voice.jsx"
    click Constants "https://github.com/talktolisten/talktolisten-frontend/blob/main/util/constants.js"
    click Helpers "https://github.com/talktolisten/talktolisten-frontend/blob/main/util/helpers.js"
    click TokenUtils "https://github.com/talktolisten/talktolisten-frontend/blob/main/util/tokenUtils.js"
    click FirebaseInit "https://github.com/talktolisten/talktolisten-frontend/blob/main/firebase.js"
    click BabelConfig "https://github.com/talktolisten/talktolisten-frontend/blob/main/babel.config.js"
    click MetroConfig "https://github.com/talktolisten/talktolisten-frontend/blob/main/metro.config.js"
    click AppConfig "https://github.com/talktolisten/talktolisten-frontend/blob/main/app.json"

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#333,stroke-width:1px
    classDef state fill:#FFF2CC,stroke:#333,stroke-width:1px
    classDef apiLayer fill:#FFD8B1,stroke:#333,stroke-width:1px
    classDef util fill:#E2E2E2,stroke:#333,stroke-width:1px
    classDef external fill:#C8E6C9,stroke:#333,stroke-width:1px
```
