# dangvu1724/moviegoapp architecture

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

- Interactive diagram: https://gitdiagram.com/dangvu1724/moviegoapp
- Repository: https://github.com/dangvu1724/moviegoapp

## Overview

##### Main Components
- Frontend (Client-side): Represent the Flutter-based UI which is implemented in the "lib" directory. This includes:
- Controllers (e.g., home_controller, movie_controller, payment_controller, etc.) for business logic.
- Models (e.g., movie.dart) defining data structures.
- Screens and Pages (e.g., homepage.dart, sign_in_API.dart, movie screens, ticket screens) that provide the user interface.
- Widgets (reusable UI components like movie details, search bar, bottom app bar) that build the overall user experience.
- Custom components such as those in "CustomUI", "ForgotPassWord", and "LoginWithGoogle" for specialized functionality.

- Platform-Specific Configurations: Represent the native layer configurations for Android, iOS, Web, and desktop. This involves the android, ios, web, linux, macos, and windows directories with their respective build configuration files.

- Backend / External Services:
- Firebase: Used for authentication (Firebase Authentication) and data storage (Firestore).
- Authentication providers (Email/Password and Google login) that interact with Firebase.
- Payment integrations (via various payment methods such as Momo, Visa, MasterCard) which are part of the business logic in the controller(s) but might also interact with external payment APIs.

##### Relationships and Interactions
- Authentication components (both Email and Google) interact with Firebase Authentication.
- Data flows from user inputs (screen interactions) to controllers, which then trigger calls to Firebase for operations like booking tickets, viewing showtimes, or updating user profiles.
- Payment modules interact with external payment gateways before updating the booking status in Firebase.
- The mobile app’s native layers (Android, iOS, etc.) provide the runtime environment for the Flutter UI to execute and manage platform-specific functionalities.

##### Architectural Patterns and Design Principles
- Separation of Concerns: The project is neatly divided into UI (screens, widgets), business logic (controllers), and data models.
- Modularization: The clear division among directories like "auth", "controllers", "services", and "widgets" indicates a modular design that supports easier maintenance and scalability.
- Cross-Platform Design: Using Flutter ensures a single codebase across multiple platforms while keeping platform-specific configurations in separate directories.
- Integration with Third-Party Services: Emphasize the integration with Firebase and external payment APIs.

##### Relevant Technologies, Frameworks, and Libraries
- Flutter for the UI and main application logic.
- Firebase for authentication, Firestore for database needs.
- Platform-specific build tools (Gradle for Android, Xcode for iOS, etc.).
- Dependency management through pubspec.yaml.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Flutter UI (Presentation Layer)"
        UI["Flutter UI (lib/screens, lib/pages, lib/widgets)"]:::frontend
        CustomUI["Custom UI Components (lib/CustomUI)"]:::frontend
        ForgotPass["Forgot Password (lib/ForgotPassWord)"]:::frontend
        LoginGoogle["Login with Google (lib/LoginWithGoogle)"]:::frontend
        PaymentScreen["Payment Screen (lib/screens/payment.dart)"]:::frontend
    end

    subgraph "Business Logic Layer"
        Controllers["Controllers (lib/controllers)"]:::business
        PaymentController["Payment Controller (lib/controllers/payment_controller.dart)"]:::business
    end

    subgraph "Data Layer"
        Models["Data Models (lib/Model)"]:::data
    end

    subgraph "Backend Services"
        FirebaseOptions["Firebase Options (lib/firebase_options.dart)"]:::backend
        AuthService["Auth Service (lib/auth/auth_service.dart)"]:::backend
        Firestore["Firestore Database"]:::backend
        PaymentGateway["External Payment Gateways"]:::backend
    end

    subgraph "Platform-Specific Configurations"
        Android["Android Directory"]:::platform
        iOS["iOS Directory"]:::platform
        Web["Web Directory"]:::platform
        Linux["Linux Directory"]:::platform
        macOS["macOS Directory"]:::platform
        Windows["Windows Directory"]:::platform
    end

    %% Data flow from UI to Business Logic
    UI -->|"triggers"| Controllers
    CustomUI -->|"enhances"| UI
    ForgotPass -->|"assists"| UI
    LoginGoogle -->|"supports"| UI
    PaymentScreen -->|"initiates"| PaymentController

    %% Business Logic interactions
    Controllers -->|"processes data"| Models
    Controllers -->|"authenticates"| AuthService
    Controllers -->|"reads/writes"| Firestore
    Controllers -->|"configures"| FirebaseOptions
    PaymentController -->|"calls"| PaymentGateway
    PaymentGateway -->|"updates booking"| Firestore

    %% Cross-layer interactions
    PaymentScreen -->|"delegates payment"| PaymentController

    %% Platform-specific influences on UI
    Android ---|"native runtime"| UI
    iOS ---|"native runtime"| UI
    Web ---|"native runtime"| UI
    Linux ---|"native runtime"| UI
    macOS ---|"native runtime"| UI
    Windows ---|"native runtime"| UI

    %% Click Events
    click UI "https://github.com/dangvu1724/moviegoapp/tree/main/lib/screens, lib/pages, lib/widgets"
    click Controllers "https://github.com/dangvu1724/moviegoapp/tree/main/lib/controllers"
    click Models "https://github.com/dangvu1724/moviegoapp/tree/main/lib/Model"
    click CustomUI "https://github.com/dangvu1724/moviegoapp/tree/main/lib/CustomUI"
    click ForgotPass "https://github.com/dangvu1724/moviegoapp/tree/main/lib/ForgotPassWord"
    click LoginGoogle "https://github.com/dangvu1724/moviegoapp/tree/main/lib/LoginWithGoogle"
    click PaymentScreen "https://github.com/dangvu1724/moviegoapp/blob/main/lib/screens/payment.dart"
    click PaymentController "https://github.com/dangvu1724/moviegoapp/blob/main/lib/controllers/payment_controller.dart"
    click FirebaseOptions "https://github.com/dangvu1724/moviegoapp/blob/main/lib/firebase_options.dart"
    click AuthService "https://github.com/dangvu1724/moviegoapp/blob/main/lib/auth/auth_service.dart"
    click Android "https://github.com/dangvu1724/moviegoapp/tree/main/android"
    click iOS "https://github.com/dangvu1724/moviegoapp/tree/main/ios"
    click Web "https://github.com/dangvu1724/moviegoapp/tree/main/web"
    click Linux "https://github.com/dangvu1724/moviegoapp/tree/main/linux"
    click macOS "https://github.com/dangvu1724/moviegoapp/tree/main/macos"
    click Windows "https://github.com/dangvu1724/moviegoapp/tree/main/windows"

classDef frontend fill:#AED6F1,stroke:#1ABC9C,stroke-width:2px;
classDef business fill:#F9E79F,stroke:#D35400,stroke-width:2px;
classDef data fill:#D5F5E3,stroke:#27AE60,stroke-width:2px;
classDef backend fill:#FADBD8,stroke:#C0392B,stroke-width:2px;
classDef platform fill:#D2B4DE,stroke:#8E44AD,stroke-width:2px;
```
