# choyon-sarker/ki-kinbo architecture

> Architecture diagram of the GitHub repository choyon-sarker/ki-kinbo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/choyon-sarker/ki-kinbo
- Repository: https://github.com/choyon-sarker/ki-kinbo

## Overview

1. **Overall shape**
   - This is a single-module Android app (`app`) named **Ki Kinbo!**, organized around **MVVM**.
   - The codebase is mostly client-side; there is **no separate server/backend module**. Data persistence and authentication are intended to run through **Firebase**.

2. **Presentation layer**
   - The UI is split across a small set of Android screens:
     - `MainActivity`
     - `SelectItemsView`
     - `PlaceOrderView`
     - layouts also exist for `SearchProduct`, `PaymentMethod`, and `ViewProduct`
   - UI rendering is backed by XML layouts and a RecyclerView adapter (`SearchProductAdapter`) for product lists.

3. **ViewModel layer**
   - The app’s business logic is concentrated in ViewModels:
     - `ProductSearchViewModel` handles product filtering/search.
     - `SelectItemsViewModel` handles order processing / cart-to-order flow.
     - `PlaceOrderViewModel` validates order input, stock, and user/address rules.
     - `PushProductData` and `PushUserData` appear to be data ingestion/sync ViewModels.
     - `SearchProduct` is likely a smaller search-related ViewModel/helper.
   - This layer is the main boundary between UI and data sources.

4. **Domain model**
   - Core entities live under `model/`:
     - `ProductDataModel`
     - `OrderDataModel`
     - `OrderItemDataModel`
     - `UserDataModel`
     - `ShippingAddressDataModel`
     - `ProductStockInto`
     - `PaymentMethod`
   - These types define the app’s business data and likely flow unchanged between ViewModels, repository/data-store, and Firebase.

5. **Repository / data-source layer**
   - The repository boundary is explicit in `model/repository/`:
     - `ProductRepository`
     - `DummyDataStore`
     - `DummyProductInfoDataStore`
     - `DummyUserInfoDataStore`
   - The “dummy” stores indicate the app currently uses in-memory or sample data sources for development/testing and documentation, with the repository acting as the abstraction point for swapping in real persistence.

6. **Primary data flows**
   - **Browse/search flow:** user enters a search or category filter in the UI → `ProductSearchViewModel` → repository/data store → product list returned to the RecyclerView adapter.
   - **Order flow:** selected items and user/shipping details go to `SelectItemsViewModel` / `PlaceOrderViewModel` → validation against stock and user/address rules → order creation or rejection.
   - **Data seeding/sync flow:** `PushProductData` and `PushUserData` likely push reference data into the app’s storage layer or Firebase.

7. **Firebase boundary**
   - The repo includes `google-services.json`, so Firebase is a first-class external dependency.
   - The README describes Firebase Authentication and database usage; the generated docs also show `MainActivity` interacting with database references.
   - Architecturally, Firebase is the external service boundary for auth and persistence, while the app code remains organized around MVVM and repositories.

8. **Testing boundary**
   - Unit tests exist for the ViewModel layer:
     - `PlaceOrderViewModelTest`
     - `ProductSearchViewModelTest`
   - There is also an Android instrumented test scaffold under `androidTest`.
   - This indicates the logic-heavy parts of the app are intended to be tested above the UI layer, which is consistent with MVVM.

9. **Build and delivery tooling**
   - The project uses **Gradle Kotlin DSL** and Android Studio conventions.
   - A GitHub Actions workflow exists at `.github/workflows/AndroidBuild.yml`, so CI is part of the delivery pipeline.
   - `proguard-rules.pro` and standard Android resource folders indicate a conventional Android release setup.

10. **Documentation and design assets**
   - The `documentation/html` tree is generated API documentation, likely from **Dokka**.
   - The `Resources/` folder contains architecture and process PDFs (MVC, MVVM, CQRS, testing reports, sprint docs), which are project artifacts rather than runtime components.
   - For an architecture diagram, these are supporting artifacts, not runtime subsystems.

11. **Key architectural takeaway**
   - The repo is best diagrammed as:
     - **UI screens/adapters**
     - → **ViewModels**
     - → **repository / dummy data stores**
     - → **Firebase**
   - The main separation is between **presentation**, **business logic**, and **data access**, with ViewModels as the central orchestration point.

Main entry points: [`app/src/main/java/com/devdroid/kikinbo/model/repository/ProductRepository.kt`](https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/model/repository/ProductRepository.kt) (Product Repo), [`app/src/main/java/com/devdroid/kikinbo/viewmodel/PlaceOrderViewModel.kt`](https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/viewmodel/PlaceOrderViewModel.kt) (Place Order VM), [`app/src/main/java/com/devdroid/kikinbo/model/repository/DummyDataStore.kt`](https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/model/repository/DummyDataStore.kt) (Dummy Store), [`app/src/main/java/com/devdroid/kikinbo/view/MainActivity.kt`](https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/view/MainActivity.kt) (MainActivity)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["UI"]
  node_main_activity["MainActivity<br/>[MainActivity.kt]"]
  node_select_items_view["Select Items<br/>screen<br/>[SelectItemsView.kt]"]
  node_place_order_view["Place Order<br/>screen<br/>[PlaceOrderView.kt]"]
  node_search_adapter["Search List<br/>adapter"]
end

subgraph group_viewmodels["ViewModels"]
  node_product_search_vm{{"Product Search<br/>ViewModel"}}
  node_select_items_vm{{"Select Items VM<br/>ViewModel"}}
  node_place_order_vm{{"Place Order VM<br/>ViewModel"}}
  node_push_product_vm{{"Push Product<br/>sync vm<br/>[PushProductData.kt]"}}
  node_push_user_vm{{"Push User<br/>sync vm<br/>[PushUserData.kt]"}}
  node_search_product_vm{{"Search Product<br/>helper vm<br/>[SearchProduct.kt]"}}
end

subgraph group_data["Data"]
  node_product_models["Products<br/>domain models"]
  node_order_models["Orders<br/>domain models<br/>[OrderDataModel.kt]"]
  node_user_models["Users<br/>domain models<br/>[UserDataModel.kt]"]
  node_payment_method(("Payment Method<br/>domain enum<br/>[PaymentMethod.kt]"))
  node_product_repository[("Product Repo")]
  node_dummy_datastore[("Dummy Store<br/>data store<br/>[DummyDataStore.kt]")]
  node_dummy_product_store[("Product Data<br/>data store")]
  node_dummy_user_store[("User Data<br/>data store")]
end

subgraph group_external["External"]
  node_firebase[("Firebase<br/>external service")]
  node_ci_build["CI Build<br/>workflow<br/>[AndroidBuild.yml]"]
end

node_main_activity -->|"search UI"| node_product_search_vm
node_main_activity -->|"navigate"| node_select_items_view
node_select_items_view -->|"cart flow"| node_select_items_vm
node_select_items_view -->|"lists products"| node_search_adapter
node_place_order_view -->|"checkout"| node_place_order_vm
node_product_search_vm -->|"queries"| node_product_repository
node_search_product_vm -->|"filters"| node_product_repository
node_select_items_vm -->|"orders"| node_product_repository
node_place_order_vm -->|"validates"| node_product_repository
node_place_order_vm -->|"uses"| node_user_models
node_place_order_vm -->|"creates"| node_order_models
node_product_repository -->|"backs"| node_dummy_datastore
node_dummy_datastore -->|"products"| node_dummy_product_store
node_dummy_datastore -->|"users"| node_dummy_user_store
node_dummy_datastore -->|"orders"| node_order_models
node_dummy_product_store -->|"provides"| node_product_models
node_dummy_user_store -->|"provides"| node_user_models
node_push_product_vm -->|"syncs"| node_firebase
node_push_user_vm -->|"syncs"| node_firebase
node_main_activity -->|"auth/db"| node_firebase
node_ci_build -.->|"builds"| node_main_activity

