# markalmax/retrack architecture

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

- Interactive diagram: https://gitdiagram.com/markalmax/retrack
- Repository: https://github.com/markalmax/retrack

## Overview

1. **Project type and runtime**
   - `retrack` is a **Flutter client application**: one Dart codebase targeting Android, iOS, web, Linux, macOS, and Windows.
   - There is no visible backend or cloud service in the repo; the app appears to be primarily a **local device media management/player UI**.

2. **Primary application entrypoint**
   - `lib/main.dart` is the app bootstrap point and likely wires together the top-level widget tree, routing, and theme.
   - All business/UI features under `lib/` hang off this entrypoint.

3. **Feature surface in `lib/Screens`**
   - The app is organized around a small set of screens:
     - `songs_page.dart` for browsing songs
     - `playlist_page.dart` for browsing playlists
     - `song.dart` and `playlist.dart` as the corresponding domain/UI models or screen components
   - This suggests a navigation model centered on **songs vs. playlists** as the main user-facing boundaries.

4. **Data acquisition layer**
   - `lib/Services/media_scanner.dart` is the key non-UI service.
   - From its name and placement, it likely scans local device storage/media sources and produces song metadata for the UI.
   - This service is the main boundary between the Flutter app and device-level media access.

5. **Likely internal data flow**
   - The app likely flows from:
     - app startup in `main.dart`
     - media discovery via `media_scanner.dart`
     - transformation into song/playlist objects in `song.dart` / `playlist.dart`
     - rendering and interaction in `songs_page.dart` / `playlist_page.dart`
   - The architecture is therefore **service → model → screen** rather than server-driven.

6. **Platform integration boundaries**
   - Native platform folders exist for Android, iOS, Linux, macOS, Windows, and web, but they mostly contain generated or standard Flutter shell code.
   - The only obvious custom native hook is `android/app/src/main/kotlin/.../MainActivity.kt`, which is the Android embedding entrypoint.
   - On iOS and macOS, the standard `AppDelegate.swift` / `MainFlutterWindow.swift` wrappers indicate Flutter is the UI layer with minimal native logic.

7. **Platform shell vs shared app logic**
   - The `android/`, `ios/`, `macos/`, `linux/`, and `windows/` directories form the **platform adapters** that launch the Flutter engine.
   - The shared architecture lives almost entirely in `lib/`, making the repo a classic **single shared presentation layer** with thin platform runners.

8. **Web packaging**
   - `web/index.html` and `web/manifest.json` show the app can also be packaged for browser deployment.
   - The web side appears standard Flutter-generated scaffolding rather than a separate web architecture.

9. **Build and dependency management**
   - `pubspec.yaml` / `pubspec.lock` define the Flutter/Dart dependencies and assets.
   - `analysis_options.yaml` indicates linting/static analysis is part of the development workflow.
   - `android/build.gradle.kts`, iOS Podfiles, and platform-specific project files are standard Flutter build integration points.

10. **CI/CD and repo automation**
   - `.github/workflows/build.yml` suggests automated builds or validation in GitHub Actions.
   - This is the main repository-level delivery pipeline visible in the tree.

11. **Testing footprint**
   - Platform test folders exist for iOS and macOS (`RunnerTests`), but there is no obvious Dart test suite in the tree shown.
   - That implies limited or scaffold-level automated testing, with the core app logic concentrated in shared Dart code.

12. **Architecture summary for diagramming**
   - Draw this repo as a **Flutter cross-platform shell** with:
     - a shared Dart application core in `lib/`
     - a media-scanning service feeding song/playlist features
     - screen-level presentation for songs and playlists
     - thin native launchers per platform
     - GitHub Actions handling build automation
   - No external API boundary is evident; the main integration boundary is **device/local media access**.

