# neetukumari-123/realtime_chat architecture

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

- Interactive diagram: https://gitdiagram.com/neetukumari-123/realtime_chat
- Repository: https://github.com/neetukumari-123/realtime_chat

## Overview

1. This repository is a cross-platform Flutter chat application. The main product boundary is a Flutter client in `lib/`, backed by Firebase configuration on mobile and a separate Firebase Cloud Functions service in `functions/`.

2. The client app is bootstrapped from `lib/main.dart`, with Firebase options in `lib/firebase_options.dart`. The app is built to run on Android, iOS, web, Windows, macOS, and Linux, but the core business logic lives in the Flutter layer rather than in the platform runners.

3. The Flutter code is organized in a feature/module style under `lib/app/modules/`: `splash`, `auth`, `home`, and `chatview`. Each module has the same internal split: `bindings`, `controllers`, and `views`, which strongly suggests a GetX-style architecture with dependency injection and screen-specific state management.

4. Routing is centralized in `lib/app/routes/app_pages.dart` and `lib/app/routes/app_routes.dart`. That makes navigation a distinct app-level concern, separate from screen widgets, and it likely drives the startup flow from splash into authentication or the main home/chat experience.

5. Cross-cutting application logic is pushed into `lib/app/services/`: `auth_service.dart`, `notification_service.dart`, and `presence_service.dart`. These are the main non-UI boundaries between controllers and external Firebase services, and they likely handle identity/session state, push notifications, and online/offline presence.

6. The expected data flow is: splash screen checks app/session state, auth module handles sign-in/sign-out, home module presents the signed-in user’s main chat context, and chatview handles the live conversation screen. Controllers mediate UI state, while services encapsulate backend interaction.

7. Firebase is the central backend integration point. The repo includes `android/app/google-services.json`, `ios/Runner/GoogleService-Info.plist`, and `lib/firebase_options.dart`, which indicates FlutterFire initialization across platforms. `firebase.json` and `.firebaserc` add project/deployment configuration at the repository level.

8. Server-side logic is separated into `functions/index.js` with its own Node.js package files. This is the cloud/backend execution boundary for event-driven logic such as message-triggered notifications, user presence updates, or other Firebase-side automation that should not run in the client.

9. The UI layer shares reusable design primitives under `lib/app/utils/common/` and `lib/app/utils/consts/`. This includes custom buttons, container widgets, colors, gradients, and image constants, which keeps screen modules focused on composition rather than styling details.

10. Platform folders (`android/`, `ios/`, `macos/`, `linux/`, `windows/`, `web/`) are mostly generated Flutter host shells. The Android/iOS trees are the most important operationally because they carry Firebase native configuration and launch manifests needed to connect the app to Firebase services.

11. The repository appears to be a starter-level implementation rather than a heavily tested production system. There is only a basic `test/widget_test.dart`, so the architectural diagram should emphasize runtime structure and service boundaries more than a deep automated test layer.

12. If you are drawing the architecture, the clearest high-level shape is: Flutter client modules and services in the center, Firebase Auth/notifications/presence/data services on the backend boundary, and Firebase Cloud Functions as the server-side extension point connected to the client through the Firebase SDKs.

