# sbmagar13/recipe-jar architecture

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

- Interactive diagram: https://gitdiagram.com/sbmagar13/recipe-jar
- Repository: https://github.com/sbmagar13/recipe-jar

## Overview

Recipe Jar is a local-first recipe-saving and cooking app. The main workflow is to enter a recipe URL or dish, fetch and parse recipe content, review it as a clean card, then save it in the browser’s jar. Other major branches include manual and photo entry, recipe search and sharing, pantry and weekly shopping, and offline use. The README documents several capabilities whose implementation was not sampled; those are represented at their supported source paths, with uncertain internal connections omitted.

Main entry points: [`src/App.svelte`](https://github.com/sbmagar13/recipe-jar/blob/main/src/App.svelte) (App and navigation), [`src/lib/components/RecipeView.svelte`](https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/components/RecipeView.svelte) (Recipe card and cook mode), [`src/lib/db.ts`](https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/db.ts) (Recipe database), [`src/lib/components/ShopPlan.svelte`](https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/components/ShopPlan.svelte) (Weekly meal and shop plan)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_intake["Recipe intake"]
  node_app["App and navigation<br/>[App.svelte]"]
  node_urlparse["URL recipe parser<br/>[parse.ts]"]
  node_search["Dish search<br/>[sitesearch.ts]"]
  node_rescue["Page text rescue<br/>[rescue.ts]"]
  node_youtube["YouTube import<br/>[youtube.ts]"]
  node_bookmarklet["Browser bookmarklet<br/>[bookmarklet.ts]"]
  node_manual["Manual and text entry<br/>[ManualEntry.svelte]"]
  node_textparse["Pasted text parser<br/>[textparse.ts]"]
  node_ocr["On-device photo OCR<br/>[ocr.ts]"]
end

subgraph group_recipe["Recipe experience"]
  node_recipeview["Recipe card and cook mode<br/>[RecipeView.svelte]"]
  node_quantity["Quantity math<br/>[quantity.ts]"]
  node_steps["Step and timer helpers<br/>[steps.ts]"]
  node_share["Recipe link sharing<br/>[share.ts]"]
end

subgraph group_kitchen["Personal kitchen"]
  node_jarview["Saved recipe jar<br/>[JarView.svelte]"]
  node_db[("Recipe database<br/>[db.ts]")]
  node_shopplan["Weekly meal and shop plan<br/>[ShopPlan.svelte]"]
  node_mergelist["Merged ingredients<br/>[mergelist.ts]"]
  node_shopping["Shopping list"]
  node_pantry["Pantry<br/>[PantryView.svelte]"]
end

subgraph group_platform["Local platform"]
  node_storage["Browser persistence<br/>[storage.ts]"]
  node_pwa["Offline app updates<br/>[pwa.svelte.ts]"]
  node_telemetry["Minimal telemetry<br/>[telemetry.ts]"]
end

subgraph group_services["Service endpoints"]
  node_proxy["Fetch proxy<br/>[proxy.ts]"]
  node_caller["Caller provenance check<br/>[_caller.ts]"]
  node_server["Self-host server<br/>[server.mjs]"]
end

node_cook(("Recipe user"))

node_cook -->|"uses"| node_app
node_app -->|"parses fetched pages"| node_urlparse
node_app -->|"searches dishes"| node_search
node_app -->|"rescues page text"| node_rescue
node_app -.->|"imports video recipes"| node_youtube
node_app -->|"accepts imports"| node_bookmarklet
node_app -.->|"opens entry"| node_manual
node_manual -->|"parses pasted text"| node_textparse
node_manual -->|"recognizes photos"| node_ocr
node_app -->|"recognizes photo"| node_ocr
node_app -->|"fetches pages through"| node_proxy
node_recipeview -->|"scales ingredients"| node_quantity
node_recipeview -->|"uses cook steps"| node_steps
node_recipeview -->|"creates share links"| node_share
node_app -->|"shows recipe card"| node_recipeview
node_app -->|"saves and looks up"| node_db
node_app -->|"opens saved jar"| node_jarview
node_jarview -->|"reads and exports"| node_db
node_jarview -->|"requests persistence"| node_storage
node_shopplan -->|"loads recipes"| node_db
node_shopplan -->|"merges ingredients"| node_mergelist
node_shopplan -->|"renders list"| node_shopping
node_app -.->|"opens pantry"| node_pantry
node_db -->|"requests persistence"| node_storage
node_proxy -->|"checks caller"| node_caller
node_cook -.->|"self-hosts app"| node_server
node_app -->|"reports anonymous events"| node_telemetry
node_app -->|"initializes offline updates"| node_pwa

click node_app "https://github.com/sbmagar13/recipe-jar/blob/main/src/App.svelte"
click node_urlparse "https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/parse.ts"
click node_search "https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/sitesearch.ts"
click node_rescue "https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/rescue.ts"
click node_youtube "https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/youtube.ts"
click node_bookmarklet "https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/bookmarklet.ts"
click node_manual "https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/components/ManualEntry.svelte"
click node_textparse "https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/textparse.ts"
click node_ocr "https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/ocr.ts"
click node_recipeview "https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/components/RecipeView.svelte"
click node_quantity "https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/quantity.ts"
click node_steps "https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/steps.ts"
click node_share "https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/share.ts"
click node_jarview "https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/components/JarView.svelte"
click node_db "https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/db.ts"
click node_shopplan "https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/components/ShopPlan.svelte"
click node_mergelist "https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/mergelist.ts"
click node_shopping "https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/components/ShoppingList.svelte"
click node_pantry "https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/components/PantryView.svelte"
click node_storage "https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/storage.ts"
click node_pwa "https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/pwa.svelte.ts"
click node_telemetry "https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/telemetry.ts"
click node_proxy "https://github.com/sbmagar13/recipe-jar/blob/main/functions/api/proxy.ts"
click node_caller "https://github.com/sbmagar13/recipe-jar/blob/main/functions/api/_caller.ts"
click node_server "https://github.com/sbmagar13/recipe-jar/blob/main/server/server.mjs"

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_app,node_urlparse,node_search,node_rescue,node_youtube,node_bookmarklet,node_manual,node_textparse,node_ocr,node_cook toneBlue
class node_recipeview,node_quantity,node_steps,node_share toneAmber
class node_jarview,node_db,node_shopplan,node_mergelist,node_shopping,node_pantry toneMint
class node_storage,node_pwa,node_telemetry toneRose
class node_proxy,node_caller,node_server toneIndigo
```

## Components

### Recipe intake

- [App and navigation](https://github.com/sbmagar13/recipe-jar/blob/main/src/App.svelte): `src/App.svelte`
- [URL recipe parser](https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/parse.ts): `src/lib/parse.ts`
- [Dish search](https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/sitesearch.ts): `src/lib/sitesearch.ts`
- [Page text rescue](https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/rescue.ts): `src/lib/rescue.ts`
- [YouTube import](https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/youtube.ts): `src/lib/youtube.ts`
- [Browser bookmarklet](https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/bookmarklet.ts): `src/lib/bookmarklet.ts`
- [Manual and text entry](https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/components/ManualEntry.svelte): `src/lib/components/ManualEntry.svelte`
- [Pasted text parser](https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/textparse.ts): `src/lib/textparse.ts`
- [On-device photo OCR](https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/ocr.ts): `src/lib/ocr.ts`

### Recipe experience

- [Recipe card and cook mode](https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/components/RecipeView.svelte): `src/lib/components/RecipeView.svelte`
- [Quantity math](https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/quantity.ts): `src/lib/quantity.ts`
- [Step and timer helpers](https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/steps.ts): `src/lib/steps.ts`
- [Recipe link sharing](https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/share.ts): `src/lib/share.ts`

### Personal kitchen

- [Saved recipe jar](https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/components/JarView.svelte): `src/lib/components/JarView.svelte`
- [Recipe database](https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/db.ts): `src/lib/db.ts`
- [Weekly meal and shop plan](https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/components/ShopPlan.svelte): `src/lib/components/ShopPlan.svelte`
- [Merged ingredients](https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/mergelist.ts): `src/lib/mergelist.ts`
- [Shopping list](https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/components/ShoppingList.svelte): `src/lib/components/ShoppingList.svelte`
- [Pantry](https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/components/PantryView.svelte): `src/lib/components/PantryView.svelte`

### Local platform

- [Browser persistence](https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/storage.ts): `src/lib/storage.ts`
- [Offline app updates](https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/pwa.svelte.ts): `src/lib/pwa.svelte.ts`
- [Minimal telemetry](https://github.com/sbmagar13/recipe-jar/blob/main/src/lib/telemetry.ts): `src/lib/telemetry.ts`

### Service endpoints

- [Fetch proxy](https://github.com/sbmagar13/recipe-jar/blob/main/functions/api/proxy.ts): `functions/api/proxy.ts`
- [Caller provenance check](https://github.com/sbmagar13/recipe-jar/blob/main/functions/api/_caller.ts): `functions/api/_caller.ts`
- [Self-host server](https://github.com/sbmagar13/recipe-jar/blob/main/server/server.mjs): `server/server.mjs`

### Other components

- **Recipe user**

## Connections

- Recipe user → App and navigation: uses (evidence: `README.md`)
- App and navigation → URL recipe parser: parses fetched pages (evidence: `src/App.svelte`)
- App and navigation → Dish search: searches dishes (evidence: `src/App.svelte`)
- App and navigation → Page text rescue: rescues page text (evidence: `src/App.svelte`)
- App and navigation → YouTube import: imports video recipes (evidence: `src/App.svelte`)
- App and navigation → Browser bookmarklet: accepts imports (evidence: `src/App.svelte`)
- App and navigation → Manual and text entry: opens entry (evidence: `src/App.svelte`)
- Manual and text entry → Pasted text parser: parses pasted text (evidence: `src/lib/components/ManualEntry.svelte`)
- Manual and text entry → On-device photo OCR: recognizes photos (evidence: `src/lib/components/ManualEntry.svelte`)
- App and navigation → On-device photo OCR: recognizes photo (evidence: `src/App.svelte`)
- App and navigation → Fetch proxy: fetches pages through (evidence: `README.md`)
- Recipe card and cook mode → Quantity math: scales ingredients (evidence: `src/lib/components/RecipeView.svelte`)
- Recipe card and cook mode → Step and timer helpers: uses cook steps (evidence: `src/lib/components/RecipeView.svelte`)
- Recipe card and cook mode → Recipe link sharing: creates share links (evidence: `src/lib/components/RecipeView.svelte`)
- App and navigation → Recipe card and cook mode: shows recipe card (evidence: `src/App.svelte`)
- App and navigation → Recipe database: saves and looks up (evidence: `src/App.svelte`)
- App and navigation → Saved recipe jar: opens saved jar (evidence: `src/App.svelte`)
- Saved recipe jar → Recipe database: reads and exports (evidence: `src/lib/components/JarView.svelte`)
- Saved recipe jar → Browser persistence: requests persistence (evidence: `src/lib/components/JarView.svelte`)
- Weekly meal and shop plan → Recipe database: loads recipes (evidence: `src/lib/components/ShopPlan.svelte`)
- Weekly meal and shop plan → Merged ingredients: merges ingredients (evidence: `src/lib/components/ShopPlan.svelte`)
- Weekly meal and shop plan → Shopping list: renders list (evidence: `src/lib/components/ShopPlan.svelte`)
- App and navigation → Pantry: opens pantry (evidence: `src/App.svelte`)
- Recipe database → Browser persistence: requests persistence (evidence: `src/lib/db.ts`)
- Fetch proxy → Caller provenance check: checks caller (evidence: `functions/api/proxy.ts`)
- Recipe user → Self-host server: self-hosts app (evidence: `README.md`)
- App and navigation → Minimal telemetry: reports anonymous events (evidence: `src/main.ts`)
- App and navigation → Offline app updates: initializes offline updates (evidence: `src/main.ts`)