Main entry points: [`lib/main.dart`](https://github.com/markalmax/retrack/blob/main/lib/main.dart) (App start), [`lib/Screens/song.dart`](https://github.com/markalmax/retrack/blob/main/lib/Screens/song.dart) (Song model), [`lib/Screens/playlist.dart`](https://github.com/markalmax/retrack/blob/main/lib/Screens/playlist.dart) (Playlist model), [`lib/Services/media_scanner.dart`](https://github.com/markalmax/retrack/blob/main/lib/Services/media_scanner.dart) (Media scanner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shared["Shared Dart app"]
  node_main(("App start<br/>Flutter entrypoint<br/>[main.dart]"))
  node_songs_page["Songs page<br/>screen<br/>[songs_page.dart]"]
  node_playlist_page["Playlists<br/>screen<br/>[playlist_page.dart]"]
  node_song_model["Song model<br/>domain/ui model<br/>[song.dart]"]
  node_playlist_model["Playlist model<br/>domain/ui model<br/>[playlist.dart]"]
  node_media_scanner{{"Media scanner<br/>device service<br/>[media_scanner.dart]"}}
end

subgraph group_platforms["Platform shells"]
  node_android_main["Android host<br/>platform launcher<br/>[MainActivity.kt]"]
  node_ios_app["iOS host<br/>platform launcher<br/>[AppDelegate.swift]"]
  node_macos_app["macOS host<br/>platform launcher"]
  node_linux_app["Linux host<br/>platform launcher<br/>[main.cc]"]
  node_windows_app["Windows host<br/>platform launcher<br/>[main.cpp]"]
  node_web_shell["Web shell<br/>platform scaffold<br/>[index.html]"]
end

subgraph group_delivery["Delivery"]
  node_pubspec["Dart deps<br/>build config<br/>[pubspec.yaml]"]
  node_analysis["Lint rules<br/>build config"]
  node_github_actions["CI build<br/>pipeline<br/>[build.yml]"]
end

node_main -->|"uses"| node_media_scanner
node_main -->|"opens"| node_songs_page
node_main -->|"opens"| node_playlist_page
node_media_scanner -->|"produces"| node_song_model
node_song_model -->|"renders in"| node_songs_page
node_playlist_model -->|"renders in"| node_playlist_page
node_song_model -.->|"groups into"| node_playlist_model
node_android_main -->|"launches"| node_main
node_ios_app -->|"launches"| node_main
node_macos_app -->|"launches"| node_main
node_linux_app -->|"launches"| node_main
node_windows_app -->|"launches"| node_main
node_web_shell -->|"loads"| node_main
node_pubspec -->|"configures"| node_main
node_analysis -.->|"constrains"| node_main
node_github_actions -->|"builds"| node_pubspec

click node_main "https://github.com/markalmax/retrack/blob/main/lib/main.dart"
click node_songs_page "https://github.com/markalmax/retrack/blob/main/lib/Screens/songs_page.dart"
click node_playlist_page "https://github.com/markalmax/retrack/blob/main/lib/Screens/playlist_page.dart"
click node_song_model "https://github.com/markalmax/retrack/blob/main/lib/Screens/song.dart"
click node_playlist_model "https://github.com/markalmax/retrack/blob/main/lib/Screens/playlist.dart"
click node_media_scanner "https://github.com/markalmax/retrack/blob/main/lib/Services/media_scanner.dart"
click node_android_main "https://github.com/markalmax/retrack/blob/main/android/app/src/main/kotlin/com/example/retrack/MainActivity.kt"
click node_ios_app "https://github.com/markalmax/retrack/blob/main/ios/Runner/AppDelegate.swift"
click node_macos_app "https://github.com/markalmax/retrack/blob/main/macos/Runner/MainFlutterWindow.swift"
click node_linux_app "https://github.com/markalmax/retrack/blob/main/linux/runner/main.cc"
click node_windows_app "https://github.com/markalmax/retrack/blob/main/windows/runner/main.cpp"
click node_web_shell "https://github.com/markalmax/retrack/blob/main/web/index.html"
click node_pubspec "https://github.com/markalmax/retrack/blob/main/pubspec.yaml"
click node_analysis "https://github.com/markalmax/retrack/blob/main/analysis_options.yaml"
click node_github_actions "https://github.com/markalmax/retrack/blob/main/.github/workflows/build.yml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_songs_page,node_playlist_page,node_song_model,node_playlist_model,node_media_scanner toneBlue
class node_android_main,node_ios_app,node_macos_app,node_linux_app,node_windows_app,node_web_shell toneAmber
class node_pubspec,node_analysis,node_github_actions toneMint
```

## Components

### Shared Dart app

Cross-platform Flutter application logic in lib/

- [App start](https://github.com/markalmax/retrack/blob/main/lib/main.dart): Flutter entrypoint · Bootstraps the shared widget tree and top-level app setup · `lib/main.dart`
- [Songs page](https://github.com/markalmax/retrack/blob/main/lib/Screens/songs_page.dart): screen · Primary browsing screen for songs · `lib/Screens/songs_page.dart`
- [Playlists](https://github.com/markalmax/retrack/blob/main/lib/Screens/playlist_page.dart): screen · Primary browsing screen for playlists · `lib/Screens/playlist_page.dart`
- [Song model](https://github.com/markalmax/retrack/blob/main/lib/Screens/song.dart): domain/ui model · Represents song data and related screen state · `lib/Screens/song.dart`
- [Playlist model](https://github.com/markalmax/retrack/blob/main/lib/Screens/playlist.dart): domain/ui model · Represents playlist data and related screen state · `lib/Screens/playlist.dart`
- [Media scanner](https://github.com/markalmax/retrack/blob/main/lib/Services/media_scanner.dart): device service · Scans local media sources and produces song metadata · `lib/Services/media_scanner.dart`

### Platform shells

Native launchers and embedding wrappers for each target platform

- [Android host](https://github.com/markalmax/retrack/blob/main/android/app/src/main/kotlin/com/example/retrack/MainActivity.kt): platform launcher · Android embedding entrypoint for the Flutter engine · `android/app/src/main/kotlin/com/example/retrack/MainActivity.kt`
- [iOS host](https://github.com/markalmax/retrack/blob/main/ios/Runner/AppDelegate.swift): platform launcher · iOS Flutter wrapper and app delegate · `ios/Runner/AppDelegate.swift`
- [macOS host](https://github.com/markalmax/retrack/blob/main/macos/Runner/MainFlutterWindow.swift): platform launcher · macOS Flutter wrapper and window host · `macos/Runner/MainFlutterWindow.swift`
- [Linux host](https://github.com/markalmax/retrack/blob/main/linux/runner/main.cc): platform launcher · Linux runner and Flutter shell · `linux/runner/main.cc`
- [Windows host](https://github.com/markalmax/retrack/blob/main/windows/runner/main.cpp): platform launcher · Windows runner and Flutter shell · `windows/runner/main.cpp`
- [Web shell](https://github.com/markalmax/retrack/blob/main/web/index.html): platform scaffold · Browser packaging and app boot scaffolding · `web/index.html`

### Delivery

Build and automation entrypoints

- [Dart deps](https://github.com/markalmax/retrack/blob/main/pubspec.yaml): build config · Flutter package dependencies and assets · `pubspec.yaml`
- [Lint rules](https://github.com/markalmax/retrack/blob/main/analysis_options.yaml): build config · Static analysis and lint configuration · `analysis_options.yaml`
- [CI build](https://github.com/markalmax/retrack/blob/main/.github/workflows/build.yml): pipeline · GitHub Actions workflow for build and validation · `.github/workflows/build.yml`

## Connections

- App start → Media scanner: uses · App startup wires in local media discovery
- App start → Songs page: opens · Main app route reaches the songs browsing UI
- App start → Playlists: opens · Main app route reaches the playlists browsing UI
- Media scanner → Song model: produces · Scanner outputs song data consumed by the UI
- Song model → Songs page: renders in · Song objects are displayed on the songs screen
- Playlist model → Playlists: renders in · Playlist objects are displayed on the playlists screen
- Song model → Playlist model: groups into · Songs can be organized into playlists
- Android host → App start: launches · Android shell starts the shared Flutter app
- iOS host → App start: launches · iOS shell starts the shared Flutter app
- macOS host → App start: launches · macOS shell starts the shared Flutter app
- Linux host → App start: launches · Linux shell starts the shared Flutter app
- Windows host → App start: launches · Windows shell starts the shared Flutter app
- Web shell → App start: loads · Web packaging loads the shared Flutter app in browser
- Dart deps → App start: configures · Dependencies and assets shape the Flutter app build
- Lint rules → App start: constrains · Linting and analysis apply to the shared Dart code
- CI build → Dart deps: builds · CI uses the project configuration to build and validate
