commit 726325e501463f5b3852da0a5958e16ca9f28fd2 Author: Eric Wagoner Date: Tue Dec 23 22:20:27 2025 -0500 Initial commit: Pantry inventory tracker 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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..47e5073 --- /dev/null +++ b/.gitignore @@ -0,0 +1,16 @@ +# User data +data/ + +# macOS +.DS_Store + +# Editor files +*.swp +*.swo +*~ + +# Claude Code local settings +.claude/ + +# Archives +*.zip diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..8a4b561 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,50 @@ +# 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 `containerTypes` object (around line 754) - must be kept in sync with backend +- All API calls go through the `apiCall()` function which POSTs to `api.php` + +**Backend (`api.php`)**: +- JSON file-based storage in `data/` directory +- Endpoints: `get`, `add`, `update`, `delete`, `setPin`, `verifyPin` +- Default inventory defined in `$defaultInventory` array (lines 31-64) +- Container types should match frontend when modified + +**Data Storage**: +- `data/inventory.json` - Inventory items +- `data/pin.txt` - 4-digit PIN for edit mode (plain text, view-only protection) + +## Development + +This is a no-build project. To test locally: + +```bash +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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..6c038f6 --- /dev/null +++ b/README.md @@ -0,0 +1,125 @@ +# Pantry Inventory App + +A simple web app for tracking kitchen pantry items across your household. + +## Features + +- **Search** - Instantly filter ingredients by name +- **Container tracking** - 8 container types with color-coded indicators +- **Stock status** - Mark items as in-stock or out-of-stock +- **PIN protection** - Anyone can view, but editing requires a 4-digit PIN +- **QR Code** - Generate a scannable code to post on your pantry shelf +- **Shared data** - All household members see the same inventory + +## Deployment on YunoHost (My Webapp) + +### 1. Install My Webapp + +In YunoHost admin panel: +1. Go to **Applications** → **Install** +2. Search for "My Webapp" +3. Configure: + - **Label**: Pantry (or whatever you prefer) + - **Domain/Path**: e.g., `yourdomain.com/pantry` + - **PHP version**: 8.2 or higher + - **Database**: None needed +4. Install + +### 2. Upload Files + +Connect via SFTP using the credentials shown after installation, then upload to the `www` folder: + +``` +www/ +├── index.html (the main app) +├── api.php (backend API) +└── data/ (created automatically) + ├── inventory.json + └── pin.txt +``` + +### 3. Set Permissions + +The `data` folder needs to be writable by the web server. This should happen automatically, but if you have issues: + +```bash +# SSH into your YunoHost server +cd /var/www/pantry/www # adjust path as needed +mkdir -p data +chmod 755 data +``` + +### 4. First Use + +1. Visit your app URL (e.g., `https://yourdomain.com/pantry`) +2. The app loads with a pre-populated inventory based on your photos +3. Tap the lock icon → Set a 4-digit PIN for your household +4. Share the PIN with family members who need edit access +5. Go to the QR Code tab and print it for your pantry + +## File Structure + +``` +index.html - Frontend (HTML/CSS/JS, no build step) +api.php - Backend API (reads/writes JSON files) +data/ + inventory.json - Your inventory data + pin.txt - Stored PIN (hashed would be better for production) +``` + +## Container Types + +The app supports these container types (edit in both index.html and api.php if you want to change them): + +| ID | Name | +|----|------| +| glass-bail-large | Glass Bail Jar (Large) | +| glass-bail-medium | Glass Bail Jar (Medium) | +| glass-bail-small | Glass Bail Jar (Small) | +| oxo-large | OXO Container (Large) | +| oxo-medium | OXO Container (Medium) | +| oxo-small | OXO Container (Small) | +| original-package | Original Package | +| mason-jar | Mason Jar | + +## Customization + +### Adding Container Types + +1. In `index.html`, find the `containerTypes` object and add your new type +2. In the ` + + + + + +
+ +
+ + + + + + + +
+ + + + + + + + + + + + + diff --git a/og-image.png b/og-image.png new file mode 100644 index 0000000..7927d97 Binary files /dev/null and b/og-image.png differ diff --git a/og-image.svg b/og-image.svg new file mode 100644 index 0000000..5ceda45 --- /dev/null +++ b/og-image.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + 🫙 + + + Pantry + + + Kitchen Inventory Tracker +