# mariavyso/journaling_app architecture

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

- Interactive diagram: https://gitdiagram.com/mariavyso/journaling_app
- Repository: https://github.com/mariavyso/journaling_app

## Overview

##### Project type and purpose
- This is a mobile journaling application (React Native with Expo) that:
– Records audio in the app (using recording_button.js & timer.js)
– Sends the audio clip to a Google Cloud Function (google_function.py)
– Uses OpenAI Whisper to transcribe the audio
– Creates or appends to a Google Doc via the Google Docs API

##### Out the main components
a. Mobile Client (React Native/Expo)
- App.js: root component
- recording_button.js & timer.js: audio-capture UI
- babel.config.js, app.json, package.json: build & config
b. Cloud Backend
- Google Cloud Function (python): handles HTTP POST of audio
- OpenAI Whisper API: external transcription service
- Google Docs API: external document‐creation service
c. Data stores & user environment
- Google Drive/Docs: stores the user’s journal entries
- (Implicit) Mobile device mic and local state

##### Interactions and data flows
1) User taps “Record” → Mobile app captures audio.
2) On “Stop,” app bundles audio blob into an HTTP request.
3) App calls the Cloud Function endpoint (HTTPS).
4) Cloud Function:
– Receives audio binary
– Calls OpenAI Whisper API → receives transcript text
– Calls Google Docs API → creates/appends to Doc in the user’s Drive
– Returns a response (e.g., success + doc URL)
5) Mobile app may display confirmation or link to the Doc.

##### Architectural patterns & principles
- Client‐Server separation: thin client; heavy lifting in the Cloud Function
- Serverless microservice: single-purpose function triggered via HTTP
- External service integration: best-of-breed APIs rather than own NLP or storage

##### Detail is key—but avoid clutter
- Logical component (UI, audio capture, HTTP endpoint, transcription, storage)
- Number or annotate the workflow steps so a reader can follow the path from “Record” to “Doc created.”

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Mobile Client Components
    subgraph "Mobile Client"
        direction TB
        App["App.js"]:::client
        Rec["recording_button.js"]:::client
        Timer["timer.js"]:::client
    end

    %% Client Configuration
    subgraph "Client Config"
        direction TB
        BC["babel.config.js"]:::config
        AJ["app.json"]:::config
        PJ["package.json"]:::config
        PL["package-lock.json"]:::config
    end

    %% Static Assets
    subgraph "Static Assets"
        direction TB
        Img["images/"]:::static
    end

    %% Cloud Backend
    subgraph "Cloud Backend"
        direction TB
        GF["google_function.py"]:::serverless
    end

    %% External Services and Storage
    Whisper["OpenAI Whisper API"]:::api
    DocsAPI["Google Docs API"]:::api
    Drive["Google Drive/Docs"]:::storage

    %% Data Flow
    App -->|"1. User taps Record"| Rec
    Rec -->|"captures audio"| Timer
    Timer -->|"2. Stop and bundle audio"| GF
    GF -->|"4a. calls Whisper API"| Whisper
    Whisper -->|"transcript text"| GF
    GF -->|"4b. calls Google Docs API"| DocsAPI
    DocsAPI -->|"doc created/appended"| Drive
    Drive -->|"doc URL"| GF
    GF -->|"5. returns success + doc URL"| App

    %% Click Events
    click App "https://github.com/mariavyso/journaling_app/blob/main/App.js"
    click Rec "https://github.com/mariavyso/journaling_app/blob/main/recording_button.js"
    click Timer "https://github.com/mariavyso/journaling_app/blob/main/timer.js"
    click BC "https://github.com/mariavyso/journaling_app/blob/main/babel.config.js"
    click AJ "https://github.com/mariavyso/journaling_app/blob/main/app.json"
    click PJ "https://github.com/mariavyso/journaling_app/blob/main/package.json"
    click PL "https://github.com/mariavyso/journaling_app/blob/main/package-lock.json"
    click Img "https://github.com/mariavyso/journaling_app/tree/main/images/"
    click GF "https://github.com/mariavyso/journaling_app/blob/main/google_function.py"

    %% Styles
    classDef client fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef config fill:#F0F0F0,stroke:#000,stroke-width:1px
    classDef static fill:#D3D3D3,stroke:#000,stroke-width:1px
    classDef serverless fill:#FFA500,stroke:#000,stroke-width:1px
    classDef api fill:#DDA0DD,stroke:#000,stroke-width:1px
    classDef storage fill:#90EE90,stroke:#000,stroke-width:1px
```
