# ghosty1136/doclink architecture

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

- Interactive diagram: https://gitdiagram.com/ghosty1136/doclink
- Repository: https://github.com/ghosty1136/doclink

## Overview

##### Main Components
- Flutter Application Core:
- This is the heart of your app, located in the “lib” directory. It includes major screens like the splash screen (splash.dart), login (login.dart), and the main entry point (main.dart). Also note the firebase_options.dart file, which indicates integration with Firebase.
- Platform-Specific Layers:
- Android, iOS, web, Linux, macOS, and Windows folders represent the wrappers and native integrations that allow the Flutter engine to interface with each target platform.
- Assets & Resources:
- External Services:
- Firebase services as suggested by firebase_options.dart and firebase.json. This is a key external dependency for backend/authentication/data services.

##### Relationships and Interactions
- The main Flutter application (Dart code) interacts with the Firebase backend as well as with device-specific APIs through plugins.
- The platform-specific directories act as the “shell” around the Flutter engine:
- They handle native lifecycle events and wrap the Flutter UI.
- Within the Flutter code, the UI components (login, splash) will invoke business logic and then make calls to the Firebase API (or other integrated services).

##### Architectural Patterns and Principles
- Multi-Platform/Hybrid Architecture:
- The abstraction of a single Flutter codebase that is rendered across multiple platforms.
- MVC/Separation of Concerns within Flutter:
- Although the exact pattern isn’t explicitly mentioned, separate Dart files (login.dart, splash.dart, etc.) imply a division between UI and logic.
- Integration via Firebase:
- A clear dependency on Firebase (including configurations), establishing an external service integration pattern.

##### Including Relevant Technologies & Frameworks
- Flutter & Dart (for the UI, business logic, and state management)
- Firebase (for backend services, authentication, or data storage)
- Platform-specific native components (Android, iOS, etc.) for device interoperability
- Configuration and dependency management via pubspec.yaml and build files (Gradle for Android, Xcode for iOS/macOS, CMake for desktop)

