# codeacc384-coder/ambulanc_first architecture

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

- Interactive diagram: https://gitdiagram.com/codeacc384-coder/ambulanc_first
- Repository: https://github.com/codeacc384-coder/ambulanc_first

## Overview

Ambulance First is a Flutter ambulance-service app; the README highlights a customer active-trip screen with ETA, route, map preview, telemetry, and hospital alert information. The supplied tree omits the Dart application source, so those capabilities are documented here but their runtime flow cannot be traced. The visible code mainly covers platform launchers and two Supabase functions; source excerpts do not establish how the app invokes those functions or how the UI obtains its data.

Main entry points: [`windows/runner/flutter_window.h`](https://github.com/codeacc384-coder/ambulanc_first/blob/main/windows/runner/flutter_window.h) (Flutter window), [`linux/runner/main.cc`](https://github.com/codeacc384-coder/ambulanc_first/blob/main/linux/runner/main.cc) (Linux app entry), [`windows/runner/main.cpp`](https://github.com/codeacc384-coder/ambulanc_first/blob/main/windows/runner/main.cpp) (Windows app entry), [`ios/Runner/AppDelegate.swift`](https://github.com/codeacc384-coder/ambulanc_first/blob/main/ios/Runner/AppDelegate.swift) (iOS app delegate)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_customer["Customer experience"]
  node_active_trip["Active trip UI"]
end

subgraph group_backend["Backend functions"]
  node_route["Route calculation<br/>[index.ts]"]
  node_staff["Staff provisioning<br/>[index.ts]"]
end

subgraph group_platform["Platform shells"]
  node_linux_entry["Linux app entry<br/>[main.cc]"]
  node_linux_app["Linux application<br/>[my_application.cc]"]
  node_windows_entry["Windows app entry<br/>[main.cpp]"]
  node_flutter_window["Flutter window<br/>[flutter_window.h]"]
  node_win32_window["Win32 window<br/>[win32_window.cpp]"]
  node_ios_app["iOS app delegate<br/>[AppDelegate.swift]"]
  node_ios_plugins["iOS plugin registration<br/>[AppDelegate.swift]"]
end

node_rider(("Customer"))

node_linux_entry -->|"creates and runs"| node_linux_app
node_windows_entry -->|"creates and shows"| node_flutter_window
node_flutter_window -->|"inherits window"| node_win32_window
node_ios_app -->|"registers plugins"| node_ios_plugins
node_rider -.->|"views trip"| node_active_trip

click node_route "https://github.com/codeacc384-coder/ambulanc_first/blob/main/supabase/functions/calculate-route/index.ts"
click node_staff "https://github.com/codeacc384-coder/ambulanc_first/blob/main/supabase/functions/admin-provision-staff/index.ts"
click node_linux_entry "https://github.com/codeacc384-coder/ambulanc_first/blob/main/linux/runner/main.cc"
click node_linux_app "https://github.com/codeacc384-coder/ambulanc_first/blob/main/linux/runner/my_application.cc"
click node_windows_entry "https://github.com/codeacc384-coder/ambulanc_first/blob/main/windows/runner/main.cpp"
click node_flutter_window "https://github.com/codeacc384-coder/ambulanc_first/blob/main/windows/runner/flutter_window.h"
click node_win32_window "https://github.com/codeacc384-coder/ambulanc_first/blob/main/windows/runner/win32_window.cpp"
click node_ios_app "https://github.com/codeacc384-coder/ambulanc_first/blob/main/ios/Runner/AppDelegate.swift"
click node_ios_plugins "https://github.com/codeacc384-coder/ambulanc_first/blob/main/ios/Runner/AppDelegate.swift"

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_active_trip toneBlue
class node_route,node_staff toneAmber
class node_linux_entry,node_linux_app,node_windows_entry,node_flutter_window,node_win32_window,node_ios_app,node_ios_plugins toneMint
class node_rider toneIndigo
```

## Components

### Customer experience

- **Active trip UI**

### Backend functions

- [Route calculation](https://github.com/codeacc384-coder/ambulanc_first/blob/main/supabase/functions/calculate-route/index.ts): `supabase/functions/calculate-route/index.ts`
- [Staff provisioning](https://github.com/codeacc384-coder/ambulanc_first/blob/main/supabase/functions/admin-provision-staff/index.ts): `supabase/functions/admin-provision-staff/index.ts`

### Platform shells

- [Linux app entry](https://github.com/codeacc384-coder/ambulanc_first/blob/main/linux/runner/main.cc): `linux/runner/main.cc`
- [Linux application](https://github.com/codeacc384-coder/ambulanc_first/blob/main/linux/runner/my_application.cc): `linux/runner/my_application.cc`
- [Windows app entry](https://github.com/codeacc384-coder/ambulanc_first/blob/main/windows/runner/main.cpp): `windows/runner/main.cpp`
- [Flutter window](https://github.com/codeacc384-coder/ambulanc_first/blob/main/windows/runner/flutter_window.h): `windows/runner/flutter_window.h`
- [Win32 window](https://github.com/codeacc384-coder/ambulanc_first/blob/main/windows/runner/win32_window.cpp): `windows/runner/win32_window.cpp`
- [iOS app delegate](https://github.com/codeacc384-coder/ambulanc_first/blob/main/ios/Runner/AppDelegate.swift): `ios/Runner/AppDelegate.swift`
- [iOS plugin registration](https://github.com/codeacc384-coder/ambulanc_first/blob/main/ios/Runner/AppDelegate.swift): `ios/Runner/AppDelegate.swift`

### Other components

- **Customer**

## Connections

- Linux app entry → Linux application: creates and runs (evidence: `linux/runner/main.cc`)
- Windows app entry → Flutter window: creates and shows (evidence: `windows/runner/main.cpp`)
- Flutter window → Win32 window: inherits window (evidence: `windows/runner/flutter_window.h`)
- iOS app delegate → iOS plugin registration: registers plugins (evidence: `ios/Runner/AppDelegate.swift`)
- Customer → Active trip UI: views trip
