There are two ways to run the Corner Grocer browser demo: via GitHub Pages, where no setup is needed and the demo loads instantly with sample data pre-populated, or locally by openingDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/apursley2012/corner-grocer/llms.txt
Use this file to discover all available pages before exploring further.
demo.html directly in any modern browser after downloading the repository. Both paths give you the full interactive experience — no Python installation, no database configuration, and no web server required.
Launching the demo
GitHub Pages — no setup required
Visit the project’s GitHub Pages URL. The demo loads immediately in your browser with a default dataset of grocery items already in place. Every menu option is available from the moment the page finishes loading — no login, no installation, and no configuration needed.
Run locally — open demo.html directly
Clone or download the repository to your machine. Locate
demo.html in the project root and open it in any modern browser (Chrome, Firefox, Edge, or Safari). You can open it directly from your file system — no local web server is needed. The demo behaves identically to the GitHub Pages version.Using the menu
The left sidebar contains a Menu Options section with nine numbered buttons that correspond directly to the nine menu options in the Python command-line application. Click any button to load its panel in the main content area.| # | Button label | What it does in the browser |
|---|---|---|
| 1 | Look up item frequency | Displays a text input. Type an item name and click the lookup button to see how many times that item appears in the current dataset. Returns a “not found” message if the item is absent. |
| 2 | Print all frequencies | Immediately renders the full item list with each item’s purchase count, displayed in the output panel as plain text. |
| 3 | Print histogram | Renders a text histogram in the output panel. Each item is followed by a row of asterisks — one * per occurrence — replicating the visualization from the Python and C++ versions. |
| 4 | Sort alphabetically | Re-renders the full frequency list in ascending A–Z order by item name. |
| 5 | Sort by frequency | Re-renders the full frequency list sorted from highest purchase count to lowest. Items with equal counts are sub-sorted alphabetically. |
| 6 | Search specific item | Displays a text input. Enter an item name to search for an exact match first; if no exact match is found, the demo returns all items whose normalized name contains the search term as a partial match. |
| 7 | Save frequency list | Generates a plain-text representation of all item frequencies and triggers a browser download of frequency_list.txt. A confirmation message appears in the output panel when the download is initiated. |
| 8 | Save histogram | Generates the asterisk histogram as plain text and triggers a browser download of frequency_histogram.txt. A confirmation message appears in the output panel when the download is initiated. |
| 9 | Exit | Simulates the exit behavior of the command-line application. In the browser context, the output panel displays “Goodbye!” followed by a note that the program would terminate in the command-line version. To fully close the demo, navigate away from the page or close the browser tab. |
Adding items
The Add New Items button sits at the top of the sidebar, above the numbered menu options. Clicking it opens the item entry panel in the main content area. To add items:- Type one grocery item per line in the textarea. For example:
- Click the Add to Database button. The demo validates every line — only letters and spaces are accepted. If any line contains invalid characters, the entire batch is rejected and the invalid entries are listed.
- On success, the items are appended to the current dataset and the Data Summary card in the sidebar updates immediately to reflect the new total item count, unique item count, and top-three most frequent items.
Data persistence in the browser
The demo uses browserlocalStorage to retain your data between page visits. Any items added through the Add New Items panel are written to localStorage immediately. If you refresh the page or close and reopen the tab, the demo restores your saved items automatically — the dataset persists as long as localStorage is intact.
Keep in mind that localStorage is scoped to the specific browser and origin:
- Data entered in Chrome is not visible in Firefox or Edge.
- Data entered in a normal browser window is not visible in a private/incognito window.
- Clearing your browser’s site data, cookies, or cache for the GitHub Pages origin (or the local file origin) will reset the dataset to the built-in default grocery items.
frequency_list.txt first.