# emranzz/shopnest architecture

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

- Interactive diagram: https://gitdiagram.com/emranzz/shopnest
- Repository: https://github.com/emranzz/shopnest

## Overview

1. **Project type and runtime**
   - ShopNest is a single-module Android application written in Kotlin.
   - The app UI is built with Jetpack Compose and Material 3, and it targets Android devices only.
   - Firebase is the backend integration point, with `google-services.json` checked into the `app/` module.

2. **Entry point and app bootstrap**
   - `MainActivity.kt` is the app entry point and likely hosts the Compose content.
   - The manifest and resource setup are standard Android app bootstrapping pieces; there is no separate server or desktop runtime.

3. **Presentation layer structure**
   - The UI is split into three clear buckets under `com.example.shopnest`:
     - `components/`: reusable building blocks such as top bars, product cards, cart items, banners, category chips, and order rows.
     - `screen/`: full-page Compose screens for major routes like home, auth, login, signup, product details, categories, checkout, and orders.
     - `pages/`: additional page-level views such as cart, favorites, and profile.
   - This indicates a Compose-first presentation architecture where screens are assembled from reusable components.

4. **Navigation boundary**
   - Navigation is centralized in `navigation/AppNavigation.kt`, with route definitions in `navigation/Screen.kt`.
   - The app likely uses Navigation Compose to switch between auth, catalog, cart, checkout, and profile flows.
   - This is the main boundary controlling how users move between feature areas.

5. **ViewModel and state management**
   - `viewmodel/AuthViewModel.kt` is the only explicit ViewModel in the tree, suggesting authentication state is currently the primary managed business state.
   - The README describes MVVM and reactive state with flows/state, but the repo tree shows that this is still lightweight and mostly centered on auth.
   - UI state is therefore likely owned by screens/ViewModels, while composables remain mostly declarative.

6. **Domain/data models**
   - The `model/` package contains simple data holders for `UserModel`, `ProductModel`, `CategoryModel`, and `OrderModel`.
   - These classes form the app’s shared data contract between Firebase, state holders, and UI rendering.
   - There is no separate repository or use-case layer visible in the tree, so data access appears to be direct or still evolving.

7. **Feature areas reflected in screens**
   - The repository is organized around commerce flows:
     - authentication
     - home/catalog browsing
     - category browsing
     - product details
     - cart and checkout
     - orders
     - profile/favorites
   - Some of these are likely scaffolded ahead of full backend implementation, based on the README’s “work in progress” status.

8. **Shared UI and design system**
   - `ui/theme/Color.kt`, `Theme.kt`, and `Type.kt` define the app’s visual system.
   - This is the main styling boundary for Material 3 consistency across screens.
   - Shared drawables such as rounded corners and launcher assets live in `res/drawable` and `res/mipmap`.

9. **Utilities and helper boundary**
   - `utils/Utils.kt` suggests a small set of cross-cutting helpers rather than a large infrastructure layer.
   - In a diagram, this should be shown as support code consumed by screens, components, or viewmodels rather than as a core subsystem.

10. **Backend integration points**
   - Firebase Authentication is the clearest backend dependency and likely powers login/sign-up and session persistence.
   - Cloud Firestore is mentioned in the README as the product/user/cart data store, although no explicit repository abstraction is present in the tree.
   - This creates an external boundary between the Compose/MVVM app and Firebase services.

11. **Testing and quality gates**
   - The repo includes both JVM unit tests under `app/src/test` and Android instrumented tests under `app/src/androidTest`.
   - This indicates the project is set up for both local logic verification and device/emulator UI testing, even if coverage is minimal today.

12. **Architectural summary for diagramming**
   - The best diagram is: Android app shell at the center, Compose UI on top, Navigation Compose routing between feature screens, a small ViewModel layer for auth/state, shared models beneath, and Firebase services outside the app boundary.
   - The main missing piece compared with the README’s idealized MVVM is a formal repository/data-access layer; the current codebase is closer to a UI-first Compose app with Firebase-backed auth and planned commerce features.

Main entry points: [`app/src/main/java/com/example/shopnest/navigation/AppNavigation.kt`](https://github.com/emranzz/shopnest/blob/master/app/src/main/java/com/example/shopnest/navigation/AppNavigation.kt) (Navigation), [`app/src/main/java/com/example/shopnest/components/TopBar.kt`](https://github.com/emranzz/shopnest/blob/master/app/src/main/java/com/example/shopnest/components/TopBar.kt) (Components), [`app/src/main/java/com/example/shopnest/viewmodel/AuthViewModel.kt`](https://github.com/emranzz/shopnest/blob/master/app/src/main/java/com/example/shopnest/viewmodel/AuthViewModel.kt) (AuthViewModel), [`app/src/main/java/com/example/shopnest/MainActivity.kt`](https://github.com/emranzz/shopnest/blob/master/app/src/main/java/com/example/shopnest/MainActivity.kt) (MainActivity)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Android app"]
  node_main_activity["MainActivity<br/>entry activity<br/>[MainActivity.kt]"]
  node_manifest["Manifest"]
end

subgraph group_presentation["Presentation"]
  node_theme["App theme<br/>compose theme<br/>[Theme.kt]"]
  node_nav["Navigation<br/>route graph<br/>[AppNavigation.kt]"]
  node_screen_routes["Routes<br/>route definitions<br/>[Screen.kt]"]
  node_home_screen["Home<br/>compose screen<br/>[HomeScreen.kt]"]
  node_auth_screens["Auth screens<br/>compose screens<br/>[AuthScreen.kt]"]
  node_catalog_screens["Catalog screens<br/>compose screens"]
  node_commerce_screens["Checkout<br/>compose screens<br/>[CheckoutScreen.kt]"]
  node_pages["Pages<br/>[ProfilePage.kt]"]
  node_components["Components<br/>ui building blocks<br/>[TopBar.kt]"]
end

subgraph group_data["State & data"]
  node_auth_vm["AuthViewModel<br/>[AuthViewModel.kt]"]
  node_models["Models<br/>[ProductModel.kt]"]
  node_utils["Utils<br/>helpers<br/>[Utils.kt]"]
end

subgraph group_backend["Backend"]
  node_firebase_auth[("Firebase Auth<br/>backend auth")]
  node_firestore[("Firestore<br/>backend data")]
end

subgraph group_quality["Quality"]
  node_unit_test["Unit tests<br/>jvm tests<br/>[ExampleUnitTest.kt]"]
  node_android_test["Instrumented tests<br/>android tests"]
end

node_manifest -->|"launches"| node_main_activity
node_main_activity -->|"applies"| node_theme
node_main_activity -->|"hosts"| node_nav
node_nav -->|"uses"| node_screen_routes
node_nav -->|"opens"| node_home_screen
node_nav -->|"opens"| node_auth_screens
node_nav -->|"opens"| node_catalog_screens
node_nav -->|"opens"| node_commerce_screens
node_nav -->|"opens"| node_pages
node_home_screen -->|"composes"| node_components
node_catalog_screens -->|"composes"| node_components
node_commerce_screens -->|"composes"| node_components
node_pages -->|"composes"| node_components
node_auth_screens -->|"observes"| node_auth_vm
node_auth_vm -->|"maps"| node_models
node_auth_vm -->|"authenticates"| node_firebase_auth
node_auth_vm -->|"reads/writes"| node_firestore
node_components -->|"renders"| node_models
node_utils -->|"supports"| node_components
node_utils -->|"supports"| node_auth_vm
node_unit_test -.->|"verifies"| node_models
node_android_test -.->|"verifies"| node_main_activity

click node_main_activity "https://github.com/emranzz/shopnest/blob/master/app/src/main/java/com/example/shopnest/MainActivity.kt"
click node_manifest "https://github.com/emranzz/shopnest/blob/master/app/src/main/AndroidManifest.xml"
click node_theme "https://github.com/emranzz/shopnest/blob/master/app/src/main/java/com/example/shopnest/ui/theme/Theme.kt"
click node_nav "https://github.com/emranzz/shopnest/blob/master/app/src/main/java/com/example/shopnest/navigation/AppNavigation.kt"
click node_screen_routes "https://github.com/emranzz/shopnest/blob/master/app/src/main/java/com/example/shopnest/navigation/Screen.kt"
click node_home_screen "https://github.com/emranzz/shopnest/blob/master/app/src/main/java/com/example/shopnest/screen/HomeScreen.kt"
click node_auth_screens "https://github.com/emranzz/shopnest/blob/master/app/src/main/java/com/example/shopnest/screen/AuthScreen.kt"
click node_catalog_screens "https://github.com/emranzz/shopnest/blob/master/app/src/main/java/com/example/shopnest/screen/ProductCategoriesScreen.kt"
click node_commerce_screens "https://github.com/emranzz/shopnest/blob/master/app/src/main/java/com/example/shopnest/screen/CheckoutScreen.kt"
click node_pages "https://github.com/emranzz/shopnest/blob/master/app/src/main/java/com/example/shopnest/pages/ProfilePage.kt"
click node_components "https://github.com/emranzz/shopnest/blob/master/app/src/main/java/com/example/shopnest/components/TopBar.kt"
click node_auth_vm "https://github.com/emranzz/shopnest/blob/master/app/src/main/java/com/example/shopnest/viewmodel/AuthViewModel.kt"
click node_models "https://github.com/emranzz/shopnest/blob/master/app/src/main/java/com/example/shopnest/model/ProductModel.kt"
click node_utils "https://github.com/emranzz/shopnest/blob/master/app/src/main/java/com/example/shopnest/utils/Utils.kt"
click node_firebase_auth "https://github.com/emranzz/shopnest/blob/master/app/google-services.json"
click node_firestore "https://github.com/emranzz/shopnest/blob/master/app/google-services.json"
click node_unit_test "https://github.com/emranzz/shopnest/blob/master/app/src/test/java/com/example/shopnest/ExampleUnitTest.kt"
click node_android_test "https://github.com/emranzz/shopnest/blob/master/app/src/androidTest/java/com/example/shopnest/ExampleInstrumentedTest.kt"

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_manifest toneBlue
class node_theme,node_nav,node_screen_routes,node_home_screen,node_auth_screens,node_catalog_screens,node_commerce_screens,node_pages,node_components toneAmber
class node_auth_vm,node_models,node_utils toneMint
class node_firebase_auth,node_firestore toneRose
class node_unit_test,node_android_test toneIndigo
```

## Components

### Android app

Android application shell and platform wiring.

- [MainActivity](https://github.com/emranzz/shopnest/blob/master/app/src/main/java/com/example/shopnest/MainActivity.kt): entry activity · Android entry point that hosts the Compose app. · `app/src/main/java/com/example/shopnest/MainActivity.kt`
- [Manifest](https://github.com/emranzz/shopnest/blob/master/app/src/main/AndroidManifest.xml): android manifest · Declares app components and startup configuration. · `app/src/main/AndroidManifest.xml`

### Presentation

Compose UI, navigation, and app screens.

- [App theme](https://github.com/emranzz/shopnest/blob/master/app/src/main/java/com/example/shopnest/ui/theme/Theme.kt): compose theme · Material 3 color, typography, and theme setup. · `app/src/main/java/com/example/shopnest/ui/theme/Theme.kt`
- [Navigation](https://github.com/emranzz/shopnest/blob/master/app/src/main/java/com/example/shopnest/navigation/AppNavigation.kt): route graph · Central route switching between app flows. · `app/src/main/java/com/example/shopnest/navigation/AppNavigation.kt`
- [Routes](https://github.com/emranzz/shopnest/blob/master/app/src/main/java/com/example/shopnest/navigation/Screen.kt): route definitions · Named destinations used by the navigation layer. · `app/src/main/java/com/example/shopnest/navigation/Screen.kt`
- [Home](https://github.com/emranzz/shopnest/blob/master/app/src/main/java/com/example/shopnest/screen/HomeScreen.kt): compose screen · Primary catalog landing screen. · `app/src/main/java/com/example/shopnest/screen/HomeScreen.kt`
- [Auth screens](https://github.com/emranzz/shopnest/blob/master/app/src/main/java/com/example/shopnest/screen/AuthScreen.kt): compose screens · Authentication flow screens for login, sign-up, and auth gate. · `app/src/main/java/com/example/shopnest/screen/AuthScreen.kt`
- [Catalog screens](https://github.com/emranzz/shopnest/blob/master/app/src/main/java/com/example/shopnest/screen/ProductCategoriesScreen.kt): compose screens · Category browsing and product detail views. · `app/src/main/java/com/example/shopnest/screen/ProductCategoriesScreen.kt`
- [Checkout](https://github.com/emranzz/shopnest/blob/master/app/src/main/java/com/example/shopnest/screen/CheckoutScreen.kt): compose screens · Purchase and order flow screens. · `app/src/main/java/com/example/shopnest/screen/CheckoutScreen.kt`
- [Pages](https://github.com/emranzz/shopnest/blob/master/app/src/main/java/com/example/shopnest/pages/ProfilePage.kt): compose pages · Higher-level account and collection pages. · `app/src/main/java/com/example/shopnest/pages/ProfilePage.kt`
- [Components](https://github.com/emranzz/shopnest/blob/master/app/src/main/java/com/example/shopnest/components/TopBar.kt): ui building blocks · Reusable Compose widgets shared across screens. · `app/src/main/java/com/example/shopnest/components/TopBar.kt`

### State & data

Models, viewmodels, and shared helpers.

- [AuthViewModel](https://github.com/emranzz/shopnest/blob/master/app/src/main/java/com/example/shopnest/viewmodel/AuthViewModel.kt): viewmodel · Reactive auth state and user-session handling. · `app/src/main/java/com/example/shopnest/viewmodel/AuthViewModel.kt`
- [Models](https://github.com/emranzz/shopnest/blob/master/app/src/main/java/com/example/shopnest/model/ProductModel.kt): domain models · Shared app data contracts for users, products, categories, and orders. · `app/src/main/java/com/example/shopnest/model/ProductModel.kt`
- [Utils](https://github.com/emranzz/shopnest/blob/master/app/src/main/java/com/example/shopnest/utils/Utils.kt): helpers · Cross-cutting helper functions used by UI and state code. · `app/src/main/java/com/example/shopnest/utils/Utils.kt`

### Backend

Firebase services used by the app.

- [Firebase Auth](https://github.com/emranzz/shopnest/blob/master/app/google-services.json): backend auth · External authentication provider for sign-in and sign-up. · `app/google-services.json`
- [Firestore](https://github.com/emranzz/shopnest/blob/master/app/google-services.json): backend data · Cloud datastore for products, users, carts, and orders. · `app/google-services.json`

### Quality

Test coverage and verification hooks.

- [Unit tests](https://github.com/emranzz/shopnest/blob/master/app/src/test/java/com/example/shopnest/ExampleUnitTest.kt): jvm tests · Local JVM tests for logic verification. · `app/src/test/java/com/example/shopnest/ExampleUnitTest.kt`
- [Instrumented tests](https://github.com/emranzz/shopnest/blob/master/app/src/androidTest/java/com/example/shopnest/ExampleInstrumentedTest.kt): android tests · Device or emulator test entry point. · `app/src/androidTest/java/com/example/shopnest/ExampleInstrumentedTest.kt`

## Connections

- Manifest → MainActivity: launches · Declares the activity that starts the app.
- MainActivity → App theme: applies · Sets the app-wide Compose theme.
- MainActivity → Navigation: hosts · Runs the navigation graph inside the activity.
- Navigation → Routes: uses · Resolves destinations from route definitions.
- Navigation → Home: opens · Routes users into the home flow.
- Navigation → Auth screens: opens · Routes users into authentication screens.
- Navigation → Catalog screens: opens · Routes users into browsing and detail screens.
- Navigation → Checkout: opens · Routes users into checkout and order flows.
- Navigation → Pages: opens · Routes users into profile and saved-content pages.
- Home → Components: composes · Builds the landing page from shared UI pieces.
- Catalog screens → Components: composes · Uses reusable cards, chips, and banners.
- Checkout → Components: composes · Reuses cart and order presentation widgets.
- Pages → Components: composes · Shares top bars and row components.
- Auth screens → AuthViewModel: observes · Binds authentication UI to reactive state.
- AuthViewModel → Models: maps · Converts backend state into app data models.
- AuthViewModel → Firebase Auth: authenticates · Creates and validates user sessions.
- AuthViewModel → Firestore: reads/writes · Persists or loads user-related records.
- Components → Models: renders · Displays product, category, cart, and order data.
- Utils → Components: supports · Provides shared helper logic to UI code.
- Utils → AuthViewModel: supports · Provides cross-cutting helper logic to state code.
- Unit tests → Models: verifies · Checks core data-related behavior.
- Instrumented tests → MainActivity: verifies · Exercises the app entry point on device.