Main entry points: [`lib/app/routes/app_pages.dart`](https://github.com/neetukumari-123/realtime_chat/blob/main/lib/app/routes/app_pages.dart) (Route Pages), [`lib/main.dart`](https://github.com/neetukumari-123/realtime_chat/blob/main/lib/main.dart) (Main), [`functions/index.js`](https://github.com/neetukumari-123/realtime_chat/blob/main/functions/index.js) (Cloud Functions), [`lib/app/services/presence_service.dart`](https://github.com/neetukumari-123/realtime_chat/blob/main/lib/app/services/presence_service.dart) (Presence Service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_flutter_client["Flutter Client"]
  node_main["Main<br/>app entry<br/>[main.dart]"]
  node_firebase_options["Firebase Options<br/>firebase config"]
  node_routes_pages["Route Pages<br/>routing<br/>[app_pages.dart]"]
  node_routes_names["Route Names<br/>routing<br/>[app_routes.dart]"]
  node_service_auth["Auth Service<br/>[auth_service.dart]"]
  node_service_notify["Notify Service"]
  node_service_presence["Presence Service"]
  node_module_splash["Splash<br/>feature module"]
  node_module_auth["Auth<br/>feature module"]
  node_module_home["Home<br/>feature module"]
  node_module_chatview["Chat View<br/>feature module"]
  node_ui_buttons["Buttons<br/>ui primitive<br/>[button.dart]"]
  node_ui_containers["Containers<br/>ui primitive"]
  node_ui_gradients["Gradients<br/>style tokens<br/>[gradients.dart]"]
  node_ui_colors["Colors<br/>style tokens<br/>[colors.dart]"]
  node_ui_images["Images<br/>asset consts<br/>[images.dart]"]
end

subgraph group_firebase_boundary["Firebase Boundary"]
  node_cloud_functions["Cloud Functions<br/>serverless backend<br/>[index.js]"]
  node_firebase_project["Firebase Project<br/>deployment config<br/>[firebase.json]"]
  node_firebaserc["Project Alias<br/>deployment config<br/>[.firebaserc]"]
  node_firebase_sdk(("Firebase SDK<br/>backend integration"))
end

subgraph group_platform_shells["Platform Shells"]
  node_firebase_native_android["Android Firebase<br/>native config"]
  node_firebase_native_ios["iOS Firebase<br/>native config"]
  node_web_shell["Web Shell<br/>host app<br/>[index.html]"]
end

node_main -->|"initializes"| node_firebase_options
node_main -->|"boots routing"| node_routes_pages
node_main -->|"launches"| node_module_splash
node_routes_pages -->|"uses names"| node_routes_names
node_routes_pages -->|"maps"| node_module_splash
node_routes_pages -->|"maps"| node_module_auth
node_routes_pages -->|"maps"| node_module_home
node_routes_pages -->|"maps"| node_module_chatview
node_module_splash -->|"checks session"| node_service_auth
node_module_auth -->|"signs in"| node_service_auth
node_module_home -->|"tracks status"| node_service_presence
node_module_chatview -->|"notifies"| node_service_notify
node_module_chatview -->|"updates presence"| node_service_presence
node_service_auth -->|"auth api"| node_firebase_sdk
node_service_notify -->|"push api"| node_firebase_sdk
node_service_presence -->|"presence api"| node_firebase_sdk
node_firebase_options -->|"configures"| node_firebase_sdk
node_firebase_native_android -->|"native setup"| node_firebase_sdk
node_firebase_native_ios -->|"native setup"| node_firebase_sdk
node_cloud_functions -->|"extends"| node_firebase_sdk
node_cloud_functions -->|"triggers"| node_service_notify
node_cloud_functions -->|"syncs"| node_service_presence
node_ui_buttons -->|"supports"| node_module_auth
node_ui_containers -->|"supports"| node_module_home
node_ui_gradients -->|"pairs with"| node_ui_colors
node_ui_images -->|"assets for"| node_module_splash
node_firebase_project -->|"deploys"| node_cloud_functions
node_firebaserc -->|"targets"| node_firebase_project
node_web_shell -->|"hosts"| node_main

click node_main "https://github.com/neetukumari-123/realtime_chat/blob/main/lib/main.dart"
click node_firebase_options "https://github.com/neetukumari-123/realtime_chat/blob/main/lib/firebase_options.dart"
click node_routes_pages "https://github.com/neetukumari-123/realtime_chat/blob/main/lib/app/routes/app_pages.dart"
click node_routes_names "https://github.com/neetukumari-123/realtime_chat/blob/main/lib/app/routes/app_routes.dart"
click node_service_auth "https://github.com/neetukumari-123/realtime_chat/blob/main/lib/app/services/auth_service.dart"
click node_service_notify "https://github.com/neetukumari-123/realtime_chat/blob/main/lib/app/services/notification_service.dart"
click node_service_presence "https://github.com/neetukumari-123/realtime_chat/blob/main/lib/app/services/presence_service.dart"
click node_module_splash "https://github.com/neetukumari-123/realtime_chat/tree/main/lib/app/modules/splash"
click node_module_auth "https://github.com/neetukumari-123/realtime_chat/tree/main/lib/app/modules/auth"
click node_module_home "https://github.com/neetukumari-123/realtime_chat/tree/main/lib/app/modules/home"
click node_module_chatview "https://github.com/neetukumari-123/realtime_chat/tree/main/lib/app/modules/chatview"
click node_ui_buttons "https://github.com/neetukumari-123/realtime_chat/blob/main/lib/app/utils/common/buttons/button.dart"
click node_ui_containers "https://github.com/neetukumari-123/realtime_chat/blob/main/lib/app/utils/common/containers/circular_container.dart"
click node_ui_gradients "https://github.com/neetukumari-123/realtime_chat/blob/main/lib/app/utils/common/styles/gradients.dart"
click node_ui_colors "https://github.com/neetukumari-123/realtime_chat/blob/main/lib/app/utils/consts/colors.dart"
click node_ui_images "https://github.com/neetukumari-123/realtime_chat/blob/main/lib/app/utils/consts/images.dart"
click node_firebase_native_android "https://github.com/neetukumari-123/realtime_chat/blob/main/android/app/google-services.json"
click node_firebase_native_ios "https://github.com/neetukumari-123/realtime_chat/blob/main/ios/Runner/GoogleService-Info.plist"
click node_web_shell "https://github.com/neetukumari-123/realtime_chat/blob/main/web/index.html"
click node_cloud_functions "https://github.com/neetukumari-123/realtime_chat/blob/main/functions/index.js"
click node_firebase_project "https://github.com/neetukumari-123/realtime_chat/blob/main/firebase.json"
click node_firebaserc "https://github.com/neetukumari-123/realtime_chat/blob/main/.firebaserc"

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_firebase_options,node_routes_pages,node_routes_names,node_service_auth,node_service_notify,node_service_presence,node_module_splash,node_module_auth,node_module_home,node_module_chatview,node_ui_buttons,node_ui_containers,node_ui_gradients,node_ui_colors,node_ui_images toneBlue
class node_cloud_functions,node_firebase_project,node_firebaserc,node_firebase_sdk toneAmber
class node_firebase_native_android,node_firebase_native_ios,node_web_shell toneMint
```

## Components

### Flutter Client

Cross-platform Flutter app code, feature modules, routing, services, and shared UI primitives.

- [Main](https://github.com/neetukumari-123/realtime_chat/blob/main/lib/main.dart): app entry · Bootstraps Flutter app startup and initialization. · `lib/main.dart`
- [Firebase Options](https://github.com/neetukumari-123/realtime_chat/blob/main/lib/firebase_options.dart): firebase config · FlutterFire configuration used to initialize Firebase across platforms. · `lib/firebase_options.dart`
- [Route Pages](https://github.com/neetukumari-123/realtime_chat/blob/main/lib/app/routes/app_pages.dart): routing · Central route table for app navigation and startup flow. · `lib/app/routes/app_pages.dart`
- [Route Names](https://github.com/neetukumari-123/realtime_chat/blob/main/lib/app/routes/app_routes.dart): routing · Named route constants used by the app router. · `lib/app/routes/app_routes.dart`
- [Auth Service](https://github.com/neetukumari-123/realtime_chat/blob/main/lib/app/services/auth_service.dart): service · Session and identity boundary between UI controllers and Firebase auth. · `lib/app/services/auth_service.dart`
- [Notify Service](https://github.com/neetukumari-123/realtime_chat/blob/main/lib/app/services/notification_service.dart): service · Push notification integration and delivery logic. · `lib/app/services/notification_service.dart`
- [Presence Service](https://github.com/neetukumari-123/realtime_chat/blob/main/lib/app/services/presence_service.dart): service · Online/offline presence state and backend synchronization. · `lib/app/services/presence_service.dart`
- [Splash](https://github.com/neetukumari-123/realtime_chat/tree/main/lib/app/modules/splash): feature module · Startup flow that checks session state and routes onward. · `lib/app/modules/splash`
- [Auth](https://github.com/neetukumari-123/realtime_chat/tree/main/lib/app/modules/auth): feature module · Sign-in and sign-out experience with module-specific state. · `lib/app/modules/auth`
- [Home](https://github.com/neetukumari-123/realtime_chat/tree/main/lib/app/modules/home): feature module · Signed-in landing area and main chat context. · `lib/app/modules/home`
- [Chat View](https://github.com/neetukumari-123/realtime_chat/tree/main/lib/app/modules/chatview): feature module · Live conversation screen and message interaction flow. · `lib/app/modules/chatview`
- [Buttons](https://github.com/neetukumari-123/realtime_chat/blob/main/lib/app/utils/common/buttons/button.dart): ui primitive · Reusable button styling and shared button widgets. · `lib/app/utils/common/buttons/button.dart`
- [Containers](https://github.com/neetukumari-123/realtime_chat/blob/main/lib/app/utils/common/containers/circular_container.dart): ui primitive · Reusable container components for layout composition. · `lib/app/utils/common/containers/circular_container.dart`
- [Gradients](https://github.com/neetukumari-123/realtime_chat/blob/main/lib/app/utils/common/styles/gradients.dart): style tokens · Shared gradient definitions used across screens. · `lib/app/utils/common/styles/gradients.dart`
- [Colors](https://github.com/neetukumari-123/realtime_chat/blob/main/lib/app/utils/consts/colors.dart): style tokens · Central color palette for the app UI. · `lib/app/utils/consts/colors.dart`
- [Images](https://github.com/neetukumari-123/realtime_chat/blob/main/lib/app/utils/consts/images.dart): asset consts · Image and asset constant definitions. · `lib/app/utils/consts/images.dart`

### Firebase Boundary

Firebase configuration and backend-facing integration points, including cloud functions.

- [Cloud Functions](https://github.com/neetukumari-123/realtime_chat/blob/main/functions/index.js): serverless backend · Node.js Firebase Cloud Functions runtime for server-side automation. · `functions/index.js`
- [Firebase Project](https://github.com/neetukumari-123/realtime_chat/blob/main/firebase.json): deployment config · Repository-level Firebase project and deployment configuration. · `firebase.json`
- [Project Alias](https://github.com/neetukumari-123/realtime_chat/blob/main/.firebaserc): deployment config · Firebase project alias and workspace mapping. · `.firebaserc`
- **Firebase SDK**: backend integration · External Firebase services consumed by the Flutter client and functions.

### Platform Shells

Generated host projects and native Firebase configuration used to run the Flutter app on each target platform.

- [Android Firebase](https://github.com/neetukumari-123/realtime_chat/blob/main/android/app/google-services.json): native config · Android Firebase service configuration for FlutterFire. · `android/app/google-services.json`
- [iOS Firebase](https://github.com/neetukumari-123/realtime_chat/blob/main/ios/Runner/GoogleService-Info.plist): native config · iOS Firebase service configuration for FlutterFire. · `ios/Runner/GoogleService-Info.plist`
- [Web Shell](https://github.com/neetukumari-123/realtime_chat/blob/main/web/index.html): host app · Web target host entrypoint and manifest shell. · `web/index.html`

## Connections

- Main → Firebase Options: initializes · App startup uses generated Firebase options to connect FlutterFire.
- Main → Route Pages: boots routing · Entry point starts the routed application shell.
- Main → Splash: launches · Startup flow begins in the splash module.
- Route Pages → Route Names: uses names · Route definitions depend on named route constants.
- Route Pages → Splash: maps · Routes map the splash screen as the first entry.
- Route Pages → Auth: maps · Navigation sends unauthenticated users to auth.
- Route Pages → Home: maps · Navigation sends authenticated users to home.
- Route Pages → Chat View: maps · Navigation exposes the live chat screen.
- Splash → Auth Service: checks session · Splash controller consults auth state before routing onward.
- Auth → Auth Service: signs in · Auth module relies on the auth service for identity operations.
- Home → Presence Service: tracks status · Home module coordinates presence state for the signed-in user.
- Chat View → Notify Service: notifies · Chat experience integrates notification behavior.
- Chat View → Presence Service: updates presence · Conversation screen reflects and updates online state.
- Auth Service → Firebase SDK: auth api · Authentication service talks to Firebase through SDK integrations.
- Notify Service → Firebase SDK: push api · Notification service depends on Firebase delivery services.
- Presence Service → Firebase SDK: presence api · Presence service synchronizes state via Firebase-backed infrastructure.
- Firebase Options → Firebase SDK: configures · Generated options bind the app to Firebase projects and apps.
- Android Firebase → Firebase SDK: native setup · Android native config enables Firebase initialization on mobile.
- iOS Firebase → Firebase SDK: native setup · iOS native config enables Firebase initialization on mobile.
- Cloud Functions → Firebase SDK: extends · Serverless functions provide backend automation on top of Firebase.
- Cloud Functions → Notify Service: triggers · Backend events can drive notification-related workflows.
- Cloud Functions → Presence Service: syncs · Backend logic can participate in presence updates.
- Buttons → Auth: supports · Shared UI primitives are composed within feature screens.
- Containers → Home: supports · Reusable layout components support screen composition.
- Gradients → Colors: pairs with · Gradients and palette tokens form the shared visual system.
- Images → Splash: assets for · Splash and other screens use shared asset constants.
- Firebase Project → Cloud Functions: deploys · Repository-level Firebase config includes serverless deployment.
- Project Alias → Firebase Project: targets · Project aliasing feeds deployment configuration.
- Web Shell → Main: hosts · Web target boots the shared Flutter entrypoint.
