# wlgnsdi/flutter_google_login architecture

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

- Interactive diagram: https://gitdiagram.com/wlgnsdi/flutter_google_login
- Repository: https://github.com/wlgnsdi/flutter_google_login

## Overview

##### Main Components
- Mobile Client (Flutter)
- A shared Flutter UI and business logic layer (located in the lib directory).
- Dart files such as main.dart, google_login.dart, email_login.dart, kakao_login.dart, naver_login.dart, and phone_auth.dart.
- Native Platform Layers
- Separate nodes for Android (android folder) and iOS (ios folder) to indicate how Flutter integrates with platform-specific code and assets.
- Firebase Authentication
- Usage of Firebase Auth (and optionally Firebase Firestore and FCM as seen in test files) as an external dependency.
- Google Sign-In Service
- An external component for Google’s OAuth/Sign-In, illustrating that the app leverages Firebase’s GoogleAuthProvider for authentication.
- (Optional) Other Firebase Services
- Since there are files like firestore_test.dart and fcm_test.dart, you might want to represent potential interactions with Firebase Firestore and Firebase Cloud Messaging.

##### Relationships and Interactions
- The Mobile Client (Flutter) initiates authentication requests.
- That the same Flutter client is deployed on both native platforms (Android and iOS).

##### Architectural Patterns and Design Principles
- Separation of Concerns: The project cleanly separates presentation logic (Flutter UI) from back-end authentication logic (Firebase Authentication).
- Platform Abstraction: The presence of separate native directories for Android and iOS shows that native platform-specific files are abstracted from the shared Dart code.
- External Service Integration: The design leverages external authentication and messaging services (Firebase, Google) and follows a standard OAuth-based delegation model.

##### Detail but Focus on Clarity
- Each component is to be as granular as possible – for example, include both the Flutter client and its platform-specific wrappers for Android and iOS.
- Avoid overcomplicating; focus on showing each unique piece of the system and the interactions between them.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Flutter Mobile Client Subgraph
    subgraph "Flutter Mobile Client"
        FL_main["main.dart"]:::client
        FL_google["google_login.dart"]:::client
        FL_email["email_login.dart"]:::client
        FL_kakao["kakao_login.dart"]:::client
        FL_naver["naver_login.dart"]:::client
        FL_phone["phone_auth.dart"]:::client
    end

    %% Native Layers Subgraph
    subgraph "Native Layers"
        AND["Android (MainActivity.kt)"]:::native
        IOS["iOS (Runner)"]:::native
    end

    %% Firebase Services Subgraph
    subgraph "Firebase Services"
        FA["Firebase Authentication"]:::firebase
        FS["Firebase Firestore"]:::firebase
        FCM["Firebase Cloud Messaging"]:::firebase
    end

    %% Google Sign-In Service External Node
    GSI["Google Sign-In Service"]:::google

    %% Relationships for the Login Flow
    FL_google -->|"authRequest"| GSI
    GSI -->|"tokenExchange"| FA
    FA -->|"authCallback"| FL_google

    %% Additional interactions from Flutter Client
    FL_main -->|"firestoreTest"| FS
    FL_main -->|"fcmTest"| FCM

    %% Deployment on Native Platforms
    FL_main -->|"deployedOn"| AND
    FL_main -->|"deployedOn"| IOS

    %% Styles
    classDef client fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef native fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef firebase fill:#FFFACD,stroke:#000,stroke-width:2px;
    classDef google fill:#FFC0CB,stroke:#000,stroke-width:2px;

    %% Click Events for Flutter Mobile Client files
    click FL_main "https://github.com/wlgnsdi/flutter_google_login/blob/master/lib/main.dart"
    click FL_google "https://github.com/wlgnsdi/flutter_google_login/blob/master/lib/google_login.dart"
    click FL_email "https://github.com/wlgnsdi/flutter_google_login/blob/master/lib/email_login.dart"
    click FL_kakao "https://github.com/wlgnsdi/flutter_google_login/blob/master/lib/kakao_login.dart"
    click FL_naver "https://github.com/wlgnsdi/flutter_google_login/blob/master/lib/naver_login.dart"
    click FL_phone "https://github.com/wlgnsdi/flutter_google_login/blob/master/lib/phone_auth.dart"

    %% Click Events for Native Layers
    click AND "https://github.com/wlgnsdi/flutter_google_login/blob/master/android/app/src/main/kotlin/com/example/flutter_google_login/MainActivity.kt"
    click IOS "https://github.com/wlgnsdi/flutter_google_login/tree/master/ios/Runner"

    %% Click Events for Firebase Services
    click FA "https://github.com/wlgnsdi/flutter_google_login/blob/master/lib/firebase_options.dart"
    click FS "https://github.com/wlgnsdi/flutter_google_login/blob/master/lib/firestore_test.dart"
    click FCM "https://github.com/wlgnsdi/flutter_google_login/blob/master/lib/fcm_test.dart"

    %% Click Event for Google Sign-In Service
    click GSI "https://github.com/wlgnsdi/flutter_google_login/blob/master/lib/google_login.dart"
```
