# ri40/book-app architecture

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

- Interactive diagram: https://gitdiagram.com/ri40/book-app
- Repository: https://github.com/ri40/book-app

## Overview

##### Project type and purpose
- This is a cross-platform mobile & desktop “book_app” built with Flutter.
- It targets Android, iOS, Linux, macOS, Windows, and Web via a single Dart codebase.
- Its domain: a book catalog/shopping app with user and admin roles, using GetX for state & navigation, and Firebase for backend services.

##### File structure
- Top-level “android”, “ios”, “linux”, “macos”, “windows”, “web” directories each contain platform‐specific host code & build configurations.
- “lib/” houses the Dart application:
- Routes/routes.dart – central navigation definitions.
- firebase_options.dart – Firebase project config.
- logic/ – GetX bindings and controllers (Auth, NavBar, Product, Setting).
- model/ – data classes (Product, User, MenuItem).
- utils/ – shared helpers (theme, text utils).
- views/ – UI layer, subdivided into screens (auth, admin, user, settings, etc.) and reusable widgets.
- Configuration: pubspec.yaml (dependencies), google‐services.json and GoogleService-Info.plist (Firebase), platform build files (Gradle, Xcode, CMake).

##### README
- It’s the default Flutter template README. No custom architecture docs are provided.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Host Platforms
    subgraph "Host Platforms"
        direction TB
        Android["Android"]:::host
        iOS["iOS"]:::host
        Linux["Linux"]:::host
        macOS["macOS"]:::host
        Windows["Windows"]:::host
        Web["Web"]:::host
    end

    %% Engine
    FlutterEngine["Flutter Engine & Embedder"]:::engine

    %% Dart Application
    subgraph "Dart Application"
        direction TB
        Main["main.dart"]:::entry
        subgraph "Navigation Layer"
            direction TB
            Routes["routes.dart"]:::navigation
        end
        subgraph "Presentation Layer"
            direction TB
            Views["lib/views"]:::presentation
            Widgets["lib/views/widgets"]:::presentation
        end
        subgraph "Business Logic Layer"
            direction TB
            Controllers["lib/logic/controllers"]:::logic
            Bindings["lib/logic/bindings"]:::logic
        end
        subgraph "Data Layer"
            direction TB
            Models["lib/model"]:::data
            Config["firebase_options.dart"]:::data
        end
        Assets["assets/images"]:::assets
    end

    %% External Services
    subgraph "External Services"
        direction TB
        FirebaseAuth["Firebase Auth"]:::external
        Firestore["Firestore/RTDB"]:::external
        Storage["Firebase Storage"]:::external
    end

    %% Connections
    Android -->|boots| FlutterEngine
    iOS -->|boots| FlutterEngine
    Linux -->|boots| FlutterEngine
    macOS -->|boots| FlutterEngine
    Windows -->|boots| FlutterEngine
    Web -->|boots| FlutterEngine

    FlutterEngine -->|runs| Main
    Main -->|defines| Routes
    Routes -->|navigates to| Views
    Views <-->|"binds via GetX"| Controllers
    Controllers -->|"uses"| Models
    Controllers -->|"injects config"| Config
    Models -->|"read/write"| Firestore
    Config -->|"initializes"| FirebaseAuth
    Config -->|"initializes"| Firestore
    Config -->|"initializes"| Storage
    Views -->|"loads assets"| Assets

    %% Click Events
    click Android "https://github.com/ri40/book-app/tree/main/android/"
    click iOS "https://github.com/ri40/book-app/tree/main/ios/"
    click Linux "https://github.com/ri40/book-app/tree/main/linux/"
    click macOS "https://github.com/ri40/book-app/tree/main/macos/"
    click Windows "https://github.com/ri40/book-app/tree/main/windows/"
    click Web "https://github.com/ri40/book-app/tree/main/web/"
    click Main "https://github.com/ri40/book-app/blob/main/lib/main.dart"
    click Routes "https://github.com/ri40/book-app/blob/main/lib/Routes/routes.dart"
    click Config "https://github.com/ri40/book-app/blob/main/lib/firebase_options.dart"
    click FirebaseAuth "https://github.com/ri40/book-app/blob/main/android/app/google-services.json"
    click iOS "https://github.com/ri40/book-app/blob/main/ios/Runner/GoogleService-Info.plist"
    click macOS "https://github.com/ri40/book-app/blob/main/macos/Runner/GoogleService-Info.plist"
    click Controllers "https://github.com/ri40/book-app/tree/main/lib/logic/controllers/"
    click Bindings "https://github.com/ri40/book-app/tree/main/lib/logic/bindings/"
    click Models "https://github.com/ri40/book-app/tree/main/lib/model/"
    click Views "https://github.com/ri40/book-app/tree/main/lib/views/screens/"
    click Widgets "https://github.com/ri40/book-app/tree/main/lib/views/widgets/"
    click Assets "https://github.com/ri40/book-app/tree/main/assets/images/"

    %% Styles
    classDef host fill:#fdebd0,stroke:#d35400,stroke-width:1px
    classDef engine fill:#d6eaf8,stroke:#2471a3,stroke-width:1px
    classDef entry fill:#aed6f1,stroke:#1b4f72,stroke-width:1px
    classDef navigation fill:#d5f5e3,stroke:#27ae60,stroke-width:1px
    classDef presentation fill:#d1f2eb,stroke:#148f77,stroke-width:1px
    classDef logic fill:#f5eef8,stroke:#884ea0,stroke-width:1px
    classDef data fill:#e8f8f5,stroke:#16a085,stroke-width:1px
    classDef assets fill:#fcf3cf,stroke:#b7950b,stroke-width:1px
    classDef external fill:#f9ebea,stroke:#c0392b,stroke-width:1px
```
