A household inventory management app for tracking perishable items and expiry dates. Built with FastAPI, React, and PostgreSQL.
- Myventory
Myventory is a publicly deployed personal project web-app that helps households track perishable items like snacks, groceries, fruits and vegetables - and when they expire. Users can add items in three ways: scan a product barcode using their phone camera, photograph a fruit or vegetable for automatic identification, or type the name manually. Each physical unit is tracked individually with its own expiry date, enabling precise first-expiry-first-out visibility.
Multiple independent households can sign up and use the app. All data is fully isolated per household. When items run low or are consumed, they can be moved to a shared to-buy list with a single tap.
Frontend: https://sanchitbahl.github.io/myventory
API Docs: https://myventory-production.up.railway.app/docs
Sign in with a Google account to get started. A household is created automatically on first login.
| Inventory page | Scan page | Produce identification | To-buy list | Scan confirm |
|---|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
- Google login via Clerk — no passwords, sign in with your Google account
- Multi-household support — each household has a fully isolated inventory
- Barcode scanning — scan any EAN-13 or UPC-A barcode using the device camera
- Automatic product lookup — product names resolved from Open Food Facts, a free public database covering millions of products
- Produce identification — photograph a fruit or vegetable and MobileNet (TensorFlow.js) identifies it from 80+ supported classes. Runs entirely in the browser, no server round-trip (known accuracy issue, prioritized speed)
- Manual entry — add any item by name directly, bypassing the camera entirely. Available as a fallback on the scan screen
- Editable product names — pre-filled names from Open Food Facts or MobileNet can be edited before saving
- Per-unit expiry tracking — each physical unit has its own expiry date (e.g. three cartons of milk each tracked separately)
- Expiry badges — colour-coded: green for fine, amber for expiring within 3 days, red for expired
- Edit expiry dates — tap any expiry badge to change or clear the date after adding
- Search bar — filter inventory by product name in real time
- Sort toggle — switch between expiry-first and alphabetical (A–Z) ordering
- To-buy list — when removing an item, choose to move it to the to-buy list. Separate dedicated page
- Dark / light mode — defaults to dark mode, toggle persists across sessions
- Skeleton loading states — throughout all pages
| Layer | Technology |
|---|---|
| Frontend | React 19, Tailwind CSS v4, Vite |
| Auth | Clerk (Google OAuth, JWT) |
| Barcode scanning | ZXing-js (@zxing/browser) |
| Produce identification | TensorFlow.js + MobileNet (in-browser, lazy loaded) |
| Routing | React Router v7 |
| Backend | Python, FastAPI, SQLAlchemy ORM |
| Database | PostgreSQL (production), SQLite (local dev) |
| External API | Open Food Facts |
| Frontend hosting | GitHub Pages (via GitHub Actions) |
| Backend hosting | Railway |
| CI/CD | GitHub Actions |
The system follows a standard three-tier web architecture inside a single monolithic FastAPI server.
- User visits the app → Clerk redirects to Google sign-in
- Google authenticates the user → Clerk issues a JWT
- Frontend calls
POST /api/auth/sync— backend creates household and user on first login - All subsequent API calls include
Authorization: Bearer <token> - FastAPI's
get_current_userdependency validates the token and injectshousehold_idinto every endpoint
- ZXing-js decodes the barcode from the camera
- Frontend calls
GET /api/barcode/{barcode} - Backend checks household product catalogue first (cache hit = instant, no external call)
- Cache miss → calls Open Food Facts API
- Returns product name or
not_found - User confirms/edits name and sets expiry date
- Frontend calls
POST /api/products(if new) thenPOST /api/inventory
- User taps "Identify fruit or vegetable"
- TensorFlow.js and MobileNet load from CDN on first use (~8MB, cached by browser after)
- User frames the item and taps "Capture and identify"
- A still frame is captured from the video feed
- MobileNet classifies the image and the top prediction is matched against 80+ fruit/veg keywords
- Matched name is pre-filled (editable) on the confirm screen
- Standard
POST /api/products+POST /api/inventoryflow follows
Five tables:
| Column | Type | Notes |
|---|---|---|
| id | INTEGER PK | Auto-increment |
| name | TEXT | Default: email prefix on first login |
| created_at | TIMESTAMP | Auto-set |
| Column | Type | Notes |
|---|---|---|
| id | TEXT PK | Clerk user ID (e.g. user_2abc...) |
| TEXT | Synced from Clerk | |
| household_id | INTEGER FK | → households.id |
| created_at | TIMESTAMP | Auto-set |
| Column | Type | Notes |
|---|---|---|
| id | INTEGER PK | Auto-increment |
| household_id | INTEGER FK | → households.id |
| barcode | TEXT | Nullable, unique per household |
| name | TEXT | From Open Food Facts, MobileNet, or manual entry |
| created_at | TIMESTAMP | Auto-set |
| Column | Type | Notes |
|---|---|---|
| id | INTEGER PK | Auto-increment |
| product_id | INTEGER FK | → products.id |
| expires_at | DATE | Nullable, editable after adding |
| added_at | TIMESTAMP | Auto-set |
| notes | TEXT | Nullable (e.g. "opened", "freezer") |
| Column | Type | Notes |
|---|---|---|
| id | INTEGER PK | Auto-increment |
| household_id | INTEGER FK | → households.id |
| product_id | INTEGER FK | → products.id |
| added_at | TIMESTAMP | Auto-set |
| notes | TEXT | Nullable |
All endpoints require Authorization: Bearer <clerk_jwt>. Full interactive docs at /docs.
| Method | Path | Description |
|---|---|---|
| GET | /health | Health check |
| POST | /api/auth/sync | First-login bootstrap |
| GET | /api/household | Get current household |
| PATCH | /api/household | Rename household |
| GET | /api/barcode/{barcode} | Resolve barcode (cache → Open Food Facts) |
| GET | /api/products | List household products |
| POST | /api/products | Create a product |
| GET | /api/products/{id} | Get product with all units |
| PATCH | /api/products/{id} | Update product name |
| DELETE | /api/products/{id} | Delete product and all units |
| GET | /api/inventory | List inventory grouped by product |
| POST | /api/inventory | Add one unit |
| PATCH | /api/inventory/{id} | Update expiry date or notes |
| DELETE | /api/inventory/{id} | Remove a unit |
| GET | /api/to-buy | List to-buy items |
| POST | /api/to-buy | Add item to to-buy list |
| DELETE | /api/to-buy/{id} | Remove item from to-buy list |
myventory/
├── .github/
│ └── workflows/
│ └── deploy-frontend.yml ← Auto-deploys frontend to GitHub Pages on push
├── backend/
│ ├── main.py ← FastAPI app entry point
│ ├── database.py ← DB engine and session management
│ ├── models.py ← SQLAlchemy ORM models (5 tables)
│ ├── auth.py ← Clerk JWT validation dependency
│ ├── schemas.py ← Pydantic request/response shapes
│ ├── routes.py ← All 17 API endpoints
│ ├── requirements.txt ← Python dependencies
│ ├── Dockerfile ← Container definition for Railway
│ └── .env.example ← Environment variable template
└── frontend/
├── src/
│ ├── main.jsx ← Entry point (Clerk + Router + Theme providers)
│ ├── App.jsx ← Route definitions and auth gating
│ ├── api.js ← Fetch wrapper (attaches JWT to every request)
│ ├── ThemeContext.jsx ← Dark/light mode state
│ ├── index.css ← Tailwind import
│ └── pages/
│ ├── InventoryPage.jsx ← Inventory list with search, sort, expiry editing
│ ├── ScanPage.jsx ← Barcode scan + produce identification + manual add
│ └── ToBuyPage.jsx ← To-buy list view
├── public/
│ └── 404.html ← GitHub Pages SPA routing fix
├── index.html
├── vite.config.js
└── package.json
- Python 3.12+
- Node.js 18+
- A Clerk account
- Git
git clone https://github.com/SanchitBahl/myventory.git
cd myventorycd backend
python -m venv venv
venv\Scripts\Activate.ps1
pip install -r requirements.txt
cp .env.example .envEdit .env:
DATABASE_URL=sqlite:///./inventory.db
CLERK_JWKS_URL=https://your-clerk-app.clerk.accounts.dev/.well-known/jwks.jsonRun the backend:
uvicorn main:app --reloadAPI docs available at http://localhost:8000/docs
cd frontend
npm installCreate frontend/.env:
VITE_CLERK_PUBLISHABLE_KEY=pk_test_your_key_here
VITE_API_URL=http://localhost:8000Run the frontend:
npm run devApp available at http://localhost:5173/myventory/
Note: Camera and produce identification require HTTPS in production. For local development,
localhostis exempt in all major browsers.
- Create a new Railway project from the GitHub repo, root directory:
backend - Add a PostgreSQL service to the project
- Link
DATABASE_URLfrom the PostgreSQL service variables - Add
CLERK_JWKS_URLas an environment variable - Railway detects the Dockerfile and deploys automatically on every push
- Go to repo Settings → Pages → Source: GitHub Actions
- Add repository secrets:
VITE_CLERK_PUBLISHABLE_KEYandVITE_API_URL - Push to
main— GitHub Actions builds and deploys automatically
Workflow file: .github/workflows/deploy-frontend.yml
- Clerk development mode — capped at 100 monthly active users. A custom domain is required for production mode (Clerk does not allow
github.ioorrailway.appsubdomains) - No Alembic migrations — schema changes during development require dropping and recreating the database. Alembic should be added before any live schema change
- Camera on desktop — barcode scanning and produce identification are designed for phone cameras with autofocus. Laptop webcams often cannot focus closely enough
- MobileNet coverage — supports 80+ fruit/veg classes. Uncommon or non-standard produce may not be identified, fairly quick but compromises on accuracy
- Open Food Facts coverage — strongest for European and North American packaged food. Non-food items may not be found
- Single household per user — one household per user for the POC. Multi-household support is a planned feature.
- Add Alembic migrations
- Register a custom domain and switch Clerk to production mode
- Add database indexes on
products.household_id,inventory_items.product_id,inventory_items.expires_at - Product photos (auto-fetched from Open Food Facts, user override via Cloudflare R2)
- Push notifications for items expiring within N days
- Automated to-buy suggestions when stock drops below threshold
- Multi-household membership — drop
users.household_id, addhousehold_membershipstable - Household invite flow
- Non-food barcode fallback (Open Beauty Facts, UPC Item DB)
- React Native mobile app
- Offline support with service workers
- Household consumption analytics
- Fork the repository
- Create a feature branch (
git checkout -b feature/your-feature) - Commit your changes (
git commit -m 'Add your feature') - Push to the branch (
git push origin feature/your-feature) - Open a Pull Request
MIT License — see LICENSE for details.