click node_main_activity "https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/view/MainActivity.kt"
click node_select_items_view "https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/view/SelectItemsView.kt"
click node_place_order_view "https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/view/PlaceOrderView.kt"
click node_search_adapter "https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/view/adapter/SearchProductAdapter.kt"
click node_product_search_vm "https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/viewmodel/ProductSearchViewModel.kt"
click node_select_items_vm "https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/viewmodel/SelectItemsViewModel.kt"
click node_place_order_vm "https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/viewmodel/PlaceOrderViewModel.kt"
click node_push_product_vm "https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/viewmodel/PushProductData.kt"
click node_push_user_vm "https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/viewmodel/PushUserData.kt"
click node_search_product_vm "https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/viewmodel/SearchProduct.kt"
click node_product_models "https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/model/ProductDataModel.kt"
click node_order_models "https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/model/OrderDataModel.kt"
click node_user_models "https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/model/UserDataModel.kt"
click node_payment_method "https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/PaymentMethod.kt"
click node_product_repository "https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/model/repository/ProductRepository.kt"
click node_dummy_datastore "https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/model/repository/DummyDataStore.kt"
click node_dummy_product_store "https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/model/repository/DummyProductInfoDataStore.kt"
click node_dummy_user_store "https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/model/repository/DummyUserInfoDataStore.kt"
click node_firebase "https://github.com/choyon-sarker/ki-kinbo/blob/main/app/google-services.json"
click node_ci_build "https://github.com/choyon-sarker/ki-kinbo/blob/main/.github/workflows/AndroidBuild.yml"

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_activity,node_select_items_view,node_place_order_view,node_search_adapter toneBlue
class node_product_search_vm,node_select_items_vm,node_place_order_vm,node_push_product_vm,node_push_user_vm,node_search_product_vm toneAmber
class node_product_models,node_order_models,node_user_models,node_payment_method,node_product_repository,node_dummy_datastore,node_dummy_product_store,node_dummy_user_store toneMint
class node_firebase,node_ci_build toneRose
```

## Components

### UI

Activities, screens, and adapter-driven presentation

- [MainActivity](https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/view/MainActivity.kt): activity · App entry screen and database-facing host · `app/src/main/java/com/devdroid/kikinbo/view/MainActivity.kt`
- [Select Items](https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/view/SelectItemsView.kt): screen · Item selection and cart flow screen · `app/src/main/java/com/devdroid/kikinbo/view/SelectItemsView.kt`
- [Place Order](https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/view/PlaceOrderView.kt): screen · Order submission and checkout screen · `app/src/main/java/com/devdroid/kikinbo/view/PlaceOrderView.kt`
- [Search List](https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/view/adapter/SearchProductAdapter.kt): adapter · RecyclerView adapter for product search results · `app/src/main/java/com/devdroid/kikinbo/view/adapter/SearchProductAdapter.kt`

### ViewModels

State, validation, and use-case orchestration

- [Product Search](https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/viewmodel/ProductSearchViewModel.kt): ViewModel · Filters and searches products · `app/src/main/java/com/devdroid/kikinbo/viewmodel/ProductSearchViewModel.kt`
- [Select Items VM](https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/viewmodel/SelectItemsViewModel.kt): ViewModel · Processes selected items into order intent · `app/src/main/java/com/devdroid/kikinbo/viewmodel/SelectItemsViewModel.kt`
- [Place Order VM](https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/viewmodel/PlaceOrderViewModel.kt): ViewModel · Validates order, stock, and user rules · `app/src/main/java/com/devdroid/kikinbo/viewmodel/PlaceOrderViewModel.kt`
- [Push Product](https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/viewmodel/PushProductData.kt): sync vm · Pushes or seeds product data · `app/src/main/java/com/devdroid/kikinbo/viewmodel/PushProductData.kt`
- [Push User](https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/viewmodel/PushUserData.kt): sync vm · Pushes or seeds user data · `app/src/main/java/com/devdroid/kikinbo/viewmodel/PushUserData.kt`
- [Search Product](https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/viewmodel/SearchProduct.kt): helper vm · Secondary search-oriented logic · `app/src/main/java/com/devdroid/kikinbo/viewmodel/SearchProduct.kt`

### Data

Domain models and repository/data-store boundary

- [Products](https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/model/ProductDataModel.kt): domain models · Product and stock entities · `app/src/main/java/com/devdroid/kikinbo/model/ProductDataModel.kt`
- [Orders](https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/model/OrderDataModel.kt): domain models · Order and order-item entities · `app/src/main/java/com/devdroid/kikinbo/model/OrderDataModel.kt`
- [Users](https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/model/UserDataModel.kt): domain models · User and shipping address entities · `app/src/main/java/com/devdroid/kikinbo/model/UserDataModel.kt`
- [Payment Method](https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/PaymentMethod.kt): domain enum · Payment method type · `app/src/main/java/com/devdroid/kikinbo/PaymentMethod.kt`
- [Product Repo](https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/model/repository/ProductRepository.kt): repository · Repository boundary for product and order data · `app/src/main/java/com/devdroid/kikinbo/model/repository/ProductRepository.kt`
- [Dummy Store](https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/model/repository/DummyDataStore.kt): data store · In-memory sample data and order/user fixtures · `app/src/main/java/com/devdroid/kikinbo/model/repository/DummyDataStore.kt`
- [Product Data](https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/model/repository/DummyProductInfoDataStore.kt): data store · Sample product source · `app/src/main/java/com/devdroid/kikinbo/model/repository/DummyProductInfoDataStore.kt`
- [User Data](https://github.com/choyon-sarker/ki-kinbo/blob/main/app/src/main/java/com/devdroid/kikinbo/model/repository/DummyUserInfoDataStore.kt): data store · Sample user source · `app/src/main/java/com/devdroid/kikinbo/model/repository/DummyUserInfoDataStore.kt`

### External

Firebase and delivery tooling

- [Firebase](https://github.com/choyon-sarker/ki-kinbo/blob/main/app/google-services.json): external service · Authentication and persistence boundary · `app/google-services.json`
- [CI Build](https://github.com/choyon-sarker/ki-kinbo/blob/main/.github/workflows/AndroidBuild.yml): workflow · GitHub Actions Android build pipeline · `.github/workflows/AndroidBuild.yml`

## Connections

- MainActivity → Product Search: search UI · Main screen drives product browsing and lookup
- MainActivity → Select Items: navigate · Entry screen leads into item selection
- Select Items → Select Items VM: cart flow · Selection screen delegates order preparation
- Select Items → Search List: lists products · Screen renders product results through the adapter
- Place Order → Place Order VM: checkout · Order screen delegates validation and submission
- Product Search → Product Repo: queries · Search logic reads products through repository
- Search Product → Product Repo: filters · Secondary search helper also consults repository data
- Select Items VM → Product Repo: orders · Order preparation uses repository data
- Place Order VM → Product Repo: validates · Checkout logic checks stock and user/order state
- Place Order VM → Users: uses · Validation depends on user and shipping data
- Place Order VM → Orders: creates · Successful checkout produces order entities
- Product Repo → Dummy Store: backs · Repository is backed by sample data store
- Dummy Store → Product Data: products · Sample store includes product fixtures
- Dummy Store → User Data: users · Sample store includes user fixtures
- Dummy Store → Orders: orders · Sample store also carries order-related fixtures
- Product Data → Products: provides · Product fixtures map to domain products
- User Data → Users: provides · User fixtures map to user and address models
- Push Product → Firebase: syncs · Product seed/sync flow targets Firebase
- Push User → Firebase: syncs · User seed/sync flow targets Firebase
- MainActivity → Firebase: auth/db · Main host interacts with Firebase services
- CI Build → MainActivity: builds · CI validates the Android app build
