# sonyaouthred/divvy architecture

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

- Interactive diagram: https://gitdiagram.com/sonyaouthred/divvy
- Repository: https://github.com/sonyaouthred/divvy

## Overview

##### Project type and purpose
- This is a cross-platform mobile/desktop/web front-end written in Flutter/Dart.
- Purpose: a chore-sharing app (“Divvy”) with user authentication, chore scheduling, swap flows, and notifications.
- The front end talks to two back-end services: Firebase Authentication and a Flask REST API server (hosted separately in its own repo).

##### File structure
- Top-level platform folders (android, ios, linux, macos, web, windows): Flutter build targets and platform wrappers.
- lib/ folder: holds the bulk of the front-end code, organized into:
- models/ (domain objects: Chore, House, Member, Swap, etc.)
- providers/ (state management via Provider: DivvyProvider)
- screens/ (UI pages corresponding to each user flow: login, dashboard, house screens, etc.)
- widgets/ (reusable UI components: tiles, dialogs, leaderboard)
- util/ (helper functions: date utilities, dialog builders, server_util for REST calls)
- firebase/ (Firebase auth service and auto-generated firebase_options.dart)
- divvy_navigation.dart (bottom nav bar)
- main.dart (app entrypoint)
- Configuration and CI: .github/workflows/flutter-ci.yaml, analysis_options.yaml, pubspec.yaml, firebase.json.

##### README for additional insights
- Confirms Flutter 3.32 / Dart 3.8+ stack.
- States the need to run a separate Flask server locally for data persistence.
- Describes CI: GitHub Actions runs flutter test and builds on iOS/Android.
- Documents code structure, dependencies, and build/run steps.

##### Elements
- Clear labels (e.g., “ChoreModel”, “DivvyProvider”, “server_util RESTClient”)
- Annotations for protocols (HTTPS/REST) and data formats (JSON)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Side
    subgraph "Flutter Client"
        direction TB
        subgraph "Presentation Layer"
            direction TB
            LoginScreen["LoginScreen"]:::client
            DashboardScreen["DashboardScreen"]:::client
            HouseScreen["HouseScreen"]:::client
            ChoresScreen["ChoresScreen"]:::client
            SwapScreen["SwapScreen"]:::client
            AddSwapScreen["AddSwapScreen"]:::client
            ChooseSwapScreen["ChooseSwapScreen"]:::client
            ChoreTile["ChoreTile"]:::client
            SwapTile["SwapTile"]:::client
            PendingSwapTile["PendingSwapTile"]:::client
            MemberTile["MemberTile"]:::client
            SubgroupTile["SubgroupTile"]:::client
            Leaderboard["Leaderboard"]:::client
        end

        subgraph "State Layer"
            DivvyProvider["DivvyProvider"]:::client
        end

        subgraph "Service Layer"
            FirebaseAuthService["FirebaseAuthService"]:::client
            RESTClient["server_util RESTClient"]:::client
        end
    end

    %% External Services
    subgraph "External Services"
        direction TB
        FirebaseAuth["Firebase Auth Service"]:::external
        FlaskAPI["Divvy Flask REST API"]:::external
        DB["Relational/NoSQL DB"]:::db
    end

    %% CI/CD
    CI["GitHub Actions CI/CD"]:::ci

    %% Platforms
    subgraph "Target Platforms"
        direction TB
        Android["Android"]:::client
        iOS["iOS"]:::client
        Web["Web"]:::client
        Desktop["Desktop"]:::client
    end

    %% Flows
    Android -->|runs app| LoginScreen
    iOS -->|runs app| LoginScreen
    Web -->|runs app| LoginScreen
    Desktop -->|runs app| LoginScreen

    LoginScreen -->|calls| DivvyProvider
    DashboardScreen -->|calls| DivvyProvider
    HouseScreen -->|calls| DivvyProvider
    ChoresScreen -->|calls| DivvyProvider
    SwapScreen -->|calls| DivvyProvider
    AddSwapScreen -->|calls| DivvyProvider
    ChooseSwapScreen -->|calls| DivvyProvider

    DivvyProvider -->|auth flow| FirebaseAuthService
    DivvyProvider -->|data flow| RESTClient

    FirebaseAuthService -->|HTTPS/OAuth| FirebaseAuth
    FirebaseAuth -->|token| FirebaseAuthService
    FirebaseAuthService -->|session| DivvyProvider

    RESTClient -->|HTTPS/REST| FlaskAPI
    FlaskAPI -->|SQL/NoSQL queries| DB
    DB -->|JSON| FlaskAPI
    FlaskAPI -->|JSON| RESTClient
    RESTClient -->|updates| DivvyProvider

    CI -->|runs tests/builds| Android
    CI -->|runs tests/builds| iOS
    CI -->|runs tests/builds| Web
    CI -->|runs tests/builds| Desktop

    %% Click Events
    click LoginScreen "https://github.com/sonyaouthred/divvy/blob/main/lib/screens/login.dart"
    click DashboardScreen "https://github.com/sonyaouthred/divvy/blob/main/lib/screens/dashboard.dart"
    click HouseScreen "https://github.com/sonyaouthred/divvy/blob/main/lib/screens/house_screen.dart"
    click ChoresScreen "https://github.com/sonyaouthred/divvy/blob/main/lib/screens/chores.dart"
    click SwapScreen "https://github.com/sonyaouthred/divvy/blob/main/lib/screens/swap_screen.dart"
    click AddSwapScreen "https://github.com/sonyaouthred/divvy/blob/main/lib/screens/add_swap_screen.dart"
    click ChooseSwapScreen "https://github.com/sonyaouthred/divvy/blob/main/lib/screens/choose_swap.dart"
    click ChoreTile "https://github.com/sonyaouthred/divvy/blob/main/lib/widgets/chore_tile.dart"
    click SwapTile "https://github.com/sonyaouthred/divvy/blob/main/lib/widgets/swap_tile.dart"
    click PendingSwapTile "https://github.com/sonyaouthred/divvy/blob/main/lib/widgets/pending_swap_tile.dart"
    click MemberTile "https://github.com/sonyaouthred/divvy/blob/main/lib/widgets/member_tile.dart"
    click SubgroupTile "https://github.com/sonyaouthred/divvy/blob/main/lib/widgets/subgroup_tile.dart"
    click Leaderboard "https://github.com/sonyaouthred/divvy/blob/main/lib/widgets/leaderboard.dart"
    click DivvyProvider "https://github.com/sonyaouthred/divvy/blob/main/lib/providers/divvy_provider.dart"
    click FirebaseAuthService "https://github.com/sonyaouthred/divvy/blob/main/lib/firebase/auth_service.dart"
    click RESTClient "https://github.com/sonyaouthred/divvy/blob/main/lib/util/server_util.dart"

    %% Styles
    classDef client fill:#D6EAF8,stroke:#1B4F72
    classDef external fill:#D5F5E3,stroke:#196F3D
    classDef db fill:#E5E7E9,stroke:#5D6D7E
    classDef ci fill:#FCF3CF,stroke:#B7950B
```
