# sachinsulu/ar_heritage architecture

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

- Interactive diagram: https://gitdiagram.com/sachinsulu/ar_heritage
- Repository: https://github.com/sachinsulu/ar_heritage

## Overview

Smarter Heritage is a Flutter guide to Bhaktapur monuments, combining offline browsing and saved-visit features with an on-device camera classifier for Nyatapola and the Golden Gate. The main scan flow requests camera permission, captures an image, preprocesses it, runs TFLite inference, evaluates confidence, and presents a match or guidance. The README documents these stages and the major browsing capabilities; source excerpts were not provided, so relationships below rely on README evidence rather than inspected implementation calls.

Main entry points: [`lib/features/scanner/logic/scanner_controller.dart`](https://github.com/sachinsulu/ar_heritage/blob/main/lib/features/scanner/logic/scanner_controller.dart) (Scanner controller), [`lib/data/services/data_service.dart`](https://github.com/sachinsulu/ar_heritage/blob/main/lib/data/services/data_service.dart) (Catalog loader), [`lib/features/monument_detail/presentation/screens/monument_detail_screen.dart`](https://github.com/sachinsulu/ar_heritage/blob/main/lib/features/monument_detail/presentation/screens/monument_detail_screen.dart) (Monument details), [`lib/core/services/recents_service.dart`](https://github.com/sachinsulu/ar_heritage/blob/main/lib/core/services/recents_service.dart) (Recents service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shell["App experience"]
  node_app["App entry<br/>[main.dart]"]
  node_bootstrap["App bootstrap<br/>[app_bootstrap.dart]"]
  node_router["App router<br/>[app_router.dart]"]
  node_home["Home feed<br/>[home_screen.dart]"]
end

subgraph group_scanner["Recognition flow"]
  node_scanner_screen["Scanner screen"]
  node_scanner_controller["Scanner controller"]
  node_permission["Camera permission"]
  node_preprocess["Image preprocessing"]
  node_classifier["TFLite classifier<br/>[classifier.dart]"]
  node_model["TFLite model"]
  node_constants["Scan configuration<br/>[app_constants.dart]"]
  node_result["Match panel<br/>[result_panel.dart]"]
  node_recents_sheet["Recent visits sheet<br/>[recents_sheet.dart]"]
end

subgraph group_catalog["Heritage catalog"]
  node_data_service["Catalog loader<br/>[data_service.dart]"]
  node_catalog_json["Monument catalog<br/>[monuments.json]"]
  node_fallback["Fallback catalog<br/>[fallback_data.dart]"]
  node_monument_model["Monument entities"]
  node_detail["Monument details"]
  node_gallery["Photo gallery"]
  node_images["Gallery images"]
end

subgraph group_saved["Saved activity"]
  node_bookmarks["Bookmarks service"]
  node_recents["Recents service"]
end

node_visitor(("Visitor"))
node_camera["Device camera"]
node_preferences[("Local preferences")]

node_visitor -->|"opens"| node_app
node_app -->|"initializes"| node_bootstrap
node_visitor -->|"browses"| node_home
node_visitor -->|"scans landmark"| node_scanner_screen
node_scanner_screen -->|"controls scan"| node_scanner_controller
node_scanner_controller -->|"requests access"| node_permission
node_permission -->|"authorizes use"| node_camera
node_scanner_controller -->|"captures frame"| node_camera
node_scanner_controller -->|"preprocesses frame"| node_preprocess
node_scanner_controller -->|"runs inference"| node_classifier
node_classifier -->|"executes model"| node_model
node_classifier -->|"uses threshold"| node_constants
node_scanner_controller -->|"presents outcome"| node_result
node_result -->|"links to details"| node_detail
node_scanner_controller -->|"records visits"| node_recents
node_home -->|"loads catalog"| node_data_service
node_detail -->|"loads monument"| node_data_service
node_data_service -->|"loads dataset"| node_catalog_json
node_data_service -->|"falls back to"| node_fallback
node_data_service -->|"provides models"| node_monument_model
node_detail -->|"opens gallery"| node_gallery
node_gallery -->|"displays photos"| node_images
node_detail -->|"toggles saved item"| node_bookmarks
node_home -->|"shows history"| node_recents
node_recents_sheet -->|"shows history"| node_recents
node_bookmarks -->|"persists bookmarks"| node_preferences
node_recents -->|"persists history"| node_preferences
node_app -.->|"routes screens"| node_router

click node_app "https://github.com/sachinsulu/ar_heritage/blob/main/lib/main.dart"
click node_bootstrap "https://github.com/sachinsulu/ar_heritage/blob/main/lib/core/bootstrap/app_bootstrap.dart"
click node_router "https://github.com/sachinsulu/ar_heritage/blob/main/lib/core/utils/app_router.dart"
click node_home "https://github.com/sachinsulu/ar_heritage/blob/main/lib/features/home/presentation/screens/home_screen.dart"
click node_scanner_screen "https://github.com/sachinsulu/ar_heritage/blob/main/lib/features/scanner/presentation/screens/scanner_screen.dart"
click node_scanner_controller "https://github.com/sachinsulu/ar_heritage/blob/main/lib/features/scanner/logic/scanner_controller.dart"
click node_permission "https://github.com/sachinsulu/ar_heritage/blob/main/lib/core/services/permission_service.dart"
click node_preprocess "https://github.com/sachinsulu/ar_heritage/blob/main/lib/core/utils/classifier_preprocess.dart"
click node_classifier "https://github.com/sachinsulu/ar_heritage/blob/main/lib/core/utils/classifier.dart"
click node_model "https://github.com/sachinsulu/ar_heritage/blob/main/assets/models/ar_heritage_student_v4.tflite"
click node_constants "https://github.com/sachinsulu/ar_heritage/blob/main/lib/core/constants/app_constants.dart"
click node_result "https://github.com/sachinsulu/ar_heritage/blob/main/lib/features/scanner/presentation/widgets/result_panel.dart"
click node_recents_sheet "https://github.com/sachinsulu/ar_heritage/blob/main/lib/features/scanner/presentation/widgets/recents_sheet.dart"
click node_data_service "https://github.com/sachinsulu/ar_heritage/blob/main/lib/data/services/data_service.dart"
click node_catalog_json "https://github.com/sachinsulu/ar_heritage/blob/main/assets/data/monuments.json"
click node_fallback "https://github.com/sachinsulu/ar_heritage/blob/main/lib/data/fallback_data.dart"
click node_monument_model "https://github.com/sachinsulu/ar_heritage/blob/main/lib/data/models/monument_model.dart"
click node_detail "https://github.com/sachinsulu/ar_heritage/blob/main/lib/features/monument_detail/presentation/screens/monument_detail_screen.dart"
click node_gallery "https://github.com/sachinsulu/ar_heritage/blob/main/lib/features/monument_detail/presentation/screens/gallery_viewer_screen.dart"
click node_images "https://github.com/sachinsulu/ar_heritage/tree/main/assets/images/monuments"
click node_bookmarks "https://github.com/sachinsulu/ar_heritage/blob/main/lib/core/services/bookmarks_service.dart"
click node_recents "https://github.com/sachinsulu/ar_heritage/blob/main/lib/core/services/recents_service.dart"

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_app,node_bootstrap,node_router,node_home toneBlue
class node_scanner_screen,node_scanner_controller,node_permission,node_preprocess,node_classifier,node_model,node_constants,node_result,node_recents_sheet,node_preferences toneAmber
class node_data_service,node_catalog_json,node_fallback,node_monument_model,node_detail,node_gallery,node_images toneMint
class node_bookmarks,node_recents toneRose
class node_visitor,node_camera toneIndigo
```

## Components

### App experience

- [App entry](https://github.com/sachinsulu/ar_heritage/blob/main/lib/main.dart): `lib/main.dart`
- [App bootstrap](https://github.com/sachinsulu/ar_heritage/blob/main/lib/core/bootstrap/app_bootstrap.dart): `lib/core/bootstrap/app_bootstrap.dart`
- [App router](https://github.com/sachinsulu/ar_heritage/blob/main/lib/core/utils/app_router.dart): `lib/core/utils/app_router.dart`
- [Home feed](https://github.com/sachinsulu/ar_heritage/blob/main/lib/features/home/presentation/screens/home_screen.dart): `lib/features/home/presentation/screens/home_screen.dart`

### Recognition flow

- [Scanner screen](https://github.com/sachinsulu/ar_heritage/blob/main/lib/features/scanner/presentation/screens/scanner_screen.dart): `lib/features/scanner/presentation/screens/scanner_screen.dart`
- [Scanner controller](https://github.com/sachinsulu/ar_heritage/blob/main/lib/features/scanner/logic/scanner_controller.dart): `lib/features/scanner/logic/scanner_controller.dart`
- [Camera permission](https://github.com/sachinsulu/ar_heritage/blob/main/lib/core/services/permission_service.dart): `lib/core/services/permission_service.dart`
- [Image preprocessing](https://github.com/sachinsulu/ar_heritage/blob/main/lib/core/utils/classifier_preprocess.dart): `lib/core/utils/classifier_preprocess.dart`
- [TFLite classifier](https://github.com/sachinsulu/ar_heritage/blob/main/lib/core/utils/classifier.dart): `lib/core/utils/classifier.dart`
- [TFLite model](https://github.com/sachinsulu/ar_heritage/blob/main/assets/models/ar_heritage_student_v4.tflite): `assets/models/ar_heritage_student_v4.tflite`
- [Scan configuration](https://github.com/sachinsulu/ar_heritage/blob/main/lib/core/constants/app_constants.dart): `lib/core/constants/app_constants.dart`
- [Match panel](https://github.com/sachinsulu/ar_heritage/blob/main/lib/features/scanner/presentation/widgets/result_panel.dart): `lib/features/scanner/presentation/widgets/result_panel.dart`
- [Recent visits sheet](https://github.com/sachinsulu/ar_heritage/blob/main/lib/features/scanner/presentation/widgets/recents_sheet.dart): `lib/features/scanner/presentation/widgets/recents_sheet.dart`

### Heritage catalog

- [Catalog loader](https://github.com/sachinsulu/ar_heritage/blob/main/lib/data/services/data_service.dart): `lib/data/services/data_service.dart`
- [Monument catalog](https://github.com/sachinsulu/ar_heritage/blob/main/assets/data/monuments.json): `assets/data/monuments.json`
- [Fallback catalog](https://github.com/sachinsulu/ar_heritage/blob/main/lib/data/fallback_data.dart): `lib/data/fallback_data.dart`
- [Monument entities](https://github.com/sachinsulu/ar_heritage/blob/main/lib/data/models/monument_model.dart): `lib/data/models/monument_model.dart`
- [Monument details](https://github.com/sachinsulu/ar_heritage/blob/main/lib/features/monument_detail/presentation/screens/monument_detail_screen.dart): `lib/features/monument_detail/presentation/screens/monument_detail_screen.dart`
- [Photo gallery](https://github.com/sachinsulu/ar_heritage/blob/main/lib/features/monument_detail/presentation/screens/gallery_viewer_screen.dart): `lib/features/monument_detail/presentation/screens/gallery_viewer_screen.dart`
- [Gallery images](https://github.com/sachinsulu/ar_heritage/tree/main/assets/images/monuments): `assets/images/monuments`

### Saved activity

- [Bookmarks service](https://github.com/sachinsulu/ar_heritage/blob/main/lib/core/services/bookmarks_service.dart): `lib/core/services/bookmarks_service.dart`
- [Recents service](https://github.com/sachinsulu/ar_heritage/blob/main/lib/core/services/recents_service.dart): `lib/core/services/recents_service.dart`

### Other components

- **Visitor**
- **Device camera**
- **Local preferences**

## Connections

- Visitor → App entry: opens (evidence: `README.md`)
- App entry → App bootstrap: initializes (evidence: `README.md`)
- Visitor → Home feed: browses (evidence: `README.md`)
- Visitor → Scanner screen: scans landmark (evidence: `README.md`)
- Scanner screen → Scanner controller: controls scan (evidence: `README.md`)
- Scanner controller → Camera permission: requests access (evidence: `README.md`)
- Camera permission → Device camera: authorizes use (evidence: `README.md`)
- Scanner controller → Device camera: captures frame (evidence: `README.md`)
- Scanner controller → Image preprocessing: preprocesses frame (evidence: `README.md`)
- Scanner controller → TFLite classifier: runs inference (evidence: `README.md`)
- TFLite classifier → TFLite model: executes model (evidence: `README.md`)
- TFLite classifier → Scan configuration: uses threshold (evidence: `README.md`)
- Scanner controller → Match panel: presents outcome (evidence: `README.md`)
- Match panel → Monument details: links to details (evidence: `README.md`)
- Scanner controller → Recents service: records visits (evidence: `README.md`)
- Home feed → Catalog loader: loads catalog (evidence: `README.md`)
- Monument details → Catalog loader: loads monument (evidence: `README.md`)
- Catalog loader → Monument catalog: loads dataset (evidence: `README.md`)
- Catalog loader → Fallback catalog: falls back to (evidence: `README.md`)
- Catalog loader → Monument entities: provides models (evidence: `README.md`)
- Monument details → Photo gallery: opens gallery (evidence: `README.md`)
- Photo gallery → Gallery images: displays photos (evidence: `README.md`)
- Monument details → Bookmarks service: toggles saved item (evidence: `README.md`)
- Home feed → Recents service: shows history (evidence: `README.md`)
- Recent visits sheet → Recents service: shows history (evidence: `README.md`)
- Bookmarks service → Local preferences: persists bookmarks (evidence: `README.md`)
- Recents service → Local preferences: persists history (evidence: `README.md`)
- App entry → App router: routes screens
