# crealify/anilbhattarai_portfolio architecture

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

- Interactive diagram: https://gitdiagram.com/crealify/anilbhattarai_portfolio
- Repository: https://github.com/crealify/anilbhattarai_portfolio

## Overview

##### Project Type & Purpose
- This is a **Flutter**-based **client-side** portfolio app (no custom backend).
- It targets **Android**, **iOS**, **Web**, **Windows**, **macOS**, and **Linux** from one codebase (`lib/main.dart`).
- It is deployed as a static web site (GitHub Pages/Cloudflare) and as native apps via respective app stores.

##### File Structure & Key Components
- `lib/main.dart` – the single entry point for all platforms.
- `pubspec.yaml` / `pubspec.lock` – declares assets (images), dependencies, fonts, etc.
- `android/…` – Android host code (Kotlin `MainActivity.kt`), Gradle build scripts, resource folders.
- `ios/…` – iOS host code (Swift `AppDelegate.swift`), Xcode project, asset catalogs.
- `windows/…, macos/…, linux/…` – native host code with CMake files and platform runners embedding the Flutter engine.
- `.github/workflows/static.yml` – CI pipeline for building & deploying the web version.

##### Core Architectural Elements
a. **Flutter Application Layer**
– **Dart UI code** (`lib/…`)
– **Widgets** (presentation)
– **State management** (if any)
b. **Flutter Framework**
– Rendering, gestures, widgets library
c. **Flutter Engine**
– Skia, Dart runtime, platform channels
d. **Host Platforms**
– Android: `MainActivity` → embeds `FlutterEngine`
– iOS: `AppDelegate` → `FlutterEngine`
– Desktop & Linux: CMake scopes & `main.cpp` launcher
– Web: `index.html` + JavaScript-compiled Dart (via `flutter.js`)
e. **Assets & Dependencies**
– `assets/images/…`, pubspec-managed images
– Third-party plugins (if any) auto-registered via generated plugin registrant files
f. **CI/CD Pipeline**
– GitHub Actions job builds web output
– Deploys to GitHub Pages / Cloudflare

