Table of Contents
Recipe Net is an ingredient-driven recipe recommendation web application. Instead of searching by dish name, users choose ingredients they currently have, and the system ranks recipes based on semantic similarity between selected ingredients and a preprocessed recipe corpus.
The application targets practical cooking discovery with minimal interaction complexity: open the site, pick ingredients, and receive one high-confidence recommended recipe including title, ingredient list, instructions, and image.
At runtime, the Node.js/Express server handles page routing and orchestrates recommendation requests. For each recommendation call, it executes a Python similarity script (py-calculate-similarity.py) that loads previously generated TF-IDF artifacts and computes cosine similarity against all recipe vectors.
The recommendation quality depends on a preprocessing pipeline that converts raw Cookstr data into normalized ingredients (cookstr-data.json), corpus mapping (cookstr-corpus.json), and serialized vectorization assets (tf_idf.pickle, tf_idf_matrix.pickle). This batch step is intended as one-time setup or refresh whenever source data changes.
Screenshots
Add screenshots under docs/images/ and update this table for visual documentation.
| Home Page | Recommendation |
|---|---|
![]() |
![]() |
- Node.js + Express — web server and route handling.
- Pug — server-side templating for
index,tool, andrecommendationviews. - Python 3 — data preprocessing and similarity scoring scripts.
- scikit-learn — TF-IDF vectorization and cosine similarity.
- NumPy — argmax selection of top similarity result.
- Bootstrap / jQuery / Select2 — front-end styling and ingredient selection UI.
Setup includes both JavaScript and Python dependencies plus one-time data artifact generation. Once artifacts exist, normal development requires only starting the Node server.
- Node.js — compatible with this project’s dependency set (
express@4,pug@3,body-parser@1). - Python 3 — required for preprocessing and runtime recommendation scripts.
- pip — to install
scikit-learn. - Cookstr raw dataset file —
data/cookstr-recipes.jsonis expected by preprocessing script.
- Clone the repository.
git clone https://github.com/ptanmay143/recipe-net.git- Enter the project folder.
cd recipe-net- Install Node dependencies.
npm install- Install Python dependencies.
pip install -r requirements.txt- Place raw data file.
Expected path: data/cookstr-recipes.json
- Generate processed dataset and corpus.
python py-data-preprocess.py- Generate TF-IDF artifacts.
python py-calculate-tf-idf.py- Start the web server.
npm start- Verify setup.
Open http://localhost:9876 and navigate to /tool, select ingredients,
then confirm recommendation page renders recipe details.
No environment variables are read in current source.
| Variable | Required | Default | Description | Example Value |
|---|---|---|---|---|
| None | No | N/A | Configuration currently uses hard-coded paths/port. | N/A |
Start server:
npm startOpen application:
http://localhost:9876
Important user-facing routes:
GET /— landing page.GET /tool— ingredient selection interface.GET /recommendation?input=<comma-separated-ingredient-ids>— renders selected best-match recipe.
Example recommendation request:
GET /recommendation?input=0,5,10
Pipeline command usage examples:
python py-data-preprocess.py
python py-calculate-tf-idf.py
python py-calculate-similarity.py 0,5,10Expected similarity script output:
A zero-padded 4-digit recipe ID (e.g., 0123)
Runtime data flow:
Browser ingredient IDs -> Express /recommendation -> spawnSync Python script
-> cosine similarity against TF-IDF matrix -> best recipe ID -> lookup in cookstr-data.json
-> render recommendation.pug
Operational notes:
- Server listens on port
9876(app.listen(9876)). - Recommendation endpoint uses shell-enabled child process invocation.
- Output parsing currently slices first 4 characters, implying an implicit recipe ID formatting assumption.
See the open issues for a full list of proposed features and known bugs.
- Top Feature Requests (Add your votes using the 👍 reaction)
- Top Bugs (Add your votes using the 👍 reaction)
- Newest Bugs
Likely next improvements include input validation and safer process invocation for /recommendation, performance optimization to avoid per-request Python process spawning, and richer recommendation outputs (top-N results rather than single best match).
Reach out to the maintainer at one of the following places:
- GitHub issues
- Contact options listed on this GitHub profile
If you want to say thank you or support active development of Recipe Net:
- Add a GitHub Star to the project.
- Share benchmark results or dataset improvements with maintainers.
- Publish usage demos showing real ingredient-to-recipe scenarios.
Together, we can make Recipe Net better!
First off, thanks for taking the time to contribute! Contributions are what make the open-source community such an amazing place to learn, inspire, and create.
Recommended workflow:
- Fork and create a feature branch.
- Apply focused changes to either server, preprocessing, or UI layers.
- Rebuild data artifacts if your change impacts corpus/vectorization.
- Validate route behavior locally.
- Open a pull request with reproducible steps.
No dedicated docs/CONTRIBUTING.md is currently present.
The original setup of this repository is by Tanmay Pachpande.
For a full list of all authors and contributors, see the contributors page.
Recipe Net follows good practices of security, but 100% security cannot be assured. Recipe Net is provided "as is" without any warranty. Use at your own risk.
Known security-sensitive area in current implementation: /recommendation uses shell-enabled process execution with user-provided query input; validate and sanitize before production exposure.
This project is licensed under the MIT License.
See LICENSE for more information.
- scikit-learn community for mature text vectorization tooling.
- Express and Pug maintainers for simple full-stack web composition.
- Cookstr data source and open recipe-data ecosystem.