##### Elements
- Use clear labels for each component, such as:
- “Flutter UI/Core (lib)”
- “Android Wrapper” (showing files like MainActivity.kt, AndroidManifest.xml)
- “iOS Wrapper” (with AppDelegate.swift, Info.plist)
- “Desktop Wrappers” (macos, linux, windows)
- “Web” (index.html and related assets)
- “Firebase & External Services”
- Rectangles for application layers (Flutter Core, native wrappers)
- Clouds for external services (Firebase)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Top Level - Application
    DoclinkApp["Doclink Application (Doclink)"]:::appCore

    %% Flutter Application Core Subgraph
    subgraph "Flutter Application Core (lib)"
        FlutterMain["main.dart"]:::flutterCore
        FlutterLogin["login.dart"]:::flutterCore
        FlutterSplash["splash.dart"]:::flutterCore
        FirebaseOptions["firebase_options.dart"]:::flutterCore
    end

    DoclinkApp -->|"core"| FlutterMain

    %% Platform Wrappers
    subgraph "Android Wrapper"
        AndroidManifest["AndroidManifest.xml"]:::android
        AndroidMainActivity["MainActivity.kt"]:::android
        AndroidGoogleServices["google-services.json"]:::android
    end

    subgraph "iOS Wrapper"
        iOSAppDelegate["AppDelegate.swift"]:::ios
        iOSInfo["Info.plist"]:::ios
    end

    subgraph "Web Layer"
        webIndex["index.html"]:::web
        webManifest["manifest.json"]:::web
    end

    subgraph "Desktop Wrappers"
        subgraph "macOS Wrapper"
            macosAppDelegate["AppDelegate.swift"]:::desktop
            macosMainMenu["MainMenu.xib"]:::desktop
        end
        subgraph "Linux Wrapper"
            linuxMain["main.cc"]:::desktop
            linuxPlugins["generated_plugin_registrant.cc"]:::desktop
        end
        subgraph "Windows Wrapper"
            windowsMain["main.cpp"]:::desktop
            windowsFlutterWindow["flutter_window.cpp"]:::desktop
        end
    end

    %% External Services and Assets
    FirebaseExternal["Firebase External Service"]:::external

    subgraph "Assets & Resources"
        AssetsFonts["Fonts"]:::assets
        AssetsImages["Images"]:::assets
    end

    %% Relationships between Flutter Core and Platform Wrappers
    FlutterMain -->|"native_embed"| AndroidManifest
    FlutterMain -->|"native_embed"| iOSAppDelegate
    FlutterMain -->|"native_embed"| webIndex
    FlutterMain -->|"native_embed"| macosAppDelegate

    %% Relationship between Flutter Core and Firebase Service
    FirebaseOptions -->|"firebase_call"| FirebaseExternal

    %% Relationship between Flutter Core and Assets
    FlutterMain -->|"uses"| AssetsFonts

    %% Click Events for Flutter Application Core
    click FlutterMain "https://github.com/ghosty1136/doclink/blob/main/lib/main.dart"
    click FlutterLogin "https://github.com/ghosty1136/doclink/blob/main/lib/login.dart"
    click FlutterSplash "https://github.com/ghosty1136/doclink/blob/main/lib/splash.dart"
    click FirebaseOptions "https://github.com/ghosty1136/doclink/blob/main/lib/firebase_options.dart"

    %% Click Events for Android Wrapper
    click AndroidManifest "https://github.com/ghosty1136/doclink/blob/main/android/app/src/main/AndroidManifest.xml"
    click AndroidMainActivity "https://github.com/ghosty1136/doclink/blob/main/android/app/src/main/kotlin/com/example/kodoctor/MainActivity.kt"
    click AndroidGoogleServices "https://github.com/ghosty1136/doclink/blob/main/android/app/google-services.json"

    %% Click Events for iOS Wrapper
    click iOSAppDelegate "https://github.com/ghosty1136/doclink/blob/main/ios/Runner/AppDelegate.swift"
    click iOSInfo "https://github.com/ghosty1136/doclink/blob/main/ios/Runner/Info.plist"

    %% Click Events for macOS Wrapper
    click macosAppDelegate "https://github.com/ghosty1136/doclink/blob/main/macos/Runner/AppDelegate.swift"
    click macosMainMenu "https://github.com/ghosty1136/doclink/blob/main/macos/Runner/Base.lproj/MainMenu.xib"

    %% Click Events for Linux Wrapper
    click linuxMain "https://github.com/ghosty1136/doclink/blob/main/linux/runner/main.cc"
    click linuxPlugins "https://github.com/ghosty1136/doclink/blob/main/linux/flutter/generated_plugin_registrant.cc"

    %% Click Events for Windows Wrapper
    click windowsMain "https://github.com/ghosty1136/doclink/blob/main/windows/runner/main.cpp"
    click windowsFlutterWindow "https://github.com/ghosty1136/doclink/blob/main/windows/runner/flutter_window.cpp"

    %% Click Events for Web Layer
    click webIndex "https://github.com/ghosty1136/doclink/blob/main/web/index.html"
    click webManifest "https://github.com/ghosty1136/doclink/blob/main/web/manifest.json"

    %% Click Events for Assets
    click AssetsFonts "https://github.com/ghosty1136/doclink/tree/main/assets/fonts"
    click AssetsImages "https://github.com/ghosty1136/doclink/tree/main/assets/images"

    %% Click Event for Firebase External Service
    click FirebaseExternal "https://github.com/ghosty1136/doclink/blob/main/firebase.json"

    %% Styles
    classDef appCore fill:#fbd,stroke:#333,stroke-width:2px;
    classDef flutterCore fill:#cff,stroke:#333,stroke-width:2px;
    classDef android fill:#ffd,stroke:#333,stroke-width:2px;
    classDef ios fill:#cde,stroke:#333,stroke-width:2px;
    classDef web fill:#fc9,stroke:#333,stroke-width:2px;
    classDef desktop fill:#d9b3ff,stroke:#333,stroke-width:2px;
    classDef external fill:#dfd,stroke:#333,stroke-width:2px;
    classDef assets fill:#efe,stroke:#333,stroke-width:2px;
```