##### Relationships & Data Flow
- **Build Flow**: `lib/` + `pubspec.yaml` → `flutter build <platform>` → platform artifact
- **Runtime Flow** (for mobile/desktop):
1. OS launches host binary/Activity/Delegate
2. Host code instantiates `FlutterEngine`
3. Engine loads compiled Dart & assets
4. Dart UI renders in a window or view
- **Web Flow**: Browser loads `index.html` → loads `flutter.js` → initializes Dart runtime → renders canvas.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Source Layer
    subgraph "Source" 
        entry["lib/main.dart"]:::code
        dartui["lib/ (Dart UI & Widgets)"]:::code
        pubspecY["pubspec.yaml"]:::code
        pubspecL["pubspec.lock"]:::code
        assets["assets/images/"]:::storage
    end

    %% Tools & Build Layer
    subgraph "Tools & Build"
        flutter_cli["Flutter CLI"]:::pipeline_gear
        gradle_tool["Gradle"]:::pipeline_gear
        xcode_tool["Xcode Build"]:::pipeline_gear
        cmake_tool["CMake"]:::pipeline_gear
    end

    %% Framework & Engine Layer
    subgraph "Framework & Engine"
        framework["Flutter Framework"]:::framework
        engine["Flutter Engine"]:::framework
    end

    %% Platform Hosts Layer
    subgraph "Platform Hosts"
        subgraph "Android"
            android_host["MainActivity.kt"]:::host
            android_gradle["build.gradle.kts"]:::host
            android_manifest["AndroidManifest.xml"]:::host
            android_res["res/ (drawable & mipmap)"]:::host
        end
        subgraph "iOS"
            ios_host["AppDelegate.swift"]:::host
            ios_proj["Runner.xcodeproj/"]:::host
            ios_assets["Assets.xcassets/"]:::host
        end
        subgraph "Web"
            web_html["index.html"]:::host
            web_manifest["manifest.json"]:::host
            web_icons["icons/"]:::host
        end
        subgraph "Windows"
            win_launcher["main.cpp & flutter_window.cpp"]:::host
            win_reg["generated_plugin_registrant.cc/.h"]:::host
        end
        subgraph "Linux"
            linux_launcher["main.cc & my_application.cc"]:::host
            linux_reg["generated_plugin_registrant.cc/.h"]:::host
        end
        subgraph "macOS"
            macos_app["AppDelegate.swift & MainFlutterWindow.swift"]:::host
            macos_reg["GeneratedPluginRegistrant.swift"]:::host
        end
    end

    %% Deployment Layer
    subgraph "Deployment"
        ci["GitHub Actions\n.static.yml"]:::pipeline
        cloud["GitHub Pages/Cloudflare"]:::cloud
    end

    %% Build Flow
    entry -->|build| flutter_cli
    dartui -->|build| flutter_cli
    pubspecY -->|resolve deps| flutter_cli
    pubspecL -->|resolve deps| flutter_cli
    assets -->|include| flutter_cli

    flutter_cli -->|compile| framework
    framework -->|link| engine

    engine -->|embed| android_host
    engine -->|embed| ios_host
    engine -->|embed| win_launcher
    engine -->|embed| linux_launcher
    engine -->|embed| macos_app
    engine -->|generate JS| web_html

    flutter_cli -->|invoke| gradle_tool
    flutter_cli -->|invoke| xcode_tool
    flutter_cli -->|invoke| cmake_tool

    %% Runtime Flow (simplified)
    android_host -->|run| engine
    ios_host -->|run| engine
    win_launcher -->|run| engine
    linux_launcher -->|run| engine
    macos_app -->|run| engine
    web_html -->|load JS| engine

    %% CI/CD Flow
    pubspecY -->|trigger| ci
    ci -->|build web| flutter_cli
    ci -->|deploy| cloud

    %% Click Events
    click entry "https://github.com/crealify/anilbhattarai_portfolio/blob/master/lib/main.dart"
    click dartui "https://github.com/crealify/anilbhattarai_portfolio/tree/master/lib/"
    click pubspecY "https://github.com/crealify/anilbhattarai_portfolio/blob/master/pubspec.yaml"
    click pubspecL "https://github.com/crealify/anilbhattarai_portfolio/blob/master/pubspec.lock"
    click assets "https://github.com/crealify/anilbhattarai_portfolio/tree/master/assets/images/"
    click android_host "https://github.com/crealify/anilbhattarai_portfolio/blob/master/android/app/src/main/kotlin/com/example/first_portfolio_2025/MainActivity.kt"
    click android_gradle "https://github.com/crealify/anilbhattarai_portfolio/blob/master/android/app/build.gradle.kts"
    click android_gradle "https://github.com/crealify/anilbhattarai_portfolio/blob/master/android/build.gradle.kts"
    click android_manifest "https://github.com/crealify/anilbhattarai_portfolio/blob/master/android/app/src/main/AndroidManifest.xml"
    click android_res "https://github.com/crealify/anilbhattarai_portfolio/tree/master/android/app/src/main/res/"
    click ios_host "https://github.com/crealify/anilbhattarai_portfolio/blob/master/ios/Runner/AppDelegate.swift"
    click ios_proj "https://github.com/crealify/anilbhattarai_portfolio/tree/master/ios/Runner.xcodeproj/"
    click ios_assets "https://github.com/crealify/anilbhattarai_portfolio/tree/master/ios/Runner/Assets.xcassets/"
    click web_html "https://github.com/crealify/anilbhattarai_portfolio/blob/master/web/index.html"
    click web_manifest "https://github.com/crealify/anilbhattarai_portfolio/blob/master/web/manifest.json"
    click web_icons "https://github.com/crealify/anilbhattarai_portfolio/tree/master/web/icons/"
    click win_launcher "https://github.com/crealify/anilbhattarai_portfolio/blob/master/windows/runner/main.cpp"
    click win_launcher "https://github.com/crealify/anilbhattarai_portfolio/blob/master/windows/runner/flutter_window.cpp"
    click win_reg "https://github.com/crealify/anilbhattarai_portfolio/blob/master/windows/flutter/generated_plugin_registrant.cc"
    click win_reg "https://github.com/crealify/anilbhattarai_portfolio/blob/master/windows/flutter/generated_plugin_registrant.h"
    click linux_launcher "https://github.com/crealify/anilbhattarai_portfolio/blob/master/linux/runner/main.cc"
    click linux_launcher "https://github.com/crealify/anilbhattarai_portfolio/blob/master/linux/runner/my_application.cc"
    click linux_reg "https://github.com/crealify/anilbhattarai_portfolio/blob/master/linux/flutter/generated_plugin_registrant.cc"
    click linux_reg "https://github.com/crealify/anilbhattarai_portfolio/blob/master/linux/flutter/generated_plugin_registrant.h"
    click macos_app "https://github.com/crealify/anilbhattarai_portfolio/blob/master/macos/Runner/AppDelegate.swift"
    click macos_app "https://github.com/crealify/anilbhattarai_portfolio/blob/master/macos/Runner/MainFlutterWindow.swift"
    click macos_reg "https://github.com/crealify/anilbhattarai_portfolio/blob/master/macos/Flutter/GeneratedPluginRegistrant.swift"
    click ci "https://github.com/crealify/anilbhattarai_portfolio/blob/master/.github/workflows/static.yml"

    %% Styles
    classDef code fill:#B3DDF2,stroke:#036,stroke-width:1px
    classDef storage fill:#CCCCCC,stroke:#666,stroke-width:1px,stroke-dasharray: 5 5
    classDef framework fill:#C4E1C1,stroke:#083,stroke-width:1px
    classDef host fill:#FDE0B4,stroke:#E85,stroke-width:1px
    classDef pipeline_gear fill:#F2D7D5,stroke:#A33,stroke-width:1px,shape:hexagon
    classDef pipeline fill:#E8DFF5,stroke:#73A,stroke-width:1px
    classDef cloud fill:#D0F0FD,stroke:#39A,stroke-width:1px,shape:cloud
```
