How roodhadson/amorhorneado works
1. Overall shape
- This is a single Android app built in Kotlin with Jetpack Compose.
- The architecture follows a clear MVVM split: UI screens in ui/, state holders in ViewModels, and data access in data/.
- The app is primarily offline-first through Room, with one external API integration for weather.
2. App entry and wiring
- MainActivity is the UI entry point.
- BakeryApplication is the application-level bootstrap class, likely used to initialize the database/repositories.
- AppViewModelProvider centralizes ViewModel creation and dependency wiring for the Compose screens.
3. Presentation layer
- The ui/ package is organized by feature: dashboard, ingredients, inventory, production, recipes, debts, and raffle.
- Each feature typically has a screen composable plus a ViewModel that owns its state.
- Shared UI primitives live in ui/components/BakeryComponents.kt, while the app’s dark visual system is defined in ui/theme/.
4. Navigation and user flows
- The app appears to be centered around a dashboard-first experience with feature screens reachable from there.
- The README mentions a bottom navigation bar with a central FAB for quick production entry, so the main interaction model is likely dashboard + docked nav + action button.
- Screens such as DashboardScreen, SalesSummaryScreen, InventoryScreen, ProductionScreen, RecipesScreen, and DebtsScreen represent the primary navigation targets.
5. State management
- ViewModels in each feature package expose UI state and user actions.
- The README mentions StateFlow and Coroutines, so UI state is reactive and updated asynchronously from database/network sources.
- This keeps Compose screens thin: they render state and forward events, while logic sits in ViewModels.
6. Persistence layer
- The data/ package contains the app’s local data model and persistence boundary.
- AppDatabase is the Room database entry point.
- IngredientDao and IngredientRepository show a repository pattern on top of Room.
- The data entities cover core bakery concepts: Ingredient, Recipe, ProductionRecord, ProductionCost, SaleRecord, Debt, Customer, ExchangeRate, and UserConfig.
7. Core business domains
- Ingredients / inventory: manage raw materials, costs, and stock.
- Recipes / production: define product formulas and compute production cost from ingredients plus fixed expenses.
- Sales / customer finance: track sales, customers, debts, and payments.
- Dashboard analytics: aggregate KPI-style summaries for sales and operational status.
- Raffle: a separate feature with its own screen and ViewModel, likely for promotional/customer engagement.
8. Important data relationships
- Ingredient pricing changes are a key business rule: the README says updating an ingredient price should propagate to all linked recipes and their costs.
- Recipe and production screens therefore depend on ingredient data, not just display it.
- Production cost calculation combines ingredient costs with fixed operating expenses like gas, electricity, and labor.
- Debt and customer data feed finance views and ranking-style summaries.
9. External integration
- network/WeatherApiService.kt is the only explicit network boundary.
- Weather data is used by the dashboard for demand forecasting or context-aware analytics.
- Everything else is designed to function locally, which is important for the diagram: local Room data is the system of record, weather is an auxiliary signal.
10. Cross-feature reporting
- DashboardViewModel and SalesSummaryViewModel likely aggregate data from multiple sources: sales records, inventory status, and weather.
- This means the dashboard is not a separate subsystem; it is a composition layer over the operational modules.
- If drawing boundaries, treat analytics as a read-only consumer of the transactional data model.
11. Resources and UI identity
- The app has a strong branded presentation layer: dark theme colors, custom launcher assets, and a raffle animation in res/raw/ruleta_anim.json.
- These assets support the premium bakery-themed UX but do not change the core data architecture.
- ui/theme/Color.kt, Theme.kt, and Type.kt define the visual system used across screens.
12. Tests and build structure
- Standard Android unit and instrumentation test locations exist under app/src/test and app/src/androidTest.
- The root Gradle files indicate a conventional single-module Android build.
- There are also top-level BakeryDao.kt and BakeryModels.kt files outside app/src, which look like shared or legacy source files and should be shown separately if they are actually compiled into the app.
13. What to emphasize in an architecture diagram
- Show the flow: Compose screens → ViewModels → Repository/DAO → Room database, with Weather API as a side input to dashboard logic.
- Treat Ingredients, Recipes, Production, Debts, and Sales as the main business domains.
- Highlight that inventory and pricing changes propagate into production cost and recipe views, while dashboard screens aggregate data from all domains.
Main entry points: AppViewModelProvider.kt VM Provider · AppDatabase.kt Room DB · DashboardViewModel.kt Dashboard VM · SalesSummaryViewModel.kt Sales VM
Components 20
App shell
Application bootstrap and entry points.
- MainActivity · Compose entry activity for the Android app.
app/src/main/java/com/example/amorhorneado/MainActivity.kt - App · Application bootstrap class for app-wide initialization.
app/src/main/java/com/example/amorhorneado/BakeryApplication.kt
Presentation
Compose UI, feature screens, and ViewModels.
- VM Provider · Central factory for ViewModel creation and dependency injection.
app/src/main/java/com/example/amorhorneado/ui/AppViewModelProvider.kt - Dashboard VM · Aggregates operational data for the main overview screen.
app/src/main/java/com/example/amorhorneado/ui/dashboard/DashboardViewModel.kt - Sales VM · Builds sales summary and reporting state.
app/src/main/java/com/example/amorhorneado/ui/dashboard/SalesSummaryViewModel.kt - Ingredients VM · Manages ingredient list, edits, and creation flows.
app/src/main/java/com/example/amorhorneado/ui/ingredients/IngredientsViewModel.kt - Inventory · Inventory view for stock status and operational use.
app/src/main/java/com/example/amorhorneado/ui/inventory/InventoryScreen.kt - Production VM · Coordinates production workflow and related data.
app/src/main/java/com/example/amorhorneado/ui/production/ProductionViewModel.kt - Cost VM · Calculates production cost from ingredients and fixed expenses.
app/src/main/java/com/example/amorhorneado/ui/production/ProductionCostViewModel.kt - Recipes VM · Manages recipe browsing, details, and editing state.
app/src/main/java/com/example/amorhorneado/ui/recipes/RecipesViewModel.kt - Debt VM · Handles customer debt and payment-related state.
app/src/main/java/com/example/amorhorneado/ui/debts/DebtViewModel.kt - Raffle VM · Controls the raffle feature state and actions.
app/src/main/java/com/example/amorhorneado/ui/raffle/RaffleViewModel.kt - Components · Shared reusable Compose components.
app/src/main/java/com/example/amorhorneado/ui/components/BakeryComponents.kt
Data layer
Local persistence and core business data models.
- Room DB · App database entry point and persistence hub.
app/src/main/java/com/example/amorhorneado/data/AppDatabase.kt - Ingredient Repo · Repository boundary over ingredient persistence.
app/src/main/java/com/example/amorhorneado/data/IngredientRepository.kt - Ingredient DAO · Room access object for ingredient operations.
app/src/main/java/com/example/amorhorneado/data/IngredientDao.kt - Models · Core bakery entities for ingredients, recipes, production, sales, debts, customers, exchange rates, and config.
app/src/main/java/com/example/amorhorneado/data/Models.kt
Integration
External services and API boundaries.
- Weather API · External weather integration used as a contextual dashboard signal.
app/src/main/java/com/example/amorhorneado/network/WeatherApiService.kt
Assets
Theme, resources, and branded UI assets.
- Theme · Compose theme, colors, and typography for the app.
app/src/main/java/com/example/amorhorneado/ui/theme/Theme.kt - Brand assets · Launcher art, colors, strings, and raffle animation resources.
app/src/main/res/raw/ruleta_anim.json
Connections 25
- MainActivity → VM Provider: uses · Activity enters the Compose app and resolves feature ViewModels.
- App → Room DB: initializes · Application bootstrap is the likely place for app-wide persistence setup.
- VM Provider → Dashboard VM: creates · Provides the dashboard state holder.
- VM Provider → Sales VM: creates · Provides the sales reporting state holder.
- VM Provider → Ingredients VM: creates · Provides the ingredients feature state holder.
- VM Provider → Production VM: creates · Provides the production workflow state holder.
- VM Provider → Cost VM: creates · Provides the production cost calculator state holder.
- VM Provider → Recipes VM: creates · Provides the recipes feature state holder.
- VM Provider → Debt VM: creates · Provides the debts feature state holder.
- VM Provider → Raffle VM: creates · Provides the raffle feature state holder.
- Dashboard VM → Weather API: reads · Dashboard uses weather as an auxiliary input for analytics or forecasting.
- Dashboard VM → Room DB: aggregates · Dashboard composes data from the local system of record.
- Sales VM → Room DB: aggregates · Sales summaries are derived from local transactional data.
- Ingredients VM → Ingredient Repo: uses · Ingredient flows go through the repository boundary.
- Ingredient Repo → Ingredient DAO: persists · Repository delegates ingredient operations to Room DAO methods.
- Ingredient DAO → Room DB: queries · DAO accesses the Room database.
- Production VM → Room DB: reads · Production workflow reads persisted recipes, ingredients, and records.
- Cost VM → Models: calculates · Cost logic combines domain entities and business rules.
- Recipes VM → Room DB: reads · Recipes depend on persisted ingredient and recipe data.
- Debt VM → Room DB: reads · Debt management is backed by local customer and debt records.
- Raffle VM → Room DB: reads · Raffle state likely uses persisted customer or campaign data.
- Dashboard VM → Sales VM: composes · Dashboard surfaces reporting summaries as part of the overview.
- Theme → Components: styles · Shared components render with the app theme.
- Brand assets → Theme: supports · Resources back the branded visual system.
- Models → Room DB: defines · Domain entities are stored and queried through Room.