# abdullah01-flutter-develpor/facial-emotion-recognition-ai architecture

> Architecture diagram of the GitHub repository abdullah01-flutter-develpor/facial-emotion-recognition-ai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai
- Repository: https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai

## Overview

EmoSense AI is a Flutter facial-emotion analysis app. The principal user journey is to sign in, start an emotion scan, receive an on-device analysis, and then review or discuss results; the README also identifies saved history and insights. The README documents these capabilities, but the sampled Dart source does not show their runtime calls or data flow, so those links are marked unverified. The graph includes the documented feature areas and shared app layers without treating platform runner boilerplate as product logic.

Main entry points: [`lib/features/emotion_scan/services/emotion_inference_service.dart`](https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/lib/features/emotion_scan/services/emotion_inference_service.dart) (On-device inference), [`lib/features/emotion_result/presentation/screens/emotion_result_screen.dart`](https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/lib/features/emotion_result/presentation/screens/emotion_result_screen.dart) (Analysis results), [`lib/features/chat/presentation/screens/emotion_chat_screen.dart`](https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/lib/features/chat/presentation/screens/emotion_chat_screen.dart) (AI emotion chat), [`lib/firebase_options.dart`](https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/lib/firebase_options.dart) (Firebase services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App foundation"]
  node_navigation["App navigation"]
  node_shared["Shared services and state"]
end

subgraph group_identity["Identity"]
  node_authentication["Sign-in and account"]
  node_auth_service["Authentication service<br/>[auth_service.dart]"]
end

subgraph group_analysis["Emotion analysis"]
  node_home["Home and scan entry<br/>[home_screen.dart]"]
  node_scan["Emotion scan"]
  node_inference["On-device inference"]
  node_classifier["Emotion classifier"]
  node_scan_alt["Scan and face detection<br/>[scan_screen.dart]"]
end

subgraph group_engagement["Results and engagement"]
  node_results["Analysis results"]
  node_analysis_detail["Analysis details"]
  node_history["Saved history"]
  node_history_store[("Chat history store")]
  node_insights["Emotion insights"]
  node_chat["AI emotion chat"]
  node_profile["Profile and settings"]
end

subgraph group_backend["Cloud services"]
  node_firebase["Firebase services"]
  node_cloud_functions["Cloud Functions<br/>[index.js]"]
end

node_user(("App user"))

node_user -.->|"opens"| node_navigation
node_navigation -.->|"routes to"| node_authentication
node_authentication -.->|"authenticates with"| node_auth_service
node_auth_service -.->|"uses"| node_firebase
node_user -.->|"uses"| node_home
node_home -.->|"starts"| node_scan
node_scan -.->|"requests analysis"| node_inference
node_inference -.->|"classifies with"| node_classifier
node_scan_alt -.->|"may invoke"| node_inference
node_inference -.->|"returns analysis"| node_results
node_results -.->|"opens detail"| node_analysis_detail
node_results -.->|"may save to"| node_history
node_history -.->|"uses shared state"| node_shared
node_chat -.->|"may persist conversations"| node_history_store
node_user -.->|"reviews"| node_insights
node_user -.->|"discusses emotions"| node_chat
node_user -.->|"manages account"| node_profile
node_chat -.->|"may use AI service"| node_firebase
node_firebase -.->|"may invoke"| node_cloud_functions

click node_navigation "https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/tree/main/lib/app"
click node_shared "https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/tree/main/lib/core"
click node_authentication "https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/tree/main/lib/features/auth/presentation/screens"
click node_auth_service "https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/lib/core/services/auth_service.dart"
click node_home "https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/lib/features/home/presentation/screens/home_screen.dart"
click node_scan "https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/lib/features/emotion_scan/presentation/screens/emotion_scan_screen.dart"
click node_inference "https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/lib/features/emotion_scan/services/emotion_inference_service.dart"
click node_classifier "https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/lib/ml/emotion_classifier.dart"
click node_scan_alt "https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/lib/features/scan/presentation/screens/scan_screen.dart"
click node_results "https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/lib/features/emotion_result/presentation/screens/emotion_result_screen.dart"
click node_analysis_detail "https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/lib/features/emotion_result/presentation/screens/analysis_detail_screen.dart"
click node_history "https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/lib/features/history/presentation/screens/history_screen.dart"
click node_history_store "https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/lib/core/services/chat_history_store.dart"
click node_insights "https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/lib/features/insight/presentation/screens/insight_screen.dart"
click node_chat "https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/lib/features/chat/presentation/screens/emotion_chat_screen.dart"
click node_profile "https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/lib/features/profile/presentation/screens/profile_screen.dart"
click node_firebase "https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/lib/firebase_options.dart"
click node_cloud_functions "https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/functions/index.js"

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_navigation,node_shared,node_user toneBlue
class node_authentication,node_auth_service toneAmber
class node_home,node_scan,node_inference,node_classifier,node_scan_alt toneMint
class node_results,node_analysis_detail,node_history,node_history_store,node_insights,node_chat,node_profile toneRose
class node_firebase,node_cloud_functions toneIndigo
```

## Components

### App foundation

- [App navigation](https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/tree/main/lib/app): `lib/app`
- [Shared services and state](https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/tree/main/lib/core): `lib/core`

### Identity

- [Sign-in and account](https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/tree/main/lib/features/auth/presentation/screens): `lib/features/auth/presentation/screens`
- [Authentication service](https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/lib/core/services/auth_service.dart): `lib/core/services/auth_service.dart`

### Emotion analysis

- [Home and scan entry](https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/lib/features/home/presentation/screens/home_screen.dart): `lib/features/home/presentation/screens/home_screen.dart`
- [Emotion scan](https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/lib/features/emotion_scan/presentation/screens/emotion_scan_screen.dart): `lib/features/emotion_scan/presentation/screens/emotion_scan_screen.dart`
- [On-device inference](https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/lib/features/emotion_scan/services/emotion_inference_service.dart): `lib/features/emotion_scan/services/emotion_inference_service.dart`
- [Emotion classifier](https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/lib/ml/emotion_classifier.dart): `lib/ml/emotion_classifier.dart`
- [Scan and face detection](https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/lib/features/scan/presentation/screens/scan_screen.dart): `lib/features/scan/presentation/screens/scan_screen.dart`

### Results and engagement

- [Analysis results](https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/lib/features/emotion_result/presentation/screens/emotion_result_screen.dart): `lib/features/emotion_result/presentation/screens/emotion_result_screen.dart`
- [Analysis details](https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/lib/features/emotion_result/presentation/screens/analysis_detail_screen.dart): `lib/features/emotion_result/presentation/screens/analysis_detail_screen.dart`
- [Saved history](https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/lib/features/history/presentation/screens/history_screen.dart): `lib/features/history/presentation/screens/history_screen.dart`
- [Chat history store](https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/lib/core/services/chat_history_store.dart): `lib/core/services/chat_history_store.dart`
- [Emotion insights](https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/lib/features/insight/presentation/screens/insight_screen.dart): `lib/features/insight/presentation/screens/insight_screen.dart`
- [AI emotion chat](https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/lib/features/chat/presentation/screens/emotion_chat_screen.dart): `lib/features/chat/presentation/screens/emotion_chat_screen.dart`
- [Profile and settings](https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/lib/features/profile/presentation/screens/profile_screen.dart): `lib/features/profile/presentation/screens/profile_screen.dart`

### Cloud services

- [Firebase services](https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/lib/firebase_options.dart): `lib/firebase_options.dart`
- [Cloud Functions](https://github.com/abdullah01-flutter-develpor/facial-emotion-recognition-ai/blob/main/functions/index.js): `functions/index.js`

### Other components

- **App user**

## Connections

- App user → App navigation: opens
- App navigation → Sign-in and account: routes to
- Sign-in and account → Authentication service: authenticates with
- Authentication service → Firebase services: uses
- App user → Home and scan entry: uses
- Home and scan entry → Emotion scan: starts
- Emotion scan → On-device inference: requests analysis
- On-device inference → Emotion classifier: classifies with
- Scan and face detection → On-device inference: may invoke
- On-device inference → Analysis results: returns analysis
- Analysis results → Analysis details: opens detail
- Analysis results → Saved history: may save to
- Saved history → Shared services and state: uses shared state
- AI emotion chat → Chat history store: may persist conversations
- App user → Emotion insights: reviews
- App user → AI emotion chat: discusses emotions
- App user → Profile and settings: manages account
- AI emotion chat → Firebase services: may use AI service
- Firebase services → Cloud Functions: may invoke
