# sujalpoudel78/pegion architecture

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

- Interactive diagram: https://gitdiagram.com/sujalpoudel78/pegion
- Repository: https://github.com/sujalpoudel78/pegion

## Overview

Pegion is a Flutter real-time messaging app. Its main user journey is account registration or sign-in, entry to the home/contact views, selection of a conversation, and exchange of messages; users can also view and manage profile details. The README documents email/password and Google sign-in, database-backed messaging, and account deletion/display-name changes. Dart implementation excerpts were not supplied, so links among feature components reflect documented responsibilities and the file layout, not verified method calls; Firebase access is noted as restricted.

Main entry points: [`lib/features/chat/ui/chat_screen.dart`](https://github.com/sujalpoudel78/pegion/blob/main/lib/features/chat/ui/chat_screen.dart) (Conversation), [`lib/features/auth/controller/auth_controller.dart`](https://github.com/sujalpoudel78/pegion/blob/main/lib/features/auth/controller/auth_controller.dart) (Auth controller), [`lib/pages/home.dart`](https://github.com/sujalpoudel78/pegion/blob/main/lib/pages/home.dart) (Home), [`lib/features/chat/controller/chat_controller.dart`](https://github.com/sujalpoudel78/pegion/blob/main/lib/features/chat/controller/chat_controller.dart) (Chat controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App shell"]
  node_entry["App entry<br/>[main.dart]"]
  node_app_shell["App shell<br/>[app.dart]"]
end

subgraph group_identity["Identity"]
  node_auth_gate["Auth gate<br/>[auth_gate.dart]"]
  node_login["Login<br/>[login_page.dart]"]
  node_register["Registration<br/>[register_page.dart]"]
  node_forgot_password["Password recovery"]
  node_auth_controller["Auth controller"]
end

subgraph group_messaging["Messaging"]
  node_home["Home<br/>[home.dart]"]
  node_contacts["Contacts"]
  node_chat_list["Chat list"]
  node_chat_screen["Conversation<br/>[chat_screen.dart]"]
  node_chat_controller["Chat controller"]
  node_message_model["Message model<br/>[message.dart]"]
  node_chat_bubble["Message display<br/>[chat_bubble.dart]"]
  node_profile_chat["Chat profile<br/>[profile_page.dart]"]
end

subgraph group_account["Account"]
  node_profile_page["Profile view<br/>[profile_page.dart]"]
  node_profile_details["Profile details<br/>[details_page.dart]"]
end

node_user(("User"))
node_firebase_auth["Firebase Auth"]
node_firestore[("Firestore")]

node_user -->|"opens app"| node_entry
node_entry -->|"starts"| node_app_shell
node_app_shell -->|"shows"| node_auth_gate
node_user -->|"signs in"| node_login
node_user -->|"registers"| node_register
node_login -->|"requests sign-in"| node_auth_controller
node_register -->|"requests account"| node_auth_controller
node_forgot_password -->|"requests recovery"| node_auth_controller
node_auth_controller -.->|"authenticates"| node_firebase_auth
node_auth_gate -->|"opens signed-in view"| node_home
node_home -->|"offers contacts"| node_contacts
node_home -->|"shows conversations"| node_chat_list
node_contacts -->|"starts conversation"| node_chat_screen
node_chat_list -->|"opens conversation"| node_chat_screen
node_chat_screen -->|"handles messages"| node_chat_controller
node_chat_controller -.->|"reads and writes"| node_firestore
node_chat_controller -->|"uses message data"| node_message_model
node_chat_screen -->|"displays messages"| node_chat_bubble
node_chat_screen -->|"opens participant profile"| node_profile_chat
node_user -->|"manages account"| node_profile_page
node_profile_page -->|"views details"| node_profile_details
node_profile_page -->|"requests account changes"| node_auth_controller

click node_entry "https://github.com/sujalpoudel78/pegion/blob/main/lib/main.dart"
click node_app_shell "https://github.com/sujalpoudel78/pegion/blob/main/lib/app.dart"
click node_auth_gate "https://github.com/sujalpoudel78/pegion/blob/main/lib/features/auth/auth_gate.dart"
click node_login "https://github.com/sujalpoudel78/pegion/blob/main/lib/pages/login_page.dart"
click node_register "https://github.com/sujalpoudel78/pegion/blob/main/lib/pages/register_page.dart"
click node_forgot_password "https://github.com/sujalpoudel78/pegion/blob/main/lib/pages/forgot_pass_page.dart"
click node_auth_controller "https://github.com/sujalpoudel78/pegion/blob/main/lib/features/auth/controller/auth_controller.dart"
click node_home "https://github.com/sujalpoudel78/pegion/blob/main/lib/pages/home.dart"
click node_contacts "https://github.com/sujalpoudel78/pegion/blob/main/lib/features/chat/ui/contacts_screen.dart"
click node_chat_list "https://github.com/sujalpoudel78/pegion/blob/main/lib/features/chat/ui/chat_list_screen_ui.dart"
click node_chat_screen "https://github.com/sujalpoudel78/pegion/blob/main/lib/features/chat/ui/chat_screen.dart"
click node_chat_controller "https://github.com/sujalpoudel78/pegion/blob/main/lib/features/chat/controller/chat_controller.dart"
click node_message_model "https://github.com/sujalpoudel78/pegion/blob/main/lib/shared/models/message.dart"
click node_chat_bubble "https://github.com/sujalpoudel78/pegion/blob/main/lib/features/chat/ui/chat_bubble.dart"
click node_profile_page "https://github.com/sujalpoudel78/pegion/blob/main/lib/features/profile/ui/profile_page.dart"
click node_profile_details "https://github.com/sujalpoudel78/pegion/blob/main/lib/features/profile/ui/details_page.dart"
click node_profile_chat "https://github.com/sujalpoudel78/pegion/blob/main/lib/features/chat/ui/profile_page.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_entry,node_app_shell,node_user toneBlue
class node_auth_gate,node_login,node_register,node_forgot_password,node_auth_controller,node_firestore toneAmber
class node_home,node_contacts,node_chat_list,node_chat_screen,node_chat_controller,node_message_model,node_chat_bubble,node_profile_chat toneMint
class node_profile_page,node_profile_details toneRose
class node_firebase_auth toneIndigo
```

## Components

### App shell

- [App entry](https://github.com/sujalpoudel78/pegion/blob/main/lib/main.dart): `lib/main.dart`
- [App shell](https://github.com/sujalpoudel78/pegion/blob/main/lib/app.dart): `lib/app.dart`

### Identity

- [Auth gate](https://github.com/sujalpoudel78/pegion/blob/main/lib/features/auth/auth_gate.dart): `lib/features/auth/auth_gate.dart`
- [Login](https://github.com/sujalpoudel78/pegion/blob/main/lib/pages/login_page.dart): `lib/pages/login_page.dart`
- [Registration](https://github.com/sujalpoudel78/pegion/blob/main/lib/pages/register_page.dart): `lib/pages/register_page.dart`
- [Password recovery](https://github.com/sujalpoudel78/pegion/blob/main/lib/pages/forgot_pass_page.dart): `lib/pages/forgot_pass_page.dart`
- [Auth controller](https://github.com/sujalpoudel78/pegion/blob/main/lib/features/auth/controller/auth_controller.dart): `lib/features/auth/controller/auth_controller.dart`

### Messaging

- [Home](https://github.com/sujalpoudel78/pegion/blob/main/lib/pages/home.dart): `lib/pages/home.dart`
- [Contacts](https://github.com/sujalpoudel78/pegion/blob/main/lib/features/chat/ui/contacts_screen.dart): `lib/features/chat/ui/contacts_screen.dart`
- [Chat list](https://github.com/sujalpoudel78/pegion/blob/main/lib/features/chat/ui/chat_list_screen_ui.dart): `lib/features/chat/ui/chat_list_screen_ui.dart`
- [Conversation](https://github.com/sujalpoudel78/pegion/blob/main/lib/features/chat/ui/chat_screen.dart): `lib/features/chat/ui/chat_screen.dart`
- [Chat controller](https://github.com/sujalpoudel78/pegion/blob/main/lib/features/chat/controller/chat_controller.dart): `lib/features/chat/controller/chat_controller.dart`
- [Message model](https://github.com/sujalpoudel78/pegion/blob/main/lib/shared/models/message.dart): `lib/shared/models/message.dart`
- [Message display](https://github.com/sujalpoudel78/pegion/blob/main/lib/features/chat/ui/chat_bubble.dart): `lib/features/chat/ui/chat_bubble.dart`
- [Chat profile](https://github.com/sujalpoudel78/pegion/blob/main/lib/features/chat/ui/profile_page.dart): `lib/features/chat/ui/profile_page.dart`

### Account

- [Profile view](https://github.com/sujalpoudel78/pegion/blob/main/lib/features/profile/ui/profile_page.dart): `lib/features/profile/ui/profile_page.dart`
- [Profile details](https://github.com/sujalpoudel78/pegion/blob/main/lib/features/profile/ui/details_page.dart): `lib/features/profile/ui/details_page.dart`

### Other components

- **User**
- **Firebase Auth**
- **Firestore**

## Connections

- User → App entry: opens app
- App entry → App shell: starts
- App shell → Auth gate: shows
- User → Login: signs in
- User → Registration: registers
- Login → Auth controller: requests sign-in
- Registration → Auth controller: requests account
- Password recovery → Auth controller: requests recovery
- Auth controller → Firebase Auth: authenticates
- Auth gate → Home: opens signed-in view
- Home → Contacts: offers contacts
- Home → Chat list: shows conversations
- Contacts → Conversation: starts conversation
- Chat list → Conversation: opens conversation
- Conversation → Chat controller: handles messages
- Chat controller → Firestore: reads and writes
- Chat controller → Message model: uses message data
- Conversation → Message display: displays messages
- Conversation → Chat profile: opens participant profile
- User → Profile view: manages account
- Profile view → Profile details: views details
- Profile view → Auth controller: requests account changes
