# shalomavi/fridger architecture

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

- Interactive diagram: https://gitdiagram.com/shalomavi/fridger
- Repository: https://github.com/shalomavi/fridger

## Overview

Fridger is a shared household shopping-and-pantry PWA. A signed-in user sets up or joins a household, manages a shared shopping list, moves purchased items into the pantry, and gets meal suggestions or imports recipes; settings cover household preferences and connected apps. The client uses cached, polled server state, while Supabase provides auth and persistence. The README documents the meal-suggestion LLM function; the tree also shows recipe parsing and MCP/OAuth services. Some feature internals were not sampled, so uncertain service wiring is left unasserted.

Main entry points: [`src/app/routes.tsx`](https://github.com/shalomavi/fridger/blob/main/src/app/routes.tsx) (App routes), [`src/features/shopping`](https://github.com/shalomavi/fridger/tree/main/src/features/shopping) (Shopping list), [`src/features/pantry`](https://github.com/shalomavi/fridger/tree/main/src/features/pantry) (Pantry management), [`src/shared/supabase.ts`](https://github.com/shalomavi/fridger/blob/main/src/shared/supabase.ts) (Supabase client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["App and household"]
  node_routes["App routes<br/>[routes.tsx]"]
  node_auth["Session and login"]
  node_household["Household setup"]
  node_settings["Preferences and apps"]
  node_oauth["OAuth consent"]
end

subgraph group_food["Food workflows"]
  node_shopping["Shopping list"]
  node_pantry["Pantry management"]
  node_meals["Meal suggestions"]
  node_recipes["Recipe import"]
end

subgraph group_data["Data and domain"]
  node_domain["Food domain rules"]
  node_supabase_client["Supabase client<br/>[supabase.ts]"]
  node_database[("Supabase Postgres")]
  node_query_cache[("Persisted query cache<br/>[main.tsx]")]
end

subgraph group_services["Edge services"]
  node_suggest_fn["Suggest meals function"]
  node_parse_fn["Parse recipe function"]
  node_mcp["MCP and OAuth service"]
end

node_user(("Household user"))
node_gemini{{"Gemini API"}}

node_user -->|"uses"| node_routes
node_routes -->|"gates access"| node_auth
node_routes -->|"sets up"| node_household
node_routes -->|"routes to"| node_shopping
node_routes -->|"routes to"| node_pantry
node_routes -->|"routes to"| node_meals
node_routes -->|"routes to"| node_recipes
node_routes -->|"routes to"| node_settings
node_routes -->|"routes to"| node_oauth
node_shopping -->|"moves purchased"| node_pantry
node_pantry -->|"moves items"| node_shopping
node_shopping -->|"merges items"| node_domain
node_meals -->|"checks ingredients"| node_pantry
node_meals -->|"adds missing items"| node_recipes
node_household -.->|"sets preferences"| node_settings
node_shopping -->|"reads and writes"| node_supabase_client
node_pantry -->|"reads and writes"| node_supabase_client
node_recipes -->|"reads and writes"| node_supabase_client
node_supabase_client -->|"accesses"| node_database
node_auth -->|"authenticates"| node_supabase_client
node_routes -->|"renders cached data"| node_query_cache
node_meals -.->|"requests suggestions"| node_suggest_fn
node_suggest_fn -->|"generates meals"| node_gemini
node_recipes -.->|"requests parsing"| node_parse_fn
node_settings -.->|"manages connections"| node_mcp
node_oauth -.->|"authorizes client"| node_mcp

click node_routes "https://github.com/shalomavi/fridger/blob/main/src/app/routes.tsx"
click node_auth "https://github.com/shalomavi/fridger/tree/main/src/features/auth"
click node_household "https://github.com/shalomavi/fridger/tree/main/src/features/household"
click node_settings "https://github.com/shalomavi/fridger/tree/main/src/features/settings"
click node_shopping "https://github.com/shalomavi/fridger/tree/main/src/features/shopping"
click node_pantry "https://github.com/shalomavi/fridger/tree/main/src/features/pantry"
click node_meals "https://github.com/shalomavi/fridger/tree/main/src/features/meals"
click node_recipes "https://github.com/shalomavi/fridger/tree/main/src/features/recipes"
click node_oauth "https://github.com/shalomavi/fridger/tree/main/src/features/oauthConsent"
click node_domain "https://github.com/shalomavi/fridger/tree/main/src/domain"
click node_supabase_client "https://github.com/shalomavi/fridger/blob/main/src/shared/supabase.ts"
click node_query_cache "https://github.com/shalomavi/fridger/blob/main/src/main.tsx"
click node_suggest_fn "https://github.com/shalomavi/fridger/tree/main/supabase/functions/suggest-meals"
click node_parse_fn "https://github.com/shalomavi/fridger/tree/main/supabase/functions/parse-recipe"
click node_mcp "https://github.com/shalomavi/fridger/tree/main/supabase/functions/mcp"

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_routes,node_auth,node_household,node_settings,node_oauth,node_user toneBlue
class node_shopping,node_pantry,node_meals,node_recipes toneAmber
class node_domain,node_supabase_client,node_database,node_query_cache,node_gemini toneMint
class node_suggest_fn,node_parse_fn,node_mcp toneRose
```

## Components

### App and household

- [App routes](https://github.com/shalomavi/fridger/blob/main/src/app/routes.tsx): `src/app/routes.tsx`
- [Session and login](https://github.com/shalomavi/fridger/tree/main/src/features/auth): `src/features/auth`
- [Household setup](https://github.com/shalomavi/fridger/tree/main/src/features/household): `src/features/household`
- [Preferences and apps](https://github.com/shalomavi/fridger/tree/main/src/features/settings): `src/features/settings`
- [OAuth consent](https://github.com/shalomavi/fridger/tree/main/src/features/oauthConsent): `src/features/oauthConsent`

### Food workflows

- [Shopping list](https://github.com/shalomavi/fridger/tree/main/src/features/shopping): `src/features/shopping`
- [Pantry management](https://github.com/shalomavi/fridger/tree/main/src/features/pantry): `src/features/pantry`
- [Meal suggestions](https://github.com/shalomavi/fridger/tree/main/src/features/meals): `src/features/meals`
- [Recipe import](https://github.com/shalomavi/fridger/tree/main/src/features/recipes): `src/features/recipes`

### Data and domain

- [Food domain rules](https://github.com/shalomavi/fridger/tree/main/src/domain): `src/domain`
- [Supabase client](https://github.com/shalomavi/fridger/blob/main/src/shared/supabase.ts): `src/shared/supabase.ts`
- **Supabase Postgres**
- [Persisted query cache](https://github.com/shalomavi/fridger/blob/main/src/main.tsx): `src/main.tsx`

### Edge services

- [Suggest meals function](https://github.com/shalomavi/fridger/tree/main/supabase/functions/suggest-meals): `supabase/functions/suggest-meals`
- [Parse recipe function](https://github.com/shalomavi/fridger/tree/main/supabase/functions/parse-recipe): `supabase/functions/parse-recipe`
- [MCP and OAuth service](https://github.com/shalomavi/fridger/tree/main/supabase/functions/mcp): `supabase/functions/mcp`

### Other components

- **Household user**
- **Gemini API**

## Connections

- Household user → App routes: uses (evidence: `src/app/routes.tsx`)
- App routes → Session and login: gates access (evidence: `src/app/routes.tsx`)
- App routes → Household setup: sets up (evidence: `src/app/routes.tsx`)
- App routes → Shopping list: routes to (evidence: `src/app/routes.tsx`)
- App routes → Pantry management: routes to (evidence: `src/app/routes.tsx`)
- App routes → Meal suggestions: routes to (evidence: `src/app/routes.tsx`)
- App routes → Recipe import: routes to (evidence: `src/app/routes.tsx`)
- App routes → Preferences and apps: routes to (evidence: `src/app/routes.tsx`)
- App routes → OAuth consent: routes to (evidence: `src/app/routes.tsx`)
- Shopping list → Pantry management: moves purchased (evidence: `src/features/shopping/useShoppingList.ts`)
- Pantry management → Shopping list: moves items (evidence: `src/features/pantry/usePantry.ts`)
- Shopping list → Food domain rules: merges items (evidence: `src/features/shopping/useAddShoppingItem.ts`)
- Meal suggestions → Pantry management: checks ingredients (evidence: `src/features/meals/useSuggestions.ts`)
- Meal suggestions → Recipe import: adds missing items (evidence: `src/features/meals/useSuggestions.ts`)
- Household setup → Preferences and apps: sets preferences (evidence: `src/features/settings/useMcpTokens.ts`)
- Shopping list → Supabase client: reads and writes (evidence: `src/features/shopping/api.ts`)
- Pantry management → Supabase client: reads and writes (evidence: `src/features/pantry/api.ts`)
- Recipe import → Supabase client: reads and writes (evidence: `src/features/recipes/api.ts`)
- Supabase client → Supabase Postgres: accesses (evidence: `README.md`)
- Session and login → Supabase client: authenticates (evidence: `src/features/auth/useSession.ts`)
- App routes → Persisted query cache: renders cached data (evidence: `src/main.tsx`)
- Meal suggestions → Suggest meals function: requests suggestions
- Suggest meals function → Gemini API: generates meals (evidence: `README.md`)
- Recipe import → Parse recipe function: requests parsing
- Preferences and apps → MCP and OAuth service: manages connections
- OAuth consent → MCP and OAuth service: authorizes client
