# sebasquintero123/mistockerapp architecture

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

- Interactive diagram: https://gitdiagram.com/sebasquintero123/mistockerapp
- Repository: https://github.com/sebasquintero123/mistockerapp

## Overview

**1) Overall shape**
MiStockerApp is a single Android client module built in Kotlin with Jetpack Compose. The repository does not contain a custom server; the app talks directly to Firebase services for identity and persistence. That makes the architecture centered on the UI/navigation layer plus cloud-backed storage and authentication.

**2) App entry point**
`MainActivity.kt` is the Android entry point. Its job is to bootstrap the Compose UI and hand control to the app-level navigation. The manifest and Android resources define the standard Android runtime setup, launcher icon, theme, and app metadata.

**3) Navigation boundary**
`AppNavigation.kt` is the main screen router. It coordinates transitions across the app’s functional areas: login/registration, home dashboard, product management, stock viewing, and sales. For an architecture diagram, this is the hub that connects otherwise separate Compose screens.

**4) Authentication and account lifecycle**
The auth flow is split into dedicated screens:
- `LoginScreen.kt`
- `RegistroScreen.kt`
- `RecuperarScreen.kt`
- `VerificacionScreen.kt`

These screens form the user onboarding and account recovery boundary. The README indicates Firebase Authentication and email verification are used, so this subsystem depends on Firebase rather than local credential storage.

**5) Inventory management subsystem**
Product CRUD lives in the inventory screens:
- `RegistrarProductoScreen.kt`
- `EditarProductoScreen.kt`
- `StockScreen.kt`

This subsystem covers creating, updating, deleting, and listing products. It is the main operational flow for maintaining stock records and likely reads/writes user-scoped product documents in Firestore.

**6) Sales subsystem**
`VentasScreen.kt` handles sales capture, including multi-product sales and sales history per the README. This is a separate business flow from product maintenance, but it likely reuses product data from Firestore to calculate totals, stock impact, and history entries.

**7) Home/dashboard layer**
`HomeScreen.kt` acts as the application landing page after authentication. The README describes it as a financial dashboard with investment, stock, gains, and available units. Architecturally, this screen is an aggregator: it summarizes data from products and sales rather than owning the underlying records.

**8) Data model and persistence**
`Producto.kt` is the primary domain model present in the repo tree. The README shows the Firestore structure as user-scoped collections under `usuarios/{uid}/productos` and `usuarios/{uid}/ventas`. That means data is partitioned by authenticated user, and the app’s persistence boundary is Firebase Firestore. The included `google-services.json` confirms Firebase is wired into the Android app.

**9) External services and device capabilities**
Two external dependencies materially shape the architecture:
- Firebase Authentication for login, registration, password recovery, and verification.
- Firebase Firestore for persistent inventory and sales data.
- Google ML Kit Code Scanner for barcode scanning during product registration.

The barcode scanner is a device-facing capability embedded into the product workflow, not a standalone subsystem.

**10) Shared UI and design system**
`Components.kt` contains reusable Compose UI pieces, while `OldDesignComponents.kt` suggests a legacy component set kept alongside the newer one. The `ui/theme` folder defines color, typography, and theme configuration. This shared presentation layer reduces duplication across the multiple screens.

**11) Project and platform boundaries**
This is a conventional Android Gradle project (`app/build.gradle.kts`, root `build.gradle.kts`, version catalog, wrapper). The architecture is client-side only: UI, navigation, and cloud integration live in the app module. Testing is present via `androidTest` and `test`, but there is no separate backend, API gateway, or domain service layer in the repo.

**12) How the main data flows connect**
Typical flow is:
1. User authenticates through Firebase Authentication.
2. Navigation moves into the home/dashboard.
3. Product screens create/update Firestore product documents.
4. Sales screens read products, register sales, and update related records.
5. Home/dashboard aggregates product and sales data into business summaries.

For a diagram, the strongest boundaries are: Compose UI/screens, navigation, Firebase Auth, Firestore persistence, and the barcode-scanning device integration.

Main entry points: [`app/src/main/java/com/example/mystockerapp/AppNavigation.kt`](https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/java/com/example/mystockerapp/AppNavigation.kt) (Navigation), [`app/src/main/java/com/example/mystockerapp/Components.kt`](https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/java/com/example/mystockerapp/Components.kt) (Components), [`app/src/main/java/com/example/mystockerapp/RegistrarProductoScreen.kt`](https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/java/com/example/mystockerapp/RegistrarProductoScreen.kt) (Registrar Producto), [`app/google-services.json`](https://github.com/sebasquintero123/mistockerapp/blob/main/app/google-services.json) (Firestore)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shell["App Shell"]
  node_main_activity["MainActivity<br/>android entry<br/>[MainActivity.kt]"]
  node_app_navigation{{"Navigation<br/>screen router<br/>[AppNavigation.kt]"}}
  node_home_screen["Home<br/>dashboard<br/>[HomeScreen.kt]"]
end

subgraph group_auth["Auth Flow"]
  node_login_screen["Login<br/>auth screen<br/>[LoginScreen.kt]"]
  node_registro_screen["Registro<br/>signup screen<br/>[RegistroScreen.kt]"]
  node_recuperar_screen["Recuperar<br/>recovery screen<br/>[RecuperarScreen.kt]"]
  node_verificacion_screen["Verificacion<br/>verification screen"]
end

subgraph group_inventory["Inventory"]
  node_registrar_producto["Registrar Producto<br/>product create"]
  node_editar_producto["Editar Producto<br/>product edit"]
  node_stock_screen["Stock<br/>inventory list<br/>[StockScreen.kt]"]
  node_producto_model["Producto<br/>domain model<br/>[Producto.kt]"]
end

subgraph group_sales["Sales"]
  node_ventas_screen["Ventas<br/>sales flow<br/>[VentasScreen.kt]"]
end

subgraph group_shared["Shared UI"]
  node_components["Components<br/>ui primitives<br/>[Components.kt]"]
  node_old_components["Old Design<br/>legacy ui"]
  node_theme["Theme<br/>design system<br/>[Theme.kt]"]
end

subgraph group_cloud["Cloud & Platform"]
  node_firebase_auth[("Firebase Auth<br/>external auth")]
  node_firestore[("Firestore<br/>external storage")]
  node_mlkit_scanner(("Code Scanner<br/>device service<br/>[build.gradle.kts]"))
  node_android_manifest["Manifest<br/>android config"]
end

node_main_activity -->|"starts"| node_app_navigation
node_app_navigation -->|"routes"| node_login_screen
node_app_navigation -->|"routes"| node_registro_screen
node_app_navigation -->|"routes"| node_recuperar_screen
node_app_navigation -->|"routes"| node_verificacion_screen
node_app_navigation -->|"routes"| node_home_screen
node_app_navigation -->|"routes"| node_registrar_producto
node_app_navigation -->|"routes"| node_editar_producto
node_app_navigation -->|"routes"| node_stock_screen
node_app_navigation -->|"routes"| node_ventas_screen
node_login_screen -->|"auth"| node_firebase_auth
node_registro_screen -->|"auth"| node_firebase_auth
node_recuperar_screen -->|"auth"| node_firebase_auth
node_verificacion_screen -->|"auth"| node_firebase_auth
node_registrar_producto -->|"uses"| node_producto_model
node_editar_producto -->|"uses"| node_producto_model
node_stock_screen -->|"lists"| node_producto_model
node_ventas_screen -->|"reads"| node_producto_model
node_registrar_producto -->|"writes"| node_firestore
node_editar_producto -->|"updates"| node_firestore
node_stock_screen -->|"reads"| node_firestore
node_ventas_screen -->|"reads/writes"| node_firestore
node_home_screen -->|"aggregates"| node_firestore
node_registrar_producto -->|"scans"| node_mlkit_scanner
node_main_activity -->|"declared by"| node_android_manifest
node_components -.->|"supports"| node_login_screen
node_components -.->|"supports"| node_home_screen
node_components -.->|"supports"| node_registrar_producto
node_components -.->|"supports"| node_ventas_screen
node_old_components -.->|"legacy"| node_components
node_theme -.->|"styles"| node_components
node_theme -.->|"styles"| node_home_screen

click node_main_activity "https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/java/com/example/mystockerapp/MainActivity.kt"
click node_app_navigation "https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/java/com/example/mystockerapp/AppNavigation.kt"
click node_home_screen "https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/java/com/example/mystockerapp/HomeScreen.kt"
click node_login_screen "https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/java/com/example/mystockerapp/LoginScreen.kt"
click node_registro_screen "https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/java/com/example/mystockerapp/RegistroScreen.kt"
click node_recuperar_screen "https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/java/com/example/mystockerapp/RecuperarScreen.kt"
click node_verificacion_screen "https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/java/com/example/mystockerapp/VerificacionScreen.kt"
click node_registrar_producto "https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/java/com/example/mystockerapp/RegistrarProductoScreen.kt"
click node_editar_producto "https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/java/com/example/mystockerapp/EditarProductoScreen.kt"
click node_stock_screen "https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/java/com/example/mystockerapp/StockScreen.kt"
click node_ventas_screen "https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/java/com/example/mystockerapp/VentasScreen.kt"
click node_producto_model "https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/java/com/example/mystockerapp/Producto.kt"
click node_components "https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/java/com/example/mystockerapp/Components.kt"
click node_old_components "https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/java/com/example/mystockerapp/OldDesignComponents.kt"
click node_theme "https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/java/com/example/mystockerapp/ui/theme/Theme.kt"
click node_firebase_auth "https://github.com/sebasquintero123/mistockerapp/blob/main/app/google-services.json"
click node_firestore "https://github.com/sebasquintero123/mistockerapp/blob/main/app/google-services.json"
click node_mlkit_scanner "https://github.com/sebasquintero123/mistockerapp/blob/main/app/build.gradle.kts"
click node_android_manifest "https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/AndroidManifest.xml"

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_app_navigation,node_home_screen toneBlue
class node_login_screen,node_registro_screen,node_recuperar_screen,node_verificacion_screen toneAmber
class node_registrar_producto,node_editar_producto,node_stock_screen,node_producto_model toneMint
class node_ventas_screen toneRose
class node_components,node_old_components,node_theme toneIndigo
class node_firebase_auth,node_firestore,node_mlkit_scanner,node_android_manifest toneTeal
```

## Components

### App Shell

Android entry, navigation, and app-wide presentation

- [MainActivity](https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/java/com/example/mystockerapp/MainActivity.kt): android entry · Bootstraps the Compose app and hands off to navigation · `app/src/main/java/com/example/mystockerapp/MainActivity.kt`
- [Navigation](https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/java/com/example/mystockerapp/AppNavigation.kt): screen router · Routes between auth, home, inventory, stock, and sales screens · `app/src/main/java/com/example/mystockerapp/AppNavigation.kt`
- [Home](https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/java/com/example/mystockerapp/HomeScreen.kt): dashboard · Authenticated landing page and business summary view · `app/src/main/java/com/example/mystockerapp/HomeScreen.kt`

### Auth Flow

Login, signup, recovery, and verification screens

- [Login](https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/java/com/example/mystockerapp/LoginScreen.kt): auth screen · User sign-in flow · `app/src/main/java/com/example/mystockerapp/LoginScreen.kt`
- [Registro](https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/java/com/example/mystockerapp/RegistroScreen.kt): signup screen · Account registration flow · `app/src/main/java/com/example/mystockerapp/RegistroScreen.kt`
- [Recuperar](https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/java/com/example/mystockerapp/RecuperarScreen.kt): recovery screen · Password recovery flow · `app/src/main/java/com/example/mystockerapp/RecuperarScreen.kt`
- [Verificacion](https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/java/com/example/mystockerapp/VerificacionScreen.kt): verification screen · Email or account verification step · `app/src/main/java/com/example/mystockerapp/VerificacionScreen.kt`

### Inventory

Product CRUD and stock management

- [Registrar Producto](https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/java/com/example/mystockerapp/RegistrarProductoScreen.kt): product create · Creates new product records and supports barcode capture · `app/src/main/java/com/example/mystockerapp/RegistrarProductoScreen.kt`
- [Editar Producto](https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/java/com/example/mystockerapp/EditarProductoScreen.kt): product edit · Updates existing product records · `app/src/main/java/com/example/mystockerapp/EditarProductoScreen.kt`
- [Stock](https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/java/com/example/mystockerapp/StockScreen.kt): inventory list · Lists and tracks product stock · `app/src/main/java/com/example/mystockerapp/StockScreen.kt`
- [Producto](https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/java/com/example/mystockerapp/Producto.kt): domain model · Shared product data structure · `app/src/main/java/com/example/mystockerapp/Producto.kt`

### Sales

Sales capture and history

- [Ventas](https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/java/com/example/mystockerapp/VentasScreen.kt): sales flow · Captures sales and shows sales history · `app/src/main/java/com/example/mystockerapp/VentasScreen.kt`

### Shared UI

Reusable UI and theme definitions

- [Components](https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/java/com/example/mystockerapp/Components.kt): ui primitives · Reusable Compose building blocks · `app/src/main/java/com/example/mystockerapp/Components.kt`
- [Old Design](https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/java/com/example/mystockerapp/OldDesignComponents.kt): legacy ui · Older reusable component set retained in the codebase · `app/src/main/java/com/example/mystockerapp/OldDesignComponents.kt`
- [Theme](https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/java/com/example/mystockerapp/ui/theme/Theme.kt): design system · App colors, typography, and theme setup · `app/src/main/java/com/example/mystockerapp/ui/theme/Theme.kt`

### Cloud & Platform

Firebase and Android runtime boundaries

- [Firebase Auth](https://github.com/sebasquintero123/mistockerapp/blob/main/app/google-services.json): external auth · Authentication, registration, recovery, and verification backend · `app/google-services.json`
- [Firestore](https://github.com/sebasquintero123/mistockerapp/blob/main/app/google-services.json): external storage · Per-user persistence for products and sales · `app/google-services.json`
- [Code Scanner](https://github.com/sebasquintero123/mistockerapp/blob/main/app/build.gradle.kts): device service · Barcode scanning used in product registration · `app/build.gradle.kts`
- [Manifest](https://github.com/sebasquintero123/mistockerapp/blob/main/app/src/main/AndroidManifest.xml): android config · Android runtime metadata and launcher configuration · `app/src/main/AndroidManifest.xml`

## Connections

- MainActivity → Navigation: starts · Main activity launches the app router
- Navigation → Login: routes · Navigation can enter the authentication flow
- Navigation → Registro: routes · Navigation can enter registration
- Navigation → Recuperar: routes · Navigation can enter password recovery
- Navigation → Verificacion: routes · Navigation can enter verification
- Navigation → Home: routes · Navigation reaches the authenticated dashboard
- Navigation → Registrar Producto: routes · Navigation opens product creation
- Navigation → Editar Producto: routes · Navigation opens product editing
- Navigation → Stock: routes · Navigation opens stock browsing
- Navigation → Ventas: routes · Navigation opens sales capture
- Login → Firebase Auth: auth · Sign-in uses Firebase Authentication
- Registro → Firebase Auth: auth · Account creation uses Firebase Authentication
- Recuperar → Firebase Auth: auth · Password recovery uses Firebase Authentication
- Verificacion → Firebase Auth: auth · Verification depends on Firebase Authentication
- Registrar Producto → Producto: uses · Product form reads and writes the domain model
- Editar Producto → Producto: uses · Edit flow updates the domain model
- Stock → Producto: lists · Stock view displays product records
- Ventas → Producto: reads · Sales flow reuses product data for selection and totals
- Registrar Producto → Firestore: writes · New products are persisted in Firestore
- Editar Producto → Firestore: updates · Edited products are persisted in Firestore
- Stock → Firestore: reads · Stock view loads user-scoped product data
- Ventas → Firestore: reads/writes · Sales flow reads products and stores sales records
- Home → Firestore: aggregates · Dashboard summarizes product and sales data
- Registrar Producto → Code Scanner: scans · Barcode scanning supports product registration
- MainActivity → Manifest: declared by · Android entry point is configured by the manifest
- Components → Login: supports · Shared UI primitives are reused across screens
- Components → Home: supports · Shared UI primitives are reused across screens
- Components → Registrar Producto: supports · Shared UI primitives are reused across screens
- Components → Ventas: supports · Shared UI primitives are reused across screens
- Old Design → Components: legacy · Older design components coexist with the newer set
- Theme → Components: styles · Theme config shapes shared UI appearance
- Theme → Home: styles · Theme config applies to app screens
