Skip to content
AASierpPublic

About

First attempt at AI first development - Developed entirely with Codex - Local-first .NET MAUI app for cataloging recipes through manual entry or scanned handwritten and printed recipe cards, with OCR-assisted transcription, review, search, editing, and original-image preservation.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

35 Commits

Folders and files

Repository files navigation

Recipe Box

Recipe Box is a local-first mobile app for cataloguing recipes. A recipe can be typed manually or scanned from existing cards, pages, and clippings. Both paths save the same local recipe model.

Technology Choice

.NET MAUI is the app shell because this workspace already has MAUI workloads for Windows, iOS, and Android, and MAUI provides first-party camera/photo picking, app-private file storage, native UI, and app store deployment paths. Flutter is not installed locally, and React Native would add a JavaScript/native toolchain before proving the product workflow.

OCR is behind IRecipeTextRecognitionService. OpenAI contextual analysis is behind IRecipeVisionAnalysisService so it does not masquerade as character OCR.

  • Android uses Google ML Kit text recognition through Xamarin.GooglePlayServices.MLKit.Text.Recognition. This keeps recognition on device through Google Play services and does not call a custom backend or require an app API key. Android minimum OS support is API 23 for this binding.
  • iOS uses Apple Vision VNRecognizeTextRequest with accurate recognition and language correction. The iOS target builds in this environment; real-device OCR still needs manual verification on iPhone or iPad hardware.
  • Windows and other development targets still use MockRecipeTextRecognitionService so desktop builds and parser tests stay deterministic.
  • DEBUG builds include a development provider selector for On-device OCR, Google Cloud Vision, OpenAI Vision, Google + OpenAI Hybrid, and Mock. Google and OpenAI are direct mobile calls for testing only; do not use direct mobile cloud credentials for production release.
  • OpenAI Vision uses the Responses API with image inputs and a strict JSON schema. Local originals are preserved, while separate temporary cloud-upload copies are capped to a 2048-pixel long edge and sent with detail: original for handwriting detail. The default development model is gpt-5.6-terra, configurable in DEBUG settings.
  • The current OpenAI adapter uses a focused HttpClient Responses request rather than adding a MAUI dependency on a still-evolving typed Responses SDK surface for image input plus strict structured output. The official .NET SDK remains the preferred future replacement once that surface is stable for the app targets.

Project Structure

  • src/RecipeBox.Core: models, SQLite repository, OCR/parser/category abstractions, deterministic parser, validation, rollback-safe save workflow, diagnostics contracts.
  • src/RecipeBox.App: .NET MAUI UI, manual recipe editor, scanned recipe review, media picker workflow, app-private image storage, native OCR adapters, diagnostic log file.
  • tests/RecipeBox.Core.Tests: automated tests for parsing, validation, category suggestion, repository behavior, OCR normalization, OCR reading order, save rollback, and image lifecycle.
  • manual-test: manual QA notes for OCR/photo testing. Do not add personal recipe photos to source control.

Local Data Model

Recipe

  • Id
  • Title
  • Source
  • Category
  • Ingredients
  • Instructions
  • Notes
  • UnsortedText
  • UncertainLines
  • IsFavorite
  • CreatedAt
  • UpdatedAt
  • Images

RecipeImage

  • Id
  • RecipeId
  • LocalStoragePath
  • ImageOrder
  • ImageSideOrLabel
  • IsDraft
  • CreatedAt

Recipe text is stored in SQLite. Image binary data is copied into app-private local storage and referenced by local path. Newly captured or picked images are stored as drafts first, then promoted to permanent recipe image storage only after the recipe validates and saves. Stale draft images are cleaned on startup after 24 hours.

Image promotion is rollback-safe for new files. Missing draft images fail before a recipe record is saved. If promotion fails partway through, already promoted images are deleted. If database save fails after promotion, newly promoted images are deleted so the app does not leave orphaned permanent files.

Current Vertical Slice

This slice lets a user open the app, see an empty recipe list, choose Type Recipe or scan from the camera/photo library, save locally, restart, search, open, edit, and delete recipes.

