Skip to content

ptanmay143/recipe-net

Repository files navigation


Project license Pull Requests welcome code with love by ptanmay143

Table of Contents

About

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

Built With

  • Node.js + Express — web server and route handling.
  • Pug — server-side templating for index, tool, and recommendation views.
  • 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.

Getting Started

Setup includes both JavaScript and Python dependencies plus one-time data artifact generation. Once artifacts exist, normal development requires only starting the Node server.

Prerequisites

  • 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 filedata/cookstr-recipes.json is expected by preprocessing script.

Installation

  1. Clone the repository.
git clone https://github.com/ptanmay143/recipe-net.git
  1. Enter the project folder.
cd recipe-net
  1. Install Node dependencies.
npm install
  1. Install Python dependencies.
pip install -r requirements.txt
  1. Place raw data file.
Expected path: data/cookstr-recipes.json
  1. Generate processed dataset and corpus.
python py-data-preprocess.py
  1. Generate TF-IDF artifacts.
python py-calculate-tf-idf.py
  1. Start the web server.
npm start
  1. Verify setup.
Open http://localhost:9876 and navigate to /tool, select ingredients,
then confirm recommendation page renders recipe details.

Environment Variables

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

Usage

Start server:

npm start

Open 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,10

Expected 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.

Roadmap

See the open issues for a full list of proposed features and known 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).


Support

Reach out to the maintainer at one of the following places:


Project Assistance

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!


Contributing

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:

  1. Fork and create a feature branch.
  2. Apply focused changes to either server, preprocessing, or UI layers.
  3. Rebuild data artifacts if your change impacts corpus/vectorization.
  4. Validate route behavior locally.
  5. Open a pull request with reproducible steps.

No dedicated docs/CONTRIBUTING.md is currently present.


Authors & Contributors

The original setup of this repository is by Tanmay Pachpande.

For a full list of all authors and contributors, see the contributors page.


Security

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.


License

This project is licensed under the MIT License.

See LICENSE for more information.


Acknowledgements

  • 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.

About

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.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors