# akash030605/fridgeos architecture

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

- Interactive diagram: https://gitdiagram.com/akash030605/fridgeos
- Repository: https://github.com/akash030605/fridgeos

## Overview

FridgeOS turns a fridge photo into editable ingredients and tailored recipes, with universal recipe discovery and a persistent shopping list. The React app coordinates the user workflow; Express endpoints validate requests and use Gemini for image analysis and recipe generation. The README documents UI and search behavior not fully visible in the excerpts, so those relationships are cited to it; backend calls and validation links are shown in sampled route code.

Main entry points: [`src/App.tsx`](https://github.com/akash030605/fridgeos/blob/main/src/App.tsx) (App coordinator), [`src/routes/analyze.ts`](https://github.com/akash030605/fridgeos/blob/main/src/routes/analyze.ts) (Fridge analysis), [`src/routes/recipes.ts`](https://github.com/akash030605/fridgeos/blob/main/src/routes/recipes.ts) (Recipe discovery), [`src/components/IngredientsState.tsx`](https://github.com/akash030605/fridgeos/blob/main/src/components/IngredientsState.tsx) (Ingredient editor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Web experience"]
  node_app["App coordinator<br/>[App.tsx]"]
  node_hero["Hero screen<br/>[Hero.tsx]"]
  node_navbar["Global navigation<br/>[Navbar.tsx]"]
end

subgraph group_workflow["Fridge workflow"]
  node_upload["Photo upload<br/>[UploadState.tsx]"]
  node_ingredients["Ingredient editor"]
  node_scan["Scan feedback<br/>[ScanOverlay.tsx]"]
  node_chip["Ingredient skeletons<br/>[SkeletonChip.tsx]"]
  node_rotating["Loading messages<br/>[RotatingText.tsx]"]
  node_recipes["Recipe workspace<br/>[RecipesState.tsx]"]
  node_recipecards["Recipe skeletons"]
  node_shopping[("Shopping list<br/>[App.tsx]")]
end

subgraph group_services["API services"]
  node_api["API app<br/>[apiApp.ts]"]
  node_analyze["Fridge analysis<br/>[analyze.ts]"]
  node_recipegen["Tailored recipes<br/>[recipes.ts]"]
  node_search["Recipe discovery<br/>[recipes.ts]"]
end

subgraph group_intelligence["AI and validation"]
  node_gemini["Gemini client<br/>[gemini.ts]"]
  node_prompts["AI prompts<br/>[prompts.ts]"]
  node_schemas["Request and output schemas<br/>[schemas.ts]"]
  node_limits["Rate limits<br/>[rateLimits.ts]"]
end

node_user(("Home cook"))
node_model{{"Google Gemini"}}

node_user -->|"uses"| node_app
node_app -->|"renders"| node_hero
node_app -->|"renders"| node_navbar
node_app -->|"renders"| node_upload
node_app -->|"renders"| node_ingredients
node_app -->|"renders"| node_recipes
node_upload -->|"uploads photo"| node_analyze
node_ingredients -->|"requests scan"| node_analyze
node_ingredients -->|"renders"| node_scan
node_ingredients -->|"renders"| node_chip
node_ingredients -->|"renders"| node_rotating
node_app -->|"requests recipes"| node_recipegen
node_app -->|"persists list"| node_shopping
node_navbar -->|"submits query"| node_search
node_recipes -->|"searches globally"| node_search
node_recipes -->|"renders"| node_recipecards
node_recipes -->|"renders"| node_rotating
node_api -->|"routes requests"| node_analyze
node_api -->|"routes requests"| node_recipegen
node_api -->|"routes requests"| node_search
node_analyze -->|"uses limiter"| node_limits
node_recipegen -->|"uses limiter"| node_limits
node_search -->|"uses limiter"| node_limits
node_analyze -->|"uses prompts"| node_prompts
node_analyze -->|"validates output"| node_schemas
node_analyze -->|"calls"| node_gemini
node_recipegen -->|"builds prompt"| node_prompts
node_recipegen -->|"validates input and output"| node_schemas
node_recipegen -->|"calls"| node_gemini
node_search -->|"builds prompt"| node_prompts
node_search -->|"validates input and output"| node_schemas
node_search -->|"calls"| node_gemini
node_gemini -.->|"generates output"| node_model

click node_app "https://github.com/akash030605/fridgeos/blob/main/src/App.tsx"
click node_hero "https://github.com/akash030605/fridgeos/blob/main/src/components/Hero.tsx"
click node_navbar "https://github.com/akash030605/fridgeos/blob/main/src/components/Navbar.tsx"
click node_upload "https://github.com/akash030605/fridgeos/blob/main/src/components/UploadState.tsx"
click node_ingredients "https://github.com/akash030605/fridgeos/blob/main/src/components/IngredientsState.tsx"
click node_scan "https://github.com/akash030605/fridgeos/blob/main/src/components/ScanOverlay.tsx"
click node_chip "https://github.com/akash030605/fridgeos/blob/main/src/components/SkeletonChip.tsx"
click node_rotating "https://github.com/akash030605/fridgeos/blob/main/src/components/RotatingText.tsx"
click node_recipes "https://github.com/akash030605/fridgeos/blob/main/src/components/RecipesState.tsx"
click node_recipecards "https://github.com/akash030605/fridgeos/blob/main/src/components/SkeletonRecipeCard.tsx"
click node_shopping "https://github.com/akash030605/fridgeos/blob/main/src/App.tsx"
click node_api "https://github.com/akash030605/fridgeos/blob/main/src/apiApp.ts"
click node_analyze "https://github.com/akash030605/fridgeos/blob/main/src/routes/analyze.ts"
click node_recipegen "https://github.com/akash030605/fridgeos/blob/main/src/routes/recipes.ts"
click node_search "https://github.com/akash030605/fridgeos/blob/main/src/routes/recipes.ts"
click node_gemini "https://github.com/akash030605/fridgeos/blob/main/src/lib/gemini.ts"
click node_prompts "https://github.com/akash030605/fridgeos/blob/main/src/lib/prompts.ts"
click node_schemas "https://github.com/akash030605/fridgeos/blob/main/src/lib/schemas.ts"
click node_limits "https://github.com/akash030605/fridgeos/blob/main/src/lib/rateLimits.ts"

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_hero,node_navbar toneBlue
class node_upload,node_ingredients,node_scan,node_chip,node_rotating,node_recipes,node_recipecards,node_shopping toneAmber
class node_api,node_analyze,node_recipegen,node_search toneMint
class node_gemini,node_prompts,node_schemas,node_limits toneRose
class node_user,node_model toneIndigo
```

## Components

### Web experience

- [App coordinator](https://github.com/akash030605/fridgeos/blob/main/src/App.tsx): `src/App.tsx`
- [Hero screen](https://github.com/akash030605/fridgeos/blob/main/src/components/Hero.tsx): `src/components/Hero.tsx`
- [Global navigation](https://github.com/akash030605/fridgeos/blob/main/src/components/Navbar.tsx): `src/components/Navbar.tsx`

### Fridge workflow

- [Photo upload](https://github.com/akash030605/fridgeos/blob/main/src/components/UploadState.tsx): `src/components/UploadState.tsx`
- [Ingredient editor](https://github.com/akash030605/fridgeos/blob/main/src/components/IngredientsState.tsx): `src/components/IngredientsState.tsx`
- [Scan feedback](https://github.com/akash030605/fridgeos/blob/main/src/components/ScanOverlay.tsx): `src/components/ScanOverlay.tsx`
- [Ingredient skeletons](https://github.com/akash030605/fridgeos/blob/main/src/components/SkeletonChip.tsx): `src/components/SkeletonChip.tsx`
- [Loading messages](https://github.com/akash030605/fridgeos/blob/main/src/components/RotatingText.tsx): `src/components/RotatingText.tsx`
- [Recipe workspace](https://github.com/akash030605/fridgeos/blob/main/src/components/RecipesState.tsx): `src/components/RecipesState.tsx`
- [Recipe skeletons](https://github.com/akash030605/fridgeos/blob/main/src/components/SkeletonRecipeCard.tsx): `src/components/SkeletonRecipeCard.tsx`
- [Shopping list](https://github.com/akash030605/fridgeos/blob/main/src/App.tsx): `src/App.tsx`

### API services

- [API app](https://github.com/akash030605/fridgeos/blob/main/src/apiApp.ts): `src/apiApp.ts`
- [Fridge analysis](https://github.com/akash030605/fridgeos/blob/main/src/routes/analyze.ts): `src/routes/analyze.ts`
- [Tailored recipes](https://github.com/akash030605/fridgeos/blob/main/src/routes/recipes.ts): `src/routes/recipes.ts`
- [Recipe discovery](https://github.com/akash030605/fridgeos/blob/main/src/routes/recipes.ts): `src/routes/recipes.ts`

### AI and validation

- [Gemini client](https://github.com/akash030605/fridgeos/blob/main/src/lib/gemini.ts): `src/lib/gemini.ts`
- [AI prompts](https://github.com/akash030605/fridgeos/blob/main/src/lib/prompts.ts): `src/lib/prompts.ts`
- [Request and output schemas](https://github.com/akash030605/fridgeos/blob/main/src/lib/schemas.ts): `src/lib/schemas.ts`
- [Rate limits](https://github.com/akash030605/fridgeos/blob/main/src/lib/rateLimits.ts): `src/lib/rateLimits.ts`

### Other components

- **Home cook**
- **Google Gemini**

## Connections

- Home cook → App coordinator: uses (evidence: `README.md`)
- App coordinator → Hero screen: renders (evidence: `src/App.tsx`)
- App coordinator → Global navigation: renders (evidence: `src/App.tsx`)
- App coordinator → Photo upload: renders (evidence: `src/App.tsx`)
- App coordinator → Ingredient editor: renders (evidence: `src/App.tsx`)
- App coordinator → Recipe workspace: renders (evidence: `src/App.tsx`)
- Photo upload → Fridge analysis: uploads photo (evidence: `README.md`)
- Ingredient editor → Fridge analysis: requests scan (evidence: `README.md`)
- Ingredient editor → Scan feedback: renders (evidence: `src/components/IngredientsState.tsx`)
- Ingredient editor → Ingredient skeletons: renders (evidence: `src/components/IngredientsState.tsx`)
- Ingredient editor → Loading messages: renders (evidence: `src/components/IngredientsState.tsx`)
- App coordinator → Tailored recipes: requests recipes (evidence: `src/App.tsx`)
- App coordinator → Shopping list: persists list (evidence: `src/App.tsx`)
- Global navigation → Recipe discovery: submits query (evidence: `README.md`)
- Recipe workspace → Recipe discovery: searches globally (evidence: `README.md`)
- Recipe workspace → Recipe skeletons: renders (evidence: `src/components/RecipesState.tsx`)
- Recipe workspace → Loading messages: renders (evidence: `src/components/RecipesState.tsx`)
- API app → Fridge analysis: routes requests (evidence: `src/apiApp.ts`)
- API app → Tailored recipes: routes requests (evidence: `src/apiApp.ts`)
- API app → Recipe discovery: routes requests (evidence: `src/apiApp.ts`)
- Fridge analysis → Rate limits: uses limiter (evidence: `src/routes/analyze.ts`)
- Tailored recipes → Rate limits: uses limiter (evidence: `src/routes/recipes.ts`)
- Recipe discovery → Rate limits: uses limiter (evidence: `src/routes/recipes.ts`)
- Fridge analysis → AI prompts: uses prompts (evidence: `src/routes/analyze.ts`)
- Fridge analysis → Request and output schemas: validates output (evidence: `src/routes/analyze.ts`)
- Fridge analysis → Gemini client: calls (evidence: `src/routes/analyze.ts`)
- Tailored recipes → AI prompts: builds prompt (evidence: `src/routes/recipes.ts`)
- Tailored recipes → Request and output schemas: validates input and output (evidence: `src/routes/recipes.ts`)
- Tailored recipes → Gemini client: calls (evidence: `src/routes/recipes.ts`)
- Recipe discovery → AI prompts: builds prompt (evidence: `src/routes/recipes.ts`)
- Recipe discovery → Request and output schemas: validates input and output (evidence: `src/routes/recipes.ts`)
- Recipe discovery → Gemini client: calls (evidence: `src/routes/recipes.ts`)
- Gemini client → Google Gemini: generates output
