# synvex/twoareone_flutter architecture

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

- Interactive diagram: https://gitdiagram.com/synvex/twoareone_flutter
- Repository: https://github.com/synvex/twoareone_flutter

## Overview

#### Purpose and entry points
This is a Flutter client for a profile-based matching/social experience: onboarding, authentication, profile setup, location and question collection, profile discovery, favorites, chat, privacy, and settings are represented in the UI and data layers. Flutter starts at `lib/main.dart`; platform shells host it through `android/app/src/main/kotlin/com/example/twoAreOne/app/MainActivity.kt` and `ios/Runner/AppDelegate.swift`.

#### Application composition and navigation
The app is organized as a layered Flutter application:
- Shared UI primitives, styling, errors, and route definitions reside in `lib/core/` and `lib/core/routes/routes.dart`.
- User-facing screens are grouped by feature under `lib/ui/views/`.
- Feature state is partially represented by view models under `lib/ui/viewmodels/`.
Routing is a key control boundary between authentication, onboarding/setup, main flow, and secondary screens.

#### Authentication and account recovery
Authentication screens support login, signup, OTP verification, password recovery, and reset/failure states:
- `lib/ui/views/auth/login.dart`
- `lib/ui/views/auth/sign_up.dart`
- `lib/ui/views/auth/email_otp_verification.dart`
Network-facing account operations are centralized in `lib/data/services/auth_service.dart`, separating credential flows from widgets.

#### Profile onboarding and editable identity
The initial user-data collection flow appears to combine location selection, profile setup, questions, and video:
- `lib/ui/views/main/main_screen.dart`
- `lib/ui/views/main/profile_setup_screen.dart`
- `lib/ui/views/main/question_screen.dart`
- `lib/ui/views/main/location_selector.dart`
Domain models for user identity, full profiles, locations, questions, and matching criteria live in `lib/data/models/user_info.dart`, `lib/data/models/user_full_profile.dart`, and `lib/data/models/seeking.dart`. This is the boundary where form/UI data becomes service payloads.

#### Discovery, matching, and engagement
The primary post-setup experience is bottom-navigation-based, spanning home/discovery, favorites, profile, and chat:
- `lib/ui/views/bottom_nav/custom_nav_bar.dart`
- `lib/ui/views/bottom_nav/home_screen.dart`
- `lib/ui/views/bottom_nav/favourite_screen.dart`
Discovery includes filtering, profile cards/details, question editing, and full-screen/inline video presentation in `lib/ui/views/home/`. Matching/profile retrieval is represented by `lib/data/services/home_service.dart`, `lib/data/services/profiles_services.dart`, and `lib/data/models/user_match_model.dart`; favorites are isolated in `lib/data/services/fav_services.dart`.

#### API, state, and error boundary
Remote integration is concentrated in the data-services layer. `lib/data/services/Api_Helper/api_manager.dart` is the likely common HTTP execution boundary, while `lib/data/end_points.dart` defines service targets and `lib/core/Error/api_error.dart` provides an application error representation. Feature services—such as `lib/data/services/question_service.dart` and `lib/data/services/setting.dart`—should depend on this shared API layer rather than widgets directly. Fetch-oriented UI state is anchored by `lib/ui/viewmodels/base_fetch_view_model.dart`.

#### Runtime and external infrastructure
The project targets Android, iOS, and web through Flutter (`android/`, `ios/`, `web/`). Firebase is materially configured via `lib/firebase_options.dart`, `android/app/google-services.json`, and `firebase.json`; the exact Firebase products used are not established by the supplied tree. Static visual and animation assets are bundled under `assets/`, including JSON animation resources in `assets/jsonImg/`.

Main entry points: [`lib/data/services/Api_Helper/api_manager.dart`](https://github.com/synvex/twoareone_flutter/blob/main/lib/data/services/Api_Helper/api_manager.dart) (API manager), [`lib/main.dart`](https://github.com/synvex/twoareone_flutter/blob/main/lib/main.dart) (Flutter entry point), [`lib/core/routes/routes.dart`](https://github.com/synvex/twoareone_flutter/blob/main/lib/core/routes/routes.dart) (Route control), [`lib/ui/views/main/profile_setup_screen.dart`](https://github.com/synvex/twoareone_flutter/blob/main/lib/ui/views/main/profile_setup_screen.dart) (Profile setup flow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_android["Android shell<br/>platform host<br/>[MainActivity.kt]"]
  node_ios["iOS shell<br/>platform host<br/>[AppDelegate.swift]"]
  node_firebase{{"Firebase configuration<br/>external infrastructure"}}
end

subgraph group_client["Flutter client"]
  node_main["Flutter entry point<br/>application bootstrap<br/>[main.dart]"]
  node_core["Core UI and shared utilities<br/>shared layer<br/>[app_colors.dart]"]
  node_routes["Route control<br/>navigation<br/>[routes.dart]"]
  node_auth_ui["Authentication screens<br/>feature UI<br/>[login.dart]"]
  node_setup_ui["Profile setup flow<br/>feature UI"]
  node_main_flow["Main flow<br/>feature UI<br/>[main_screen.dart]"]
  node_bottom_nav["Bottom navigation<br/>feature UI"]
  node_discovery["Discovery UI<br/>feature UI"]
  node_viewmodels["Fetch view-model base<br/>UI state"]
end

subgraph group_data["Data layer"]
  node_identity_models["Profile and seeking models<br/>domain models<br/>[user_info.dart]"]
  node_match_models["Match models<br/>domain models"]
  node_auth_service["Authentication service<br/>account API service<br/>[auth_service.dart]"]
  node_profile_services["Profile and discovery services<br/>feature API services<br/>[home_service.dart]"]
  node_favorites_service["Favorites service<br/>feature API service<br/>[fav_services.dart]"]
  node_feature_services["Questions and settings services<br/>feature API services"]
  node_api_manager{{"API manager<br/>HTTP boundary<br/>[api_manager.dart]"}}
  node_endpoints["API endpoints<br/>service targets<br/>[end_points.dart]"]
  node_api_error["API error model<br/>error boundary<br/>[api_error.dart]"]
end

node_android -->|"hosts"| node_main
node_ios -->|"hosts"| node_main
node_main -->|"initializes"| node_core
node_main -->|"uses"| node_routes
node_main -->|"loads configuration"| node_firebase
node_routes -->|"routes to"| node_auth_ui
node_routes -->|"routes to"| node_setup_ui
node_routes -->|"routes to"| node_main_flow
node_main_flow -->|"contains"| node_bottom_nav
node_bottom_nav -->|"opens"| node_discovery
node_auth_ui -->|"authenticates through"| node_auth_service
node_setup_ui -->|"collects"| node_identity_models
node_setup_ui -->|"submits through"| node_feature_services
node_discovery -->|"uses state"| node_viewmodels
node_viewmodels -->|"fetches through"| node_profile_services
node_profile_services -->|"returns"| node_match_models
node_bottom_nav -->|"manages favorites through"| node_favorites_service
node_auth_service -->|"uses"| node_api_manager
node_profile_services -->|"uses"| node_api_manager
node_favorites_service -->|"uses"| node_api_manager
node_feature_services -->|"uses"| node_api_manager
node_api_manager -->|"targets"| node_endpoints
node_api_manager -->|"maps failures to"| node_api_error

click node_android "https://github.com/synvex/twoareone_flutter/blob/main/android/app/src/main/kotlin/com/example/twoAreOne/app/MainActivity.kt"
click node_ios "https://github.com/synvex/twoareone_flutter/blob/main/ios/Runner/AppDelegate.swift"
click node_main "https://github.com/synvex/twoareone_flutter/blob/main/lib/main.dart"
click node_firebase "https://github.com/synvex/twoareone_flutter/blob/main/lib/firebase_options.dart"
click node_core "https://github.com/synvex/twoareone_flutter/blob/main/lib/core/app_colors.dart"
click node_routes "https://github.com/synvex/twoareone_flutter/blob/main/lib/core/routes/routes.dart"
click node_auth_ui "https://github.com/synvex/twoareone_flutter/blob/main/lib/ui/views/auth/login.dart"
click node_setup_ui "https://github.com/synvex/twoareone_flutter/blob/main/lib/ui/views/main/profile_setup_screen.dart"
click node_main_flow "https://github.com/synvex/twoareone_flutter/blob/main/lib/ui/views/main/main_screen.dart"
click node_bottom_nav "https://github.com/synvex/twoareone_flutter/blob/main/lib/ui/views/bottom_nav/custom_nav_bar.dart"
click node_discovery "https://github.com/synvex/twoareone_flutter/blob/main/lib/ui/views/home/profile_details_screen.dart"
click node_viewmodels "https://github.com/synvex/twoareone_flutter/blob/main/lib/ui/viewmodels/base_fetch_view_model.dart"
click node_identity_models "https://github.com/synvex/twoareone_flutter/blob/main/lib/data/models/user_info.dart"
click node_match_models "https://github.com/synvex/twoareone_flutter/blob/main/lib/data/models/user_match_model.dart"
click node_auth_service "https://github.com/synvex/twoareone_flutter/blob/main/lib/data/services/auth_service.dart"
click node_profile_services "https://github.com/synvex/twoareone_flutter/blob/main/lib/data/services/home_service.dart"
click node_favorites_service "https://github.com/synvex/twoareone_flutter/blob/main/lib/data/services/fav_services.dart"
click node_feature_services "https://github.com/synvex/twoareone_flutter/blob/main/lib/data/services/question_service.dart"
click node_api_manager "https://github.com/synvex/twoareone_flutter/blob/main/lib/data/services/Api_Helper/api_manager.dart"
click node_endpoints "https://github.com/synvex/twoareone_flutter/blob/main/lib/data/end_points.dart"
click node_api_error "https://github.com/synvex/twoareone_flutter/blob/main/lib/core/Error/api_error.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_android,node_ios,node_firebase toneBlue
class node_main,node_core,node_routes,node_auth_ui,node_setup_ui,node_main_flow,node_bottom_nav,node_discovery,node_viewmodels toneAmber
class node_identity_models,node_match_models,node_auth_service,node_profile_services,node_favorites_service,node_feature_services,node_api_manager,node_endpoints,node_api_error toneMint
```

## Components

### Runtime

- [Android shell](https://github.com/synvex/twoareone_flutter/blob/main/android/app/src/main/kotlin/com/example/twoAreOne/app/MainActivity.kt): platform host · `android/app/src/main/kotlin/com/example/twoAreOne/app/MainActivity.kt`
- [iOS shell](https://github.com/synvex/twoareone_flutter/blob/main/ios/Runner/AppDelegate.swift): platform host · `ios/Runner/AppDelegate.swift`
- [Firebase configuration](https://github.com/synvex/twoareone_flutter/blob/main/lib/firebase_options.dart): external infrastructure · Configured Firebase products are not identified. · `lib/firebase_options.dart`

### Flutter client

- [Flutter entry point](https://github.com/synvex/twoareone_flutter/blob/main/lib/main.dart): application bootstrap · `lib/main.dart`
- [Core UI and shared utilities](https://github.com/synvex/twoareone_flutter/blob/main/lib/core/app_colors.dart): shared layer · `lib/core/app_colors.dart`
- [Route control](https://github.com/synvex/twoareone_flutter/blob/main/lib/core/routes/routes.dart): navigation · Separates auth, setup, main, and secondary flows. · `lib/core/routes/routes.dart`
- [Authentication screens](https://github.com/synvex/twoareone_flutter/blob/main/lib/ui/views/auth/login.dart): feature UI · Login, signup, OTP, and recovery flows. · `lib/ui/views/auth/login.dart`
- [Profile setup flow](https://github.com/synvex/twoareone_flutter/blob/main/lib/ui/views/main/profile_setup_screen.dart): feature UI · Collects profile, location, questions, and video. · `lib/ui/views/main/profile_setup_screen.dart`
- [Main flow](https://github.com/synvex/twoareone_flutter/blob/main/lib/ui/views/main/main_screen.dart): feature UI · `lib/ui/views/main/main_screen.dart`
- [Bottom navigation](https://github.com/synvex/twoareone_flutter/blob/main/lib/ui/views/bottom_nav/custom_nav_bar.dart): feature UI · Hosts discovery, favorites, profile, and chat. · `lib/ui/views/bottom_nav/custom_nav_bar.dart`
- [Discovery UI](https://github.com/synvex/twoareone_flutter/blob/main/lib/ui/views/home/profile_details_screen.dart): feature UI · Profiles, filters, cards, details, and video presentation. · `lib/ui/views/home/profile_details_screen.dart`
- [Fetch view-model base](https://github.com/synvex/twoareone_flutter/blob/main/lib/ui/viewmodels/base_fetch_view_model.dart): UI state · `lib/ui/viewmodels/base_fetch_view_model.dart`

### Data layer

- [Profile and seeking models](https://github.com/synvex/twoareone_flutter/blob/main/lib/data/models/user_info.dart): domain models · Transforms setup and profile data into service payloads. · `lib/data/models/user_info.dart`
- [Match models](https://github.com/synvex/twoareone_flutter/blob/main/lib/data/models/user_match_model.dart): domain models · `lib/data/models/user_match_model.dart`
- [Authentication service](https://github.com/synvex/twoareone_flutter/blob/main/lib/data/services/auth_service.dart): account API service · `lib/data/services/auth_service.dart`
- [Profile and discovery services](https://github.com/synvex/twoareone_flutter/blob/main/lib/data/services/home_service.dart): feature API services · Retrieves profiles and matching data. · `lib/data/services/home_service.dart`
- [Favorites service](https://github.com/synvex/twoareone_flutter/blob/main/lib/data/services/fav_services.dart): feature API service · `lib/data/services/fav_services.dart`
- [Questions and settings services](https://github.com/synvex/twoareone_flutter/blob/main/lib/data/services/question_service.dart): feature API services · `lib/data/services/question_service.dart`
- [API manager](https://github.com/synvex/twoareone_flutter/blob/main/lib/data/services/Api_Helper/api_manager.dart): HTTP boundary · Common remote execution boundary. · `lib/data/services/Api_Helper/api_manager.dart`
- [API endpoints](https://github.com/synvex/twoareone_flutter/blob/main/lib/data/end_points.dart): service targets · `lib/data/end_points.dart`
- [API error model](https://github.com/synvex/twoareone_flutter/blob/main/lib/core/Error/api_error.dart): error boundary · `lib/core/Error/api_error.dart`

## Connections

- Android shell → Flutter entry point: hosts
- iOS shell → Flutter entry point: hosts
- Flutter entry point → Core UI and shared utilities: initializes
- Flutter entry point → Route control: uses
- Flutter entry point → Firebase configuration: loads configuration
- Route control → Authentication screens: routes to
- Route control → Profile setup flow: routes to
- Route control → Main flow: routes to
- Main flow → Bottom navigation: contains
- Bottom navigation → Discovery UI: opens
- Authentication screens → Authentication service: authenticates through
- Profile setup flow → Profile and seeking models: collects
- Profile setup flow → Questions and settings services: submits through
- Discovery UI → Fetch view-model base: uses state
- Fetch view-model base → Profile and discovery services: fetches through
- Profile and discovery services → Match models: returns
- Bottom navigation → Favorites service: manages favorites through
- Authentication service → API manager: uses
- Profile and discovery services → API manager: uses
- Favorites service → API manager: uses
- Questions and settings services → API manager: uses
- API manager → API endpoints: targets
- API manager → API error model: maps failures to