Manual entry supports title, ingredients, directions, notes, source, and category. Ingredient and direction lines are edited as individual fields so scanned recipes can be corrected one line at a time. Images are optional for manual recipes.

Scanning starts with photo staging. Adding, capturing, replacing, removing, relabeling, or reordering photos does not automatically run OCR or parsing. The user taps Read Recipe when ready. OCR runs, raw recognized text is shown, the initial parser output is filled in, and the user can edit both raw text and structured recipe lines.

The review screen includes Parse Recipe and Read Again. Editing raw OCR text does not rerun parsing until the user taps Parse Recipe. Read Again asks before replacing recognized text and refreshed fields, then reruns the same provider or pipeline that created the draft: Google reruns Google, OpenAI Vision reruns OpenAI Vision, Hybrid reruns Google plus OpenAI, Mock reruns Mock, and On-device reruns on-device OCR.

Saved recipes prioritize reading: title first, subtle category/source metadata beneath it, then a Recipe / Original Card selector. Recipe view shows ingredients, instructions, notes, unsorted text, and unresolved uncertainty. Original Card view shows saved card images with multi-image navigation when images exist. Edit remains available near the title, while Delete is separated from the reading controls and still requires confirmation.

Editing an existing recipe updates the same SQLite record rather than creating a duplicate. Existing original images can be viewed, removed, reordered, relabeled, or supplemented with newly selected/captured images. Deletion removes the recipe plus its saved card image files from local storage after confirmation.

The parser is deterministic. It normalizes OCR line endings from external providers, trusts explicit recipe sections, uses conservative heading-free ingredient-to-instruction transitions, joins obvious wrapped instruction lines, and preserves low-confidence OCR lines for review. Text that cannot be safely placed is preserved as unsorted text instead of being discarded. Temperature, time, and yield can be captured internally, but they are not duplicated into visible notes when they already appear in recipe text.

OpenAI review suggestions are classified before display. Formatting-only changes such as capitalization, punctuation, comma spacing, repeated whitespace, and harmless sentence punctuation are auto-applied without adding review work. Numeric, measurement, unit, fraction, duration, temperature, yield, package-count, uncertainty-marker, and meaningful word changes remain reviewable.

The app intentionally uses one polished light theme. Dark OS mode does not switch the app into dark colors yet; this avoids partial dark-mode behavior such as white text on white fields until a complete dark theme is designed.

Setup And Run

Prerequisites:

  • .NET 10 SDK.
  • .NET MAUI workloads for the target platforms you want to build.
  • Windows is the easiest local functional-test target in this workspace.

Restore workloads and packages:

dotnet workload restore
dotnet restore RecipeBox.slnx

Run the Windows app:

dotnet run --project src/RecipeBox.App/RecipeBox.App.csproj -f net10.0-windows10.0.19041.0

Build Android:

dotnet build src/RecipeBox.App/RecipeBox.App.csproj -f net10.0-android

Create a debug-only APK for device testing:

dotnet publish src/RecipeBox.App/RecipeBox.App.csproj -f net10.0-android -c Release -p:AndroidPackageFormat=apk

The signed APK is written under:

src/RecipeBox.App/bin/Release/net10.0-android/publish/

The local diagnostic log is written under the app data directory. On this Windows development machine it is:

C:\Users\A1\AppData\Local\User Name\com.recipebox.localfirst\Data\logs\diagnostic.log

Verify Locally

dotnet test tests/RecipeBox.Core.Tests/RecipeBox.Core.Tests.csproj
dotnet build src/RecipeBox.App/RecipeBox.App.csproj -f net10.0-windows10.0.19041.0
dotnet build src/RecipeBox.App/RecipeBox.App.csproj -f net10.0-android
dotnet build src/RecipeBox.App/RecipeBox.App.csproj -f net10.0-ios

Current verified baseline for this workspace:

  • Core tests: 114 passing.
  • Windows build: passes with 0 warnings.
  • Android build: passes with 0 warnings.
  • iOS build: passes with 0 warnings for iossimulator-x64.

Development Cloud Analysis

Cloud OCR and contextual analysis are available only as development comparison aids. In DEBUG builds, the scan staging page exposes:

  • Provider selector: On-device OCR, Google Cloud Vision, OpenAI Vision, Google + OpenAI Hybrid, and Mock.
  • SecureStorage-backed development credential fields for Google and OpenAI API keys. If a key cannot be saved securely, the app reports failure and does not write the key to Preferences.
  • OpenAI model selector with gpt-5.6-terra, gpt-5.6-luna, and gpt-5.6-sol.
  • Compare Providers, which runs all five development providers against the same staged images. OCR providers display raw OCR metrics and text. OpenAI and Hybrid display provider, model, duration, title, counts, review-item count, warnings, transcription character count, and transient token counts.
  • Copy Report, which copies the comparison report without API keys, access tokens, or full private paths.

Development API Keys

Direct API keys in this app are for local DEBUG experimentation only. Do not commit keys, paste them into source files, include them in screenshots, or use this pattern for a production mobile release.

OpenAI Vision:

  1. Create or sign in to an OpenAI platform account.
  2. Create an API key from the OpenAI API keys page: https://platform.openai.com/api-keys.
  3. Make sure the project/account has access to the selected model.
  4. In a DEBUG build of Recipe Box, open the scan page, select OpenAI Vision or Google + OpenAI Hybrid, paste the key into OpenAI API key, choose the model, and tap Save OCR Settings.

Google Cloud Vision:

  1. Create or select a Google Cloud project.
  2. Enable billing if the project requires it for Cloud Vision.
  3. Enable the Cloud Vision API: https://docs.cloud.google.com/vision/docs/setup.
  4. Create an API key in Google Cloud Console credentials, then restrict it to the Cloud Vision API where practical. Google documents API-key authentication for Vision here: https://docs.cloud.google.com/vision/product-search/docs/auth.
  5. In a DEBUG build of Recipe Box, open the scan page, select Google Cloud Vision or Google + OpenAI Hybrid, paste the key into Google Cloud Vision API key, and tap Save OCR Settings.

Direct cloud credentials inside a mobile application are temporary for development testing and are not suitable for production release. A production release will require a server-side proxy to protect credentials. The provider resolver and analysis service keep the scan workflow independent from direct cloud calls so that proxy can replace them without changing the user flow.

Google Cloud Vision uses document text detection. OpenAI Vision sends prepared upload copies through the Responses API with strict Structured Outputs. Google + OpenAI Hybrid preserves both Google raw OCR text and OpenAI full transcription in memory for review; if OpenAI fails after Google succeeds, the Google transcription remains available and the deterministic parser output is shown with a warning. Automated tests must not call real cloud services.

OpenAI token usage is captured transiently as input, output, and total token counts for comparison reports and sanitized diagnostics. Usage is not persisted as recipe data, and the app does not hardcode pricing.

Sending recipe images to Google or OpenAI sends those images to cloud providers; use non-private test images unless the user has explicitly accepted that privacy tradeoff.

Known Limitations

  • Real-device Android and iOS OCR quality still requires manual QA with actual recipe cards.
  • Direct API-key use is DEBUG-only and temporary. Production secret handling still requires a server-side proxy or another credential-safe architecture.
  • Real-device visual QA is still needed for the platform image-resize path and for actual Android/iOS OCR quality with family recipe cards.
  • Cloud provider adapters normalize raw text and warnings into the shared OCR model. Google and OpenAI failures are mapped to sanitized user-facing categories such as disabled API, billing issue, quota/rate limit, timeout, and provider unavailable. Richer provider block/word geometry is not yet surfaced in the UI.

Out of Scope

This project intentionally does not include accounts, backend sync, cloud recipe storage, grocery lists, nutrition tracking, social sharing, recipe discovery, or AI recipe generation.

About

First attempt at AI first development - Developed entirely with Codex - Local-first .NET MAUI app for cataloging recipes through manual entry or scanned handwritten and printed recipe cards, with OCR-assisted transcription, review, search, editing, and original-image preservation.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages