How rahulrvu-24/smart-pantry works
Smart Pantry is a React pantry tracker backed by an Express REST API and MongoDB. The main workflow loads pantry state into the app, lets users add, use, delete, and reset items, then derives expiry status for dashboard and recipe suggestions. Recipe Rescue searches and loads recipe details through a server proxy to TheMealDB, with pantry-ingredient matching on the detail page. Edges reflect excerpted calls or explicit README claims; unsampled connections are omitted.
Main entry points: App.jsx App state and routes · Recipes.jsx Recipe search page · index.js Express app and routing · expiry.js Expiry logic
Components 26
Pantry experience
- App state and routes
src/App.jsx - Item API client
src/api/items.js - Fetch client
src/api/client.js - Add item form
src/components/additemform.jsx - Pantry page
src/pages/Pantry.jsx - Pantry list
src/components/PantryList.jsx - Pantry item
src/components/PantryItem.jsx - Date helpers
src/utils/date.js
Expiry insights
- Dashboard
src/pages/Dashboard.jsx - Expiry logic
src/utils/expiry.js - Expiry badge
src/components/ExpiryBadge.jsx - Use-it-soon list
src/components/UseItSoonList.jsx
Recipe Rescue
- Recipe search page
src/pages/Recipes.jsx - Recipe search form
src/components/RecipeSearchForm.jsx - Recipe API client
src/api/recipes.js - Recipe card
src/components/RecipeCard.jsx - Recipe detail
src/pages/RecipeDetail.jsx
REST services
- Express app and routing
server/index.js - Pantry endpoints
server/routes/items.js - Item validation
server/validation.js - Recipe proxy
server/routes/recipes.js
Persistent storage
- Item model
server/models/Item.js - MongoDB
- Database connection
server/db.js
Other components
- Pantry user
- TheMealDB
Connections 31
- Pantry user → App state and routes: uses
README.md - App state and routes → Item API client: loads and mutates
src/App.jsx - Item API client → Fetch client: requests through
src/api/items.js - Fetch client → Express app and routing: calls REST API
README.md - App state and routes → Add item form: renders
src/App.jsx - App state and routes → Pantry page: routes to
src/App.jsx - Pantry page → Pantry list: renders
src/pages/Pantry.jsx - Pantry list → Pantry item: renders
src/components/PantryList.jsx - Pantry item → Date helpers: formats dates
src/components/PantryItem.jsx - Pantry item → Expiry badge: renders
src/components/PantryItem.jsx - Expiry badge → Expiry logic: classifies dates
src/components/ExpiryBadge.jsx - App state and routes → Dashboard: routes to
src/App.jsx - Dashboard → Expiry logic: counts expiry
src/pages/Dashboard.jsx - Dashboard → Use-it-soon list: shows urgency list
src/pages/Dashboard.jsx - Use-it-soon list → Expiry logic: sorts urgent items
src/components/UseItSoonList.jsx - App state and routes → Recipe search page: routes to
src/App.jsx - Recipe search page → Recipe search form: renders
src/pages/Recipes.jsx - Recipe search page → Expiry logic: suggests urgent items
src/pages/Recipes.jsx - Recipe search page → Recipe API client: searches recipes
src/pages/Recipes.jsx - Recipe search page → Recipe card: renders results
src/pages/Recipes.jsx - App state and routes → Recipe detail: routes to
src/App.jsx - Recipe detail → Recipe API client: loads recipe
src/pages/RecipeDetail.jsx - Recipe API client → Fetch client: requests through
src/api/recipes.js - Express app and routing → Pantry endpoints: mounts routes
server/index.js - Express app and routing → Recipe proxy: mounts routes
server/index.js - Pantry endpoints → Item validation: validates items
server/routes/items.js - Pantry endpoints → Item model: queries items
server/routes/items.js - Item model → MongoDB: persists records
- Express app and routing → Database connection: connects on startup
server/index.js - Database connection → MongoDB: opens connection
- Recipe proxy → TheMealDB: fetches upstream
server/routes/recipes.js