# aishwaryamensinkai/pantry-tracker architecture

> Architecture diagram of the GitHub repository aishwaryamensinkai/pantry-tracker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aishwaryamensinkai/pantry-tracker
- Repository: https://github.com/aishwaryamensinkai/pantry-tracker

## Overview

##### Project type and purpose
- This is a full-stack web application built with Next.js (App Router) and React.
- Purpose: Manage pantry inventory in real time, suggest recipes based on available ingredients, display analytics, and export reports.

##### File structure
- Top-level “app” directory: Next.js App Router with subfolders for each route—“analysis”, “dashboard”, “generate-recipes”, and the root page.
- “app/components”: React UI components (modals, lists, charts, etc.).
- “app/firebase/config.js”: Firebase initialization for Auth, Firestore, Storage.
- “app/utils/exportPdf.js”: Utility to generate PDFs (html2canvas + jsPDF).
- Configuration files: next.config.mjs, tailwind.config.js, postcss.config.mjs, .eslintrc.json.

##### README
- Tech stack: Next.js, React, Firebase, OpenRouter (LLAMA AI), Material-UI, Tailwind, Framer Motion, Chart.js, TensorFlow.js, Axios, React Toastify, React Table, html2canvas/jsPDF.
- Key features: real-time tracking via Firestore, recipe suggestions via external AI API, inventory analytics, PDF export, notifications.

## Diagram (Mermaid)

```mermaid
graph TB
  %% Client Side
  subgraph "Client (Next.js / React)"
    direction TB
    Layout["App Router"]:::ui
    RootPage["Home Page"]:::ui
    AnalysisPage["Analysis Page"]:::ui
    DashboardPage["Dashboard Page"]:::ui
    RecipesPage["Generate Recipes Page"]:::ui
    subgraph "UI Components"
      direction TB
      Navbar["Navbar"]:::ui
      Pantry["Pantry"]:::ui
      InventoryList["InventoryList"]:::ui
      InventoryAnalysis["InventoryAnalysis"]:::ui
      RecipeSuggestions["RecipeSuggestions"]:::ui
      AddItemModal["AddItemModal"]:::ui
      ProfileModal["ProfileModal"]:::ui
      ImageCapture["ImageCapture"]:::ui
    end
  end

  %% Backend Services
  subgraph "Firebase Backend"
    direction TB
    Auth["Firebase Auth"]:::firebase
    Firestore["Firestore DB"]:::firebase
    Storage["Firebase Storage"]:::firebase
  end

  %% External API
  ExternalAI["OpenRouter/LLAMA AI API"]:::external

  %% Utilities & Libraries
  subgraph "Utilities & Libraries"
    direction TB
    PDFUtil["html2canvas / jsPDF"]:::util
    ChartJS["Chart.js"]:::util
    TensorFlow["TensorFlow.js"]:::util
  end

  %% Connections
  Layout -->|routes to| RootPage
  Layout -->|routes to| AnalysisPage
  Layout -->|routes to| DashboardPage
  Layout -->|routes to| RecipesPage

  RootPage -->|renders| Navbar
  AnalysisPage -->|renders| InventoryAnalysis
  DashboardPage -->|renders| InventoryList
  RecipesPage -->|renders| RecipeSuggestions

  Navbar -->|login/signup| Auth
  Pantry -->|CRUD items| Firestore
  InventoryList -->|read/write| Firestore
  InventoryAnalysis -->|read analytics| Firestore
  ProfileModal -->|profile data| Firestore
  AddItemModal -->|add items| Firestore
  ImageCapture -->|upload/download| Storage

  Pantry -->|generate recipes| ExternalAI
  RecipeSuggestions -->|API call| ExternalAI

  ImageCapture -->|on-device processing| TensorFlow
  PDFUtil -->|export PDF| RootPage
  PDFUtil -->|export PDF| DashboardPage
  InventoryAnalysis -->|render charts| ChartJS

  %% Styles
  classDef ui fill:#a8f0a2,stroke:#333,stroke-width:1px
  classDef firebase fill:#a2d3f0,stroke:#333,stroke-width:1px
  classDef external fill:#f0c27b,stroke:#333,stroke-width:1px
  classDef util fill:#d3d3d3,stroke:#333,stroke-width:1px

  %% Click Events
  click Navbar "https://github.com/aishwaryamensinkai/pantry-tracker/blob/main/app/components/Navbar.js"
  click Pantry "https://github.com/aishwaryamensinkai/pantry-tracker/blob/main/app/components/Pantry.js"
  click InventoryList "https://github.com/aishwaryamensinkai/pantry-tracker/blob/main/app/components/InventoryList.js"
  click InventoryAnalysis "https://github.com/aishwaryamensinkai/pantry-tracker/blob/main/app/components/InventoryAnalysis.js"
  click RecipeSuggestions "https://github.com/aishwaryamensinkai/pantry-tracker/blob/main/app/components/RecipeSuggestions.js"
  click AddItemModal "https://github.com/aishwaryamensinkai/pantry-tracker/blob/main/app/components/AddItemModal.js"
  click ProfileModal "https://github.com/aishwaryamensinkai/pantry-tracker/blob/main/app/components/ProfileModal.js"
  click ImageCapture "https://github.com/aishwaryamensinkai/pantry-tracker/blob/main/app/components/ImageCapture.js"
  click Layout "https://github.com/aishwaryamensinkai/pantry-tracker/blob/main/app/layout.js"
  click RootPage "https://github.com/aishwaryamensinkai/pantry-tracker/blob/main/app/page.js"
  click AnalysisPage "https://github.com/aishwaryamensinkai/pantry-tracker/blob/main/app/analysis/page.js"
  click DashboardPage "https://github.com/aishwaryamensinkai/pantry-tracker/blob/main/app/dashboard/page.js"
  click RecipesPage "https://github.com/aishwaryamensinkai/pantry-tracker/blob/main/app/generate-recipes/page.js"
  click Auth "https://github.com/aishwaryamensinkai/pantry-tracker/blob/main/app/firebase/config.js"
  click PDFUtil "https://github.com/aishwaryamensinkai/pantry-tracker/blob/main/app/utils/exportPdf.js"
  click ChartJS "https://github.com/aishwaryamensinkai/pantry-tracker/blob/main/app/utils/exportPdf.js"
  click TensorFlow "https://github.com/aishwaryamensinkai/pantry-tracker/blob/main/app/utils/exportPdf.js"
```
