Purpose#
Banana turns recipes, available cooking time, preferences, pantry stock and offers into a weekly meal plan and shopping workflow. Its core is local-first: SQLite holds the usable dataset, while AI, retailer scraping and cloud sync are separate integrations.
The local source includes more than an initial dinner planner: per-meal settings, multiple homes, batch cooking and linked leftovers, recipe rotation, receipt/ticket matching, dictation, leaflet extraction and shared households all have implementation modules.
Android is the primary application target. Web support and .web fallbacks exist, but browser builds do not imply Android speech, recording, installation or file-sharing capabilities work identically.
The orchestration layer#
src/data/DataProvider.tsx loads and owns React-visible settings, preferences, ingredients, recipes, recipe children/history, homes, pantry, stores, deals, matches and AI run state. It exposes domain operations rather than asking screens to coordinate SQL themselves.
WeekPlan gathers a week's row, day budgets, slots, shopping items and recent recipe uses. selectors.ts converts stored rows into derived facts such as recipe summaries, ingredient-name maps and planner inputs.
The provider links:
- Repositories for durable writes.
- Pure services for planner decisions, batches, quantities and preferences.
- The AI agent/provider for user-requested interpretation.
- Retailer refresh orchestration for cached deals.
- Cloud hooks and context switching for account/household datasets.
Route map#
Route under src/app/ |
Purpose | Main lower-layer dependencies |
|---|---|---|
(tabs)/index.tsx |
Weekly plan and meal actions | Provider, planning/edit/batch services, slots/day repositories |
(tabs)/recipes.tsx |
Recipe library and discovery | Recipe summaries, filters, recommendation and rotation services |
(tabs)/shopping.tsx |
Generated/manual shopping workflow | Shopping-list service, pantry, manual rows and checks |
(tabs)/deals.tsx |
Cached retailer offers and matches | Deal repositories and refresh results |
(tabs)/settings.tsx |
Configuration entry points | Settings, cloud, updates, language/theme |
recipe/new.tsx, recipe/[id].tsx |
Recipe creation/editing | Recipe, ingredient, step and tag repositories |
ingredients.tsx, pantry.tsx |
Ingredient catalog and per-home stock | Ingredient/pantry/home aggregates |
preferences-defaults.tsx |
Diet, allergies, servings and time defaults | Preferences and preference service |
ai-provider.tsx |
User-selected provider configuration | Local ai_state, OpenAI-compatible transport |
dictation-settings.tsx |
Speech engine/model choices | Dictation settings, native recognizer and Whisper modules |
shops.tsx |
Enable/configure stores | Store repository and provider registry |
seedworks.tsx |
Account, sync and household UI | Supabase client, sync engine and household component |
backup.tsx |
Export/restore | SQLite backup utility |
welcome.tsx, tutorial.tsx, whats-new.tsx |
Onboarding and release information | Local onboarding/configuration and release cache |
End-to-end: changing a planned meal#
- The plan screen captures an explicit meal/day operation or a user-requested natural-language instruction.
- A deterministic operation uses the planning/edit services. An AI operation first creates a bounded context, calls the configured provider and parses typed actions.
- The orchestration layer validates referenced recipes/homes/days and applies allowed operations through repositories.
- Slots and batch links are persisted locally.
- Shopping requirements are rebuilt from the new plan, pantry and valid matched offers.
- The provider reloads its read models. If enabled, cloud synchronization transports the changed underlying records.
The generated shopping list is a projection of the plan, not the authority that decides what the plan is. An AI response is not SQL and does not bypass preference validation.
Feature ownership#
| Domain | Implementation |
|---|---|
| Whole-week plan and one gap | planning-service.ts: planWeek, planGap, scoreRecipe |
| Diet/allergy eligibility | preference-service.ts: isRecipeAllowed, filterRecipesForPreferences |
| Meal-specific settings | meal-settings-service.ts: mealSettingsForDay, allowsRecipeForMeal |
| Recent-use rotation | recipe-rotation-service.ts: recipeRecencyPenalties, recipeRotationRank |
| Batch/leftovers | batch-cooking-service.ts, database/batch-meals.ts |
| Shopping quantities | shopping-list-service.ts: aggregateIngredients, buildShoppingList |
| Pantry and expiry | pantry-service.ts, expiry-service.ts |
| Recommendations | discovery-service.ts: recommendRecipes |
| Receipt/ticket processing | ticket-service.ts: parseTicketText, matchTicketLines |
| Wish-recipe shopping | wish-recipe-service.ts: wishRecipeShoppingLines |
| AI operations | ai/agent.ts, ai/planner.ts, ai/schemas.ts |
| Retailer refresh | deals/index.ts, deals/providers.ts, deals/fetcher.ts |
| Shared households | sync/households.ts, database/data-contexts.ts |
| Release/update handling | updates/, components/update-settings.tsx, native installer |
Network boundaries#
Banana's permitted integrations have different privacy implications:
- A requested AI operation sends selected text/context to the user-configured provider.
- A retailer refresh reads public offer content.
- Seed account/auth/sync accesses the shared Supabase project.
- User-enabled release checks/downloads access public release infrastructure.
- User-requested Whisper model downloads retrieve pinned model files; recognition audio stays local.
“Local-first” does not mean every feature is network-free. It means domain data and core manual workflows do not depend on a successful network request.
Continue reading#
Planning and shopping explains actual decision rules and price limitations. Integrations separates speech recognition from AI interpretation and documents retailer caching. Storage and households explains why a dataset owner can be different from the signed-in account.