A simple web app for tracking kitchen pantry items with: - Search and filter by stock status, spices, or container type - PIN-protected editing - Shopping list export (tap Out of Stock to copy) - QR code for quick mobile access - OpenGraph card for social sharing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1.9 KiB
1.9 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
Pantry is a simple web app for tracking kitchen pantry items. It's a single-page application with no build step, consisting of just two files:
index.html- Frontend (HTML/CSS/JS all in one file)api.php- Backend API (JSON file-based storage)
Architecture
Frontend (index.html):
- Vanilla JavaScript, no frameworks
- Uses QRCode.js from CDN for QR code generation
- Custom CSS with CSS variables for theming (earthy color palette: cream, terracotta, forest green)
- Container types defined in
containerTypesobject (around line 754) - must be kept in sync with backend - All API calls go through the
apiCall()function which POSTs toapi.php
Backend (api.php):
- JSON file-based storage in
data/directory - Endpoints:
get,add,update,delete,setPin,verifyPin - Default inventory defined in
$defaultInventoryarray (lines 31-64) - Container types should match frontend when modified
Data Storage:
data/inventory.json- Inventory itemsdata/pin.txt- 4-digit PIN for edit mode (plain text, view-only protection)
Development
This is a no-build project. To test locally:
php -S localhost:8000
Then open http://localhost:8000 in a browser.
Key Implementation Details
- PIN system is view-only protection (anyone can view, PIN required to edit)
- PIN stored in plain text - adequate for household use only
- Items have:
id,name,container(type),outOfStock(boolean) - Frontend sorts items: in-stock first, then alphabetically
- 8 container types with color-coded dots in UI
Deployment
Designed for YunoHost "My Webapp" deployment. Upload index.html and api.php to the www/ folder. The data/ directory is created automatically and must be writable by the web server.