Skip to content

Repository files navigation

StockMonitor

StockMonitor is a dockerized Flask web app used by pizzerias to monitor raw product price evolution from supplier invoices in PDF format.

Features

  • PDF parser architecture with parser strategies per supplier.
  • Authenticated API using @require_auth for protected endpoints.
  • Default user pre-seeded from environment variables.
  • Products with source name, editable natural name, and latest known unit price.
  • Invoices stored in database including original PDF binary and parsed entries.
  • Product history and unit price timeline.
  • Shopping list/cart with estimated total based on latest product prices.
  • Mobile-friendly web interface.

Run Locally

  1. Create env file:
cp .env.example .env
  1. Run with Docker:
docker compose up --build
  1. Open http://localhost:5000 and log in with DEFAULT_USERNAME / DEFAULT_PASSWORD from .env.

API Authentication

  1. Get token:
curl -X POST http://localhost:5000/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{"username":"admin","password":"admin123"}'
  1. Use token:
curl http://localhost:5000/api/products \
  -H "Authorization: Bearer <token>"

Main API Endpoints

  • POST /api/auth/login
  • POST /api/invoices/upload (PDF multipart file)
  • GET /api/invoices
  • GET /api/invoices/<id>
  • GET /api/products?q=...
  • PATCH /api/products/<id> (rename natural name)
  • GET /api/products/<id>/history
  • GET /api/cart
  • POST /api/cart/items
  • DELETE /api/cart/items/<item_id>

Tests

pytest

About

A simple interface that parses invoices into a standard browseable format

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages