# tanvir-rahman/flutter_auth_riverpod architecture

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

- Interactive diagram: https://gitdiagram.com/tanvir-rahman/flutter_auth_riverpod
- Repository: https://github.com/tanvir-rahman/flutter_auth_riverpod

## Overview

##### High-Level Components

a. Client Layer (Mobile Application)
- Flutter UI Components
- State Management (Riverpod - evident from .g.dart files)
- Platform-specific (iOS/Android) implementations

b. Core Infrastructure Layer
- API Communication (Dio Client)
- Error Handling
- Localization
- Theme Management
- Navigation (Router)

c. Feature Modules
- Authentication
- Home
- Orders
- Settings
- Menu
- Splash
- Shell (Main container)

d. External Services
- Firebase Services (Crashlytics)
- Backend API Services

##### Detailed Component Breakdown

For each major component, use these visual elements:

a. Authentication Module (Most Complex):
- Presentation Layer (UI/Screens)
- Domain Layer (Use Cases/Entities)
- Data Layer (Repositories/Data Sources)
- Remote Data Source ↔ Repository Implementation ↔ Use Cases ↔ Presentation
- Local Data Source (Hive) ↔ Repository Implementation

b. Core Infrastructure:
- API Client (DioClient)
- Error Handlers
- Interceptors
- Resource Managers
- Layout Templates

c. State Management:
- Provider pattern:
- State Containers
- Notifiers
- State Flow

##### Implementation Details to Highlight

- Clean Architecture pattern implementation
- Feature-first folder structure
- Dependency injection system
- Multi-environment support (staging/production)
- Localization support
- Theme management
- Error handling flow

##### Key Relationships

- Authentication flow
- API communication pattern
- State management flow
- Navigation structure
- Data persistence (Hive)
- Platform-specific implementations

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        UI[Flutter UI Components]:::ui
        State[State Management]:::state
        Platform[Platform Specific]:::platform
    end

    subgraph Core["Core Infrastructure"]
        API["API Client"]:::core
        Error["Error Handling"]:::core
        Local["Localization"]:::core
        Theme["Theme Management"]:::core
        Router["Navigation Router"]:::core
        Resources["Resource Management"]:::core
        
        subgraph Layouts
            AuthLayout["Auth Layout"]:::layout
            UnauthLayout["Unauth Layout"]:::layout
        end
        
        subgraph Resources
            Dimens["Dimensions"]:::resource
            Images["Images"]:::resource
            Styles["Styles"]:::resource
            Palette["Color Palette"]:::resource
        end
    end

    subgraph Features
        subgraph Auth["Authentication Module"]
            AuthUI["Presentation Layer"]:::feature
            AuthDomain["Domain Layer"]:::feature
            AuthData["Data Layer"]:::feature
        end
        
        Home["Home Module"]:::feature
        Orders["Orders Module"]:::feature
        Settings["Settings Module"]:::feature
        Menu["Menu Module"]:::feature
        Splash["Splash Module"]:::feature
        Shell["Shell Module"]:::feature
    end

    subgraph External
        Firebase["Firebase Services"]:::external
        Backend["Backend API"]:::external
        Hive["Local Storage"]:::external
    end

    subgraph Common["Common Widgets"]
        CoreWidgets["Core Widgets"]:::widget
        Loading["Loading Components"]:::widget
        ErrorComp["Error Components"]:::widget
    end

    %% Relationships
    UI --> State
    State --> Features
    API --> Backend
    Auth --> API
    Features --> API
    Features --> Hive
    UI --> Common
    Features --> Firebase

    %% Click Events
    click API "https://github.com/Tanvir-rahman/flutter_auth_riverpod/blob/main/lib/core/api/dio_client.dart"
    click Error "https://github.com/Tanvir-rahman/flutter_auth_riverpod/tree/main/lib/core/error/"
    click Local "https://github.com/Tanvir-rahman/flutter_auth_riverpod/tree/main/lib/core/localization/"
    click Theme "https://github.com/Tanvir-rahman/flutter_auth_riverpod/blob/main/lib/core/providers/theme_provider.dart"
    click Router "https://github.com/Tanvir-rahman/flutter_auth_riverpod/blob/main/lib/core/routes/routes.dart"
    click Auth "https://github.com/Tanvir-rahman/flutter_auth_riverpod/tree/main/lib/features/auth/"
    click Home "https://github.com/Tanvir-rahman/flutter_auth_riverpod/tree/main/lib/features/home/"
    click Orders "https://github.com/Tanvir-rahman/flutter_auth_riverpod/tree/main/lib/features/orders/"
    click Settings "https://github.com/Tanvir-rahman/flutter_auth_riverpod/tree/main/lib/features/settings/"
    click Menu "https://github.com/Tanvir-rahman/flutter_auth_riverpod/tree/main/lib/features/menu/"
    click Splash "https://github.com/Tanvir-rahman/flutter_auth_riverpod/tree/main/lib/features/splash/"
    click Shell "https://github.com/Tanvir-rahman/flutter_auth_riverpod/tree/main/lib/features/shell/"
    click Firebase "https://github.com/Tanvir-rahman/flutter_auth_riverpod/tree/main/lib/utils/services/firebase/"
    click Hive "https://github.com/Tanvir-rahman/flutter_auth_riverpod/tree/main/lib/utils/services/hive/"
    click AuthLayout "https://github.com/Tanvir-rahman/flutter_auth_riverpod/blob/main/lib/core/layouts/auth_layout.dart"
    click UnauthLayout "https://github.com/Tanvir-rahman/flutter_auth_riverpod/blob/main/lib/core/layouts/unauth_layout.dart"
    click Dimens "https://github.com/Tanvir-rahman/flutter_auth_riverpod/blob/main/lib/core/resources/dimens.dart"
    click Images "https://github.com/Tanvir-rahman/flutter_auth_riverpod/blob/main/lib/core/resources/images.dart"
    click Styles "https://github.com/Tanvir-rahman/flutter_auth_riverpod/blob/main/lib/core/resources/styles.dart"
    click Palette "https://github.com/Tanvir-rahman/flutter_auth_riverpod/blob/main/lib/core/resources/palette.dart"
    click CoreWidgets "https://github.com/Tanvir-rahman/flutter_auth_riverpod/tree/main/lib/core/widgets/"
    click Loading "https://github.com/Tanvir-rahman/flutter_auth_riverpod/blob/main/lib/core/widgets/loading.dart"
    click ErrorComp "https://github.com/Tanvir-rahman/flutter_auth_riverpod/blob/main/lib/core/widgets/app_error.dart"

    %% Styling
    classDef ui fill:#2196F3,stroke:#1976D2,color:white
    classDef state fill:#4CAF50,stroke:#388E3C,color:white
    classDef platform fill:#9C27B0,stroke:#7B1FA2,color:white
    classDef core fill:#3F51B5,stroke:#303F9F,color:white
    classDef feature fill:#FF9800,stroke:#F57C00,color:white
    classDef external fill:#F44336,stroke:#D32F2F,color:white
    classDef layout fill:#009688,stroke:#00796B,color:white
    classDef resource fill:#607D8B,stroke:#455A64,color:white
    classDef widget fill:#795548,stroke:#5D4037,color:white
```
