SmartGrocer / implementation

From purchase history to a reviewed shopping plan.

React, FastAPI, and MongoDB connect purchase records to replenishment forecasts and household-specific shopping lists.

Read the product case

One purchase, five steps

  1. An authenticated household records a manual purchase or imports receipt text.
  2. The server validates the request and derives household scope from the signed session and active membership.
  3. Product normalization connects the event to a canonical household product.
  4. The forecasting service calculates the median interval between distinct observed purchase dates and returns a next-need date, observation count, variation, and confidence indicator.
  5. The user approves, defers, removes, or edits a proposal before it becomes a shopping-list item.

A worked forecast example

For purchase dates October 1, October 8, and October 15, the two observed intervals are seven days. The median interval is seven days, so the next-need estimate is October 22. This fictional example illustrates the implemented calculation; it is not a measured purchasing outcome.

Household authorization

Protected routes validate a signed session and confirm active user, household, and membership records before querying household data. The browser cannot select another household’s scope. Cookie-authenticated mutations also require a matching CSRF header; logout records server-side token revocation.

Test scenarios in the implementation

  • Unauthenticated household-data requests are denied.
  • Registration rejects an invalid invite code.
  • A mutation without the CSRF header is denied.
  • A second household cannot read or modify the first household’s item.
  • Resetting one household does not clear another household’s records.
  • A logged-out session cannot access the authenticated user endpoint.

Implementation scope

The forecast is an explainable statistical baseline using purchase intervals. Image/PDF receipt OCR and live retailer prices are not part of this baseline. The source repository remains private during pilot development; this walkthrough summarizes the inspected architecture and test scenarios without exposing household data or credentials.

Return to demos, code, and work samples