# ksranjith786/suggest-recipe architecture

> Architecture diagram of the GitHub repository ksranjith786/suggest-recipe, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ksranjith786/suggest-recipe
- Repository: https://github.com/ksranjith786/suggest-recipe

## Overview

Suggest Recipe is a Flask application for finding recipes from a user’s pantry. The main workflow serves the ingredient-selection page, accepts selected ingredients and match mode, queries and ranks stored recipes, then renders paginated results with recipe details. The repository also supports populating its database from a CSV and scraping recipe sites into that store. The graph includes the major route, persistence, scraping, and presentation responsibilities. Evidence is limited to the README, source index, and excerpts provided; unsampled behavior is not assumed.

Main entry points: [`project/app.py`](https://github.com/ksranjith786/suggest-recipe/blob/master/project/app.py) (Flask app), [`project/routes/recipes.py`](https://github.com/ksranjith786/suggest-recipe/blob/master/project/routes/recipes.py) (Recipe search), [`project/database/database.py`](https://github.com/ksranjith786/suggest-recipe/blob/master/project/database/database.py) (Recipe persistence), [`project/routes/seed.py`](https://github.com/ksranjith786/suggest-recipe/blob/master/project/routes/seed.py) (CSV seeding)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["Flask app<br/>[app.py]"]
  node_home["Home routing<br/>[home.py]"]
  node_ingredients_route["Pantry page<br/>[ingredients.py]"]
  node_management["Management routes<br/>[management.py]"]
  node_fetch["Recipe lookup routes<br/>[fetch.py]"]
  node_ingredients_view["Pantry view<br/>[ingredients.html]"]
  node_error_view["Error view<br/>[error.html]"]
  node_legacy_view["Legacy recipe view<br/>[recipes_v0.html]"]
end

subgraph group_recipes["Recipe discovery"]
  node_recipes_route["Recipe search<br/>[recipes.py]"]
  node_recipes_view["Results view<br/>[recipes.html]"]
  node_cards_view["Recipe cards<br/>[recipe_cards.html]"]
end

subgraph group_data["Recipe data"]
  node_seed["CSV seeding<br/>[seed.py]"]
  node_database[("Recipe persistence<br/>[database.py]")]
  node_recipe_model["Recipe model<br/>[recipes.py]"]
  node_csv["Recipe catalog CSV<br/>[recipes.csv]"]
end

subgraph group_scrape["Recipe ingestion"]
  node_scraper["Site crawler<br/>[findSites.py]"]
  node_extractor["Recipe extractor<br/>[ingredients.py]"]
end

node_user(("Kitchen user"))
node_recipe_sites["Recipe websites"]

node_user -->|"uses"| node_app
node_app -->|"registers"| node_home
node_app -->|"registers"| node_ingredients_route
node_app -->|"registers"| node_recipes_route
node_app -->|"registers"| node_management
node_app -->|"registers"| node_fetch
node_app -->|"registers"| node_seed
node_app -->|"initializes"| node_database
node_home -->|"checks recipes"| node_database
node_home -->|"redirects when empty"| node_seed
node_home -->|"redirects"| node_ingredients_route
node_ingredients_route -->|"renders"| node_ingredients_view
node_seed -->|"reads"| node_csv
node_seed -->|"adds recipes"| node_database
node_seed -->|"redirects"| node_ingredients_route
node_user -->|"submits ingredients"| node_recipes_route
node_recipes_route -->|"queries matches"| node_database
node_recipes_route -->|"renders"| node_recipes_view
node_recipes_route -->|"renders more"| node_cards_view
node_recipes_route -->|"renders errors"| node_error_view
node_fetch -->|"queries and deletes"| node_database
node_fetch -->|"renders"| node_legacy_view
node_scraper -->|"fetches pages"| node_recipe_sites
node_scraper -->|"extracts recipe details"| node_extractor
node_scraper -->|"stores recipes"| node_database
node_extractor -->|"fetches recipe page"| node_recipe_sites
node_management -->|"references crawler"| node_scraper

click node_app "https://github.com/ksranjith786/suggest-recipe/blob/master/project/app.py"
click node_home "https://github.com/ksranjith786/suggest-recipe/blob/master/project/routes/home.py"
click node_ingredients_route "https://github.com/ksranjith786/suggest-recipe/blob/master/project/routes/ingredients.py"
click node_management "https://github.com/ksranjith786/suggest-recipe/blob/master/project/routes/management.py"
click node_fetch "https://github.com/ksranjith786/suggest-recipe/blob/master/project/routes/fetch.py"
click node_recipes_route "https://github.com/ksranjith786/suggest-recipe/blob/master/project/routes/recipes.py"
click node_seed "https://github.com/ksranjith786/suggest-recipe/blob/master/project/routes/seed.py"
click node_database "https://github.com/ksranjith786/suggest-recipe/blob/master/project/database/database.py"
click node_recipe_model "https://github.com/ksranjith786/suggest-recipe/blob/master/project/database/models/recipes.py"
click node_scraper "https://github.com/ksranjith786/suggest-recipe/blob/master/project/sites/soup/findSites.py"
click node_extractor "https://github.com/ksranjith786/suggest-recipe/blob/master/project/sites/soup/ingredients.py"
click node_ingredients_view "https://github.com/ksranjith786/suggest-recipe/blob/master/project/templates/ingredients.html"
click node_recipes_view "https://github.com/ksranjith786/suggest-recipe/blob/master/project/templates/recipes.html"
click node_cards_view "https://github.com/ksranjith786/suggest-recipe/blob/master/project/templates/partials/recipe_cards.html"
click node_error_view "https://github.com/ksranjith786/suggest-recipe/blob/master/project/templates/error.html"
click node_legacy_view "https://github.com/ksranjith786/suggest-recipe/blob/master/project/templates/recipes_v0.html"
click node_csv "https://github.com/ksranjith786/suggest-recipe/blob/master/project/static/csv/recipes.csv"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_home,node_ingredients_route,node_management,node_fetch,node_ingredients_view,node_error_view,node_legacy_view,node_user toneBlue
class node_recipes_route,node_recipes_view,node_cards_view toneAmber
class node_seed,node_database,node_recipe_model,node_csv toneMint
class node_scraper,node_extractor toneRose
class node_recipe_sites toneIndigo
```

## Components

### Web application

- [Flask app](https://github.com/ksranjith786/suggest-recipe/blob/master/project/app.py): `project/app.py`
- [Home routing](https://github.com/ksranjith786/suggest-recipe/blob/master/project/routes/home.py): `project/routes/home.py`
- [Pantry page](https://github.com/ksranjith786/suggest-recipe/blob/master/project/routes/ingredients.py): `project/routes/ingredients.py`
- [Management routes](https://github.com/ksranjith786/suggest-recipe/blob/master/project/routes/management.py): `project/routes/management.py`
- [Recipe lookup routes](https://github.com/ksranjith786/suggest-recipe/blob/master/project/routes/fetch.py): `project/routes/fetch.py`
- [Pantry view](https://github.com/ksranjith786/suggest-recipe/blob/master/project/templates/ingredients.html): `project/templates/ingredients.html`
- [Error view](https://github.com/ksranjith786/suggest-recipe/blob/master/project/templates/error.html): `project/templates/error.html`
- [Legacy recipe view](https://github.com/ksranjith786/suggest-recipe/blob/master/project/templates/recipes_v0.html): `project/templates/recipes_v0.html`

### Recipe discovery

- [Recipe search](https://github.com/ksranjith786/suggest-recipe/blob/master/project/routes/recipes.py): `project/routes/recipes.py`
- [Results view](https://github.com/ksranjith786/suggest-recipe/blob/master/project/templates/recipes.html): `project/templates/recipes.html`
- [Recipe cards](https://github.com/ksranjith786/suggest-recipe/blob/master/project/templates/partials/recipe_cards.html): `project/templates/partials/recipe_cards.html`

### Recipe data

- [CSV seeding](https://github.com/ksranjith786/suggest-recipe/blob/master/project/routes/seed.py): `project/routes/seed.py`
- [Recipe persistence](https://github.com/ksranjith786/suggest-recipe/blob/master/project/database/database.py): `project/database/database.py`
- [Recipe model](https://github.com/ksranjith786/suggest-recipe/blob/master/project/database/models/recipes.py): `project/database/models/recipes.py`
- [Recipe catalog CSV](https://github.com/ksranjith786/suggest-recipe/blob/master/project/static/csv/recipes.csv): `project/static/csv/recipes.csv`

### Recipe ingestion

- [Site crawler](https://github.com/ksranjith786/suggest-recipe/blob/master/project/sites/soup/findSites.py): `project/sites/soup/findSites.py`
- [Recipe extractor](https://github.com/ksranjith786/suggest-recipe/blob/master/project/sites/soup/ingredients.py): `project/sites/soup/ingredients.py`

### Other components

- **Kitchen user**
- **Recipe websites**

## Connections

- Kitchen user → Flask app: uses (evidence: `README.md`)
- Flask app → Home routing: registers (evidence: `project/app.py`)
- Flask app → Pantry page: registers (evidence: `project/app.py`)
- Flask app → Recipe search: registers (evidence: `project/app.py`)
- Flask app → Management routes: registers (evidence: `project/app.py`)
- Flask app → Recipe lookup routes: registers (evidence: `project/app.py`)
- Flask app → CSV seeding: registers (evidence: `project/app.py`)
- Flask app → Recipe persistence: initializes (evidence: `project/app.py`)
- Home routing → Recipe persistence: checks recipes (evidence: `project/routes/home.py`)
- Home routing → CSV seeding: redirects when empty (evidence: `project/routes/home.py`)
- Home routing → Pantry page: redirects (evidence: `project/routes/home.py`)
- Pantry page → Pantry view: renders (evidence: `project/routes/ingredients.py`)
- CSV seeding → Recipe catalog CSV: reads (evidence: `project/routes/seed.py`)
- CSV seeding → Recipe persistence: adds recipes (evidence: `project/routes/seed.py`)
- CSV seeding → Pantry page: redirects (evidence: `project/routes/seed.py`)
- Kitchen user → Recipe search: submits ingredients (evidence: `README.md`)
- Recipe search → Recipe persistence: queries matches (evidence: `project/routes/recipes.py`)
- Recipe search → Results view: renders (evidence: `project/routes/recipes.py`)
- Recipe search → Recipe cards: renders more (evidence: `project/routes/recipes.py`)
- Recipe search → Error view: renders errors (evidence: `project/routes/recipes.py`)
- Recipe lookup routes → Recipe persistence: queries and deletes (evidence: `project/routes/fetch.py`)
- Recipe lookup routes → Legacy recipe view: renders (evidence: `project/routes/fetch.py`)
- Site crawler → Recipe websites: fetches pages (evidence: `project/sites/soup/findSites.py`)
- Site crawler → Recipe extractor: extracts recipe details (evidence: `project/sites/soup/findSites.py`)
- Site crawler → Recipe persistence: stores recipes (evidence: `project/sites/soup/findSites.py`)
- Recipe extractor → Recipe websites: fetches recipe page (evidence: `project/sites/soup/ingredients.py`)
- Management routes → Site crawler: references crawler (evidence: `project/routes/management.py`)
