Jo eh.
Go to file
Mario Zechner 4a6b8bb225 Print date in workflow 2023-06-01 19:45:14 +02:00
.github/workflows Print date in workflow 2023-06-01 19:45:14 +02:00
.vscode Add query link generation. 2023-05-26 11:28:40 +02:00
docker Newer node image. 2023-06-01 01:27:57 +02:00
docs Updated README.md with instructions on how to deploy via GitHub pages 2023-05-28 20:42:49 +02:00
site Mario tests in prod only... 2023-06-01 19:29:49 +02:00
stores Merge branch 'main' of https://github.com/badlogic/heissepreise 2023-06-01 14:40:36 +02:00
.editorconfig chore: 🎨 add config file 2023-05-29 19:09:27 +02:00
.gitignore Fetch canonical compressed in parallel 2023-05-30 13:09:27 +02:00
LICENSE Initial commit 2023-05-08 16:51:43 +02:00
README.md docs: 📝 order of messages would be in accordance with the time it took 2023-05-29 16:10:42 +02:00
analysis.js Manually merged PR #48, Penny support (only gets us 275 products) 2023-06-01 14:40:28 +02:00
deploy.sh Mario is not good with Bash. 2023-05-27 21:57:06 +02:00
index.js Fix scheduling of data fetch, do it daily at 7am instead of every 24h after launching the server. 2023-06-01 14:59:02 +02:00
package-lock.json Add Unimarkt Support 2023-05-29 00:08:32 +02:00
package.json Add Unimarkt Support 2023-05-29 00:08:32 +02:00
package.sh Add package.sh to create Windows/Linux/macOS apps. Closes #11. 2023-05-23 14:24:32 +02:00
pages.js Generate compressed files in pages.js 2023-05-30 15:46:10 +02:00
pages.sh Closes #34 2023-05-30 10:34:25 +02:00
restore.js Closes #34 2023-05-30 10:34:25 +02:00
stats.sh Fix Billa weighted item prices analogously to Spar. See #10 2023-05-20 15:38:40 +02:00
stuff.js Added Rewe Germany 2023-06-01 01:09:25 +02:00

README.md

Heisse Preise

A terrible grocery price search "app". Fetches data from big Austrian grocery chains daily and lets you search them. See https://heisse-preise.io.

You can also get the raw data. The raw data is returned as a JSON array of items. An item has the following fields:

  • store: (billa, spar, hofer, dm, lidl, mpreis)
  • name: the product name.
  • price: the current price in €.
  • priceHistory: an array of { date: "yyyy-mm-dd", price: number } objects, sorted in descending order of date.
  • unit: unit the product is sold at. May be undefined.
  • bio: whether this product is classified as organic/"Bio"

The project consists of a trivial NodeJS Express server responsible for fetching the product data, massaging it, and serving it to the front end (see index.js). The front end is a least-effort vanilla HTML/JS search form (see sources in site/).

Run via NodeJS

Install NodeJS, then run this in a shell of your choice.

git clone https://github.com/badlogic/heissepreise
cd heissepreise
npm install
node index.js

The first time you run this, the data needs to be fetched from the stores. You should see log out put like this.

Fetching data for date: 2023-05-23
Fetched LIDL data, took 0.77065160000324 seconds
Fetched MPREIS data, took 13.822936070203781 seconds
Fetched SPAR data, took 17.865891209602356 seconds
Fetched BILLA data, took 52.95784649944306 seconds
Fetched HOFER data, took 64.83968291568756 seconds
Fetched DM data, took 438.77065160000324 seconds
Merged price history
Example app listening on port 3000

Once the app is listening per default on port 3000, open http://localhost:3000 in your browser.
Note: If you want to start on a different port add it as the third parameter, e.g. node index.js 3001 will map to port 3001.

Subsequent starts will fetch the data asynchronously, so you can start working immediately.

Run via GitHub pages & GitHub workflows

Create a GitHub account and pick a username. Below, we assume your user name is hotprices123. Replace hotprices123 with your real username everywhere you see it below

  1. Log in to your GitHub account.
  2. Fork this repository and name the repository hotprices123.github.io.
  3. In your forked repository:
    1. go to Settings > Pages, then under Branch select the main branch, and the docs/ directory as shown in this screenshot. docs/github-pages.png
    2. go to Settings > Actions > General, then under Workflow permissions, select Read and write permissions as shown in this screenshot. docs/github-permissions.png
    3. go to the Actions tab, then select the Pages Update workflow in the list to the left, then click Enable workflow. Confirm that you know what you are doing. docs/github-workflow.png
  4. Trigger the workflow once manually to build the initial site and data. docs/github-workflow2.png
  5. Once the workflow has finished, go to https:/hotprices123.github.io and enjoy your price comparisons.

The data will be automatically fetched once a day at 8am (no idea what timezone), and the site will be updated.

To get the latest code changes from this repository into your fork:

  1. Go to https://github.com/hotprices123/hotprices123.github.io/compare/main...badlogic:heissepreise:main
  2. Click on Create pull request docs/github-pullrequest.png
  3. Enter a Title like "Updated from upstream", then click `Create pull request`` docs/github-pullrequest2.png
  4. Click Merge pull request docs/github-pullrequest3.png

Your site will now use the latest source code changes from this repository. It will be automatically updated and is usually live under https://hotprices123.github.io within 10-15 minutes.

Generating a self-contained executable

Run the package.shscript in a Bash shell. It will generate a folder dist/ with executable for Windows, Linux, and MacOS. Run the executable for your OS.

Docker

The project has a somewhat peculiar Docker Compose setup tailored to my infrastructure. All compose config files are in docker/ including a simple Bash script to start and interact with the containers. This is the setup I use for both development and deployment.

For development, run docker/control.sh startdev. You can connect to both the NodeJS server and the client for debugging in Visual Studio code via the client-server launch configuration (found in .vscode/launch.json).

For production, run docker/control.sh start.