# cencool/peoplerapp architecture

> Architecture diagram of the GitHub repository cencool/peoplerapp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cencool/peoplerapp
- Repository: https://github.com/cencool/peoplerapp

## Overview

##### Main Application Architecture Components

a) Client Layer (Flutter UI)
- Main pages found in lib/pages:
- Login Page
- Start Page
- Person List Page
- General Search Page
- Person Page

b) Widget Layer
- This directly below the Client Layer
- Widgets by functionality:
- Person-related widgets (PersonTab, PersonPhotoView)
- Search widgets (GeneralSearchTab)
- Data display widgets (PlutoPersonList, SfGridPersonList)
- Relation widgets (RelationTab, RelationTable)

c) State Management & Global Services
- This layer in the middle
- Include:
- AppState
- AppGlobals
- Configuration (AppConfig)

d) Data Models Layer
- This above the API layer
- Models from lib/models:
- Person
- PersonDetail
- PersonForm
- PersonItem
- Credentials
- RelationRecord

e) API Layer
- At the bottom
- API communication handling
- Error handling (ApiException)

##### Platform-Specific Components

- Android
- iOS
- Web
- Linux
- Windows
- macOS

##### Specific Implementation Details

Technical aspects:
- HTTP client implementation (dev_http.dart)
- Authentication flow
- Search functionality
- File attachment handling
- Person relations management

##### Component Relationships

Key relationships:
- Person-to-Attachment
- Person-to-Relation
- Search-to-Results
- Authentication-to-Protected Resources

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef page fill:#e1f5fe,stroke:#01579b
    classDef widget fill:#e8f5e9,stroke:#2e7d32
    classDef state fill:#fff3e0,stroke:#ef6c00
    classDef model fill:#f3e5f5,stroke:#7b1fa2
    classDef api fill:#fbe9e7,stroke:#d84315
    classDef platform fill:#f5f5f5,stroke:#424242

    %% Client Layer (Pages)
    subgraph Pages
        Login["Login Page"]:::page
        Start["Start Page"]:::page
        PersonList["Person List Page"]:::page
        Search["General Search Page"]:::page
        PersonPage["Person Page"]:::page
    end

    %% Widget Layer
    subgraph Widgets
        PersonTab["Person Tab"]:::widget
        PhotoView["Person Photo View"]:::widget
        SearchTab["General Search Tab"]:::widget
        PlutoList["Pluto Person List"]:::widget
        SfGrid["SfGrid Person List"]:::widget
        RelTab["Relation Tab"]:::widget
        RelTable["Relation Table"]:::widget
    end

    %% State Management & Services
    subgraph State
        AppState["App State"]:::state
        AppGlobals["App Globals"]:::state
        Config["App Config"]:::state
        HttpClient["HTTP Client"]:::state
    end

    %% Data Models
    subgraph Models
        Person["Person Model"]:::model
        PersonDetail["Person Detail"]:::model
        PersonForm["Person Form"]:::model
        PersonItem["Person Item"]:::model
        Creds["Credentials"]:::model
        RelRecord["Relation Record"]:::model
        PersonRel["Person Relations"]:::model
        Attachments["Person Attachments"]:::model
    end

    %% API Layer
    subgraph API
        ApiImpl["API Implementation"]:::api
        ApiError["API Exception"]:::api
        SearchModels["Search Models"]:::api
    end

    %% Platform Support
    subgraph Platforms
        Android:::platform
        iOS:::platform
        Web:::platform
        Linux:::platform
        Windows:::platform
        MacOS:::platform
    end

    %% Relationships
    Login --> AppState
    Start --> AppState
    PersonList --> PlutoList & SfGrid
    Search --> SearchTab
    PersonPage --> PersonTab & PhotoView
    PersonTab --> RelTab
    RelTab --> RelTable
    
    AppState --> ApiImpl
    HttpClient --> ApiImpl
    Config --> AppGlobals
    
    ApiImpl --> Person
    ApiImpl --> PersonDetail
    ApiImpl --> RelRecord
    ApiImpl --> SearchModels
    
    SearchModels --> PersonForm
    Person --> PersonItem
    PersonPage --> PersonRel
    PersonPage --> Attachments

    %% Click Events
    click Login "https://github.com/cencool/PeoplerApp/blob/master/lib/pages/login_page.dart"
    click Start "https://github.com/cencool/PeoplerApp/blob/master/lib/pages/start_page.dart"
    click PersonList "https://github.com/cencool/PeoplerApp/blob/master/lib/pages/person_list_page.dart"
    click Search "https://github.com/cencool/PeoplerApp/blob/master/lib/pages/general_seach_page.dart"
    click PersonPage "https://github.com/cencool/PeoplerApp/blob/master/lib/pages/person_page.dart"
    
    click PersonTab "https://github.com/cencool/PeoplerApp/blob/master/lib/widgets/person_tab.dart"
    click PhotoView "https://github.com/cencool/PeoplerApp/blob/master/lib/widgets/person_photo_view.dart"
    click SearchTab "https://github.com/cencool/PeoplerApp/blob/master/lib/widgets/general_search_tab.dart"
    click PlutoList "https://github.com/cencool/PeoplerApp/blob/master/lib/widgets/pluto_person_list.dart"
    click SfGrid "https://github.com/cencool/PeoplerApp/blob/master/lib/widgets/sfgrid_person_list.dart"
    click RelTab "https://github.com/cencool/PeoplerApp/blob/master/lib/widgets/relation_tab.dart"
    click RelTable "https://github.com/cencool/PeoplerApp/blob/master/lib/widgets/relation_table.dart"
    
    click AppState "https://github.com/cencool/PeoplerApp/blob/master/lib/globals/app_state.dart"
    click AppGlobals "https://github.com/cencool/PeoplerApp/blob/master/lib/globals/app_globals.dart"
    click Config "https://github.com/cencool/PeoplerApp/blob/master/lib/config/app_config_example.dart"
    click HttpClient "https://github.com/cencool/PeoplerApp/blob/master/lib/globals/dev_http.dart"
    
    click Person "https://github.com/cencool/PeoplerApp/blob/master/lib/models/person.dart"
    click PersonDetail "https://github.com/cencool/PeoplerApp/blob/master/lib/models/person_detail.dart"
    click PersonForm "https://github.com/cencool/PeoplerApp/blob/master/lib/models/person_form.dart"
    click PersonItem "https://github.com/cencool/PeoplerApp/blob/master/lib/models/person_item.dart"
    click Creds "https://github.com/cencool/PeoplerApp/blob/master/lib/models/credentials.dart"
    click RelRecord "https://github.com/cencool/PeoplerApp/blob/master/lib/models/relation_record.dart"
    click PersonRel "https://github.com/cencool/PeoplerApp/blob/master/lib/models/person_relation.dart"
    click Attachments "https://github.com/cencool/PeoplerApp/blob/master/lib/models/person_attachment.dart"
    
    click ApiImpl "https://github.com/cencool/PeoplerApp/blob/master/lib/models/api.dart"
    click ApiError "https://github.com/cencool/PeoplerApp/blob/master/lib/models/api_exception.dart"
    click SearchModels "https://github.com/cencool/PeoplerApp/blob/master/lib/models/general_search.dart"
```
