# nextcloud/cookbook architecture

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

- Interactive diagram: https://gitdiagram.com/nextcloud/cookbook
- Repository: https://github.com/nextcloud/cookbook

## Overview

Nextcloud Cookbook manages a user’s recipe library as schema.org-style JSON files. A user browses or searches recipes, opens one to view or edit it, or submits a recipe URL for import; the server downloads and parses the page, extracts recipe data, and stores it in the configured folder. The UI also supports recipe images and thumbnails, settings, and library rescan/indexing. Backend service links are supported by sampled source references; several UI and controller relationships are documented or indexed but their implementations were not sampled.

Main entry points: [`lib/Service/RecipeService.php`](https://github.com/nextcloud/cookbook/blob/master/lib/Service/RecipeService.php) (Recipe service), [`src/router/index.ts`](https://github.com/nextcloud/cookbook/blob/master/src/router/index.ts) (Page routing), [`src/store/index.ts`](https://github.com/nextcloud/cookbook/blob/master/src/store/index.ts) (Client state), [`lib/Service/DbCacheService.php`](https://github.com/nextcloud/cookbook/blob/master/lib/Service/DbCacheService.php) (Library indexing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Browser application"]
  node_main["App bootstrap<br/>[main.ts]"]
  node_router["Page routing<br/>[index.ts]"]
  node_searchui["Search results<br/>[SearchResults.vue]"]
  node_listui["Recipe list<br/>[RecipeList.vue]"]
  node_viewui["Recipe view<br/>[RecipeView.vue]"]
  node_editui["Recipe editor<br/>[RecipeEdit.vue]"]
  node_store["Client state<br/>[index.ts]"]
end

subgraph group_api["HTTP interface"]
  node_api_client["API client<br/>[api-interface.js]"]
  node_controllers["Recipe endpoints"]
  node_category_api["Category endpoints"]
end

subgraph group_recipe["Recipe processing"]
  node_recipe_service["Recipe service<br/>[RecipeService.php]"]
  node_download["HTML download"]
  node_extraction["Recipe extraction"]
  node_html_dom["HTML parsing"]
end

subgraph group_library["Library and search"]
  node_recipe_db[("Recipe database<br/>[RecipeDb.php]")]
  node_cache["Library indexing<br/>[DbCacheService.php]"]
  node_search_provider["Search provider<br/>[Provider.php]"]
  node_user_config["User settings"]
  node_user_folder["Recipe folder"]
  node_recipe_files["Recipe JSON files"]
end

subgraph group_media["Images and media"]
  node_image_service["Image service<br/>[ImageService.php]"]
  node_image_files["Image files"]
  node_thumbnails["Thumbnail files"]
end

node_user(("Cookbook user"))
node_recipe_site(("Recipe website"))
node_nextcloud(("Nextcloud platform"))

node_user -->|"browses"| node_router
node_main -->|"initializes"| node_router
node_main -->|"initializes"| node_store
node_router -->|"routes searches"| node_searchui
node_router -->|"routes recipe view"| node_viewui
node_router -->|"routes editing"| node_editui
node_searchui -->|"loads results"| node_store
node_searchui -->|"renders"| node_listui
node_viewui -->|"reads recipe"| node_store
node_editui -.->|"saves recipe"| node_store
node_store -->|"requests data"| node_api_client
node_api_client -.->|"calls endpoints"| node_controllers
node_controllers -->|"delegates"| node_recipe_service
node_category_api -->|"uses service"| node_recipe_service
node_user -->|"imports URL"| node_recipe_site
node_recipe_service -->|"downloads page"| node_download
node_download -->|"fetches HTML"| node_recipe_site
node_download -->|"parses HTML"| node_html_dom
node_recipe_service -->|"extracts recipe"| node_extraction
node_recipe_service -->|"updates records"| node_recipe_db
node_recipe_service -.->|"stores JSON"| node_recipe_files
node_recipe_service -->|"resolves folder"| node_user_folder
node_recipe_service -->|"reads settings"| node_user_config
node_recipe_service -->|"manages images"| node_image_service
node_image_service -->|"accesses images"| node_image_files
node_image_service -->|"creates thumbnails"| node_thumbnails
node_cache -->|"syncs index"| node_recipe_db
node_cache -->|"reads recipes"| node_recipe_service
node_cache -->|"reads settings"| node_user_config
node_search_provider -->|"searches recipes"| node_recipe_service
node_nextcloud -.->|"dispatches requests"| node_controllers

click node_main "https://github.com/nextcloud/cookbook/blob/master/src/main.ts"
click node_router "https://github.com/nextcloud/cookbook/blob/master/src/router/index.ts"
click node_searchui "https://github.com/nextcloud/cookbook/blob/master/src/components/SearchResults.vue"
click node_listui "https://github.com/nextcloud/cookbook/blob/master/src/components/List/RecipeList.vue"
click node_viewui "https://github.com/nextcloud/cookbook/blob/master/src/components/RecipeView/RecipeView.vue"
click node_editui "https://github.com/nextcloud/cookbook/blob/master/src/components/RecipeEdit.vue"
click node_store "https://github.com/nextcloud/cookbook/blob/master/src/store/index.ts"
click node_api_client "https://github.com/nextcloud/cookbook/blob/master/src/js/api-interface.js"
click node_controllers "https://github.com/nextcloud/cookbook/blob/master/lib/Controller/Implementation/RecipeImplementation.php"
click node_category_api "https://github.com/nextcloud/cookbook/blob/master/lib/Controller/Implementation/CategoryImplementation.php"
click node_recipe_service "https://github.com/nextcloud/cookbook/blob/master/lib/Service/RecipeService.php"
click node_download "https://github.com/nextcloud/cookbook/blob/master/lib/Service/HtmlDownloadService.php"
click node_extraction "https://github.com/nextcloud/cookbook/blob/master/lib/Service/RecipeExtractionService.php"
click node_html_dom "https://github.com/nextcloud/cookbook/blob/master/lib/Helper/HtmlToDomParser.php"
click node_recipe_db "https://github.com/nextcloud/cookbook/blob/master/lib/Db/RecipeDb.php"
click node_cache "https://github.com/nextcloud/cookbook/blob/master/lib/Service/DbCacheService.php"
click node_search_provider "https://github.com/nextcloud/cookbook/blob/master/lib/Search/Provider.php"
click node_user_config "https://github.com/nextcloud/cookbook/blob/master/lib/Helper/UserConfigHelper.php"
click node_user_folder "https://github.com/nextcloud/cookbook/blob/master/lib/Helper/UserFolderHelper.php"
click node_image_service "https://github.com/nextcloud/cookbook/blob/master/lib/Service/ImageService.php"
click node_image_files "https://github.com/nextcloud/cookbook/blob/master/lib/Helper/ImageService/ImageFileHelper.php"
click node_thumbnails "https://github.com/nextcloud/cookbook/blob/master/lib/Helper/ImageService/ThumbnailFileHelper.php"

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_main,node_router,node_searchui,node_listui,node_viewui,node_editui,node_store,node_user toneBlue
class node_api_client,node_controllers,node_category_api toneAmber
class node_recipe_service,node_download,node_extraction,node_html_dom toneMint
class node_recipe_db,node_cache,node_search_provider,node_user_config,node_user_folder,node_recipe_files toneRose
class node_image_service,node_image_files,node_thumbnails,node_recipe_site,node_nextcloud toneIndigo
```

## Components

### Browser application

- [App bootstrap](https://github.com/nextcloud/cookbook/blob/master/src/main.ts): `src/main.ts`
- [Page routing](https://github.com/nextcloud/cookbook/blob/master/src/router/index.ts): `src/router/index.ts`
- [Search results](https://github.com/nextcloud/cookbook/blob/master/src/components/SearchResults.vue): `src/components/SearchResults.vue`
- [Recipe list](https://github.com/nextcloud/cookbook/blob/master/src/components/List/RecipeList.vue): `src/components/List/RecipeList.vue`
- [Recipe view](https://github.com/nextcloud/cookbook/blob/master/src/components/RecipeView/RecipeView.vue): `src/components/RecipeView/RecipeView.vue`
- [Recipe editor](https://github.com/nextcloud/cookbook/blob/master/src/components/RecipeEdit.vue): `src/components/RecipeEdit.vue`
- [Client state](https://github.com/nextcloud/cookbook/blob/master/src/store/index.ts): `src/store/index.ts`

### HTTP interface

- [API client](https://github.com/nextcloud/cookbook/blob/master/src/js/api-interface.js): `src/js/api-interface.js`
- [Recipe endpoints](https://github.com/nextcloud/cookbook/blob/master/lib/Controller/Implementation/RecipeImplementation.php): `lib/Controller/Implementation/RecipeImplementation.php`
- [Category endpoints](https://github.com/nextcloud/cookbook/blob/master/lib/Controller/Implementation/CategoryImplementation.php): `lib/Controller/Implementation/CategoryImplementation.php`

### Recipe processing

- [Recipe service](https://github.com/nextcloud/cookbook/blob/master/lib/Service/RecipeService.php): `lib/Service/RecipeService.php`
- [HTML download](https://github.com/nextcloud/cookbook/blob/master/lib/Service/HtmlDownloadService.php): `lib/Service/HtmlDownloadService.php`
- [Recipe extraction](https://github.com/nextcloud/cookbook/blob/master/lib/Service/RecipeExtractionService.php): `lib/Service/RecipeExtractionService.php`
- [HTML parsing](https://github.com/nextcloud/cookbook/blob/master/lib/Helper/HtmlToDomParser.php): `lib/Helper/HtmlToDomParser.php`

### Library and search

- [Recipe database](https://github.com/nextcloud/cookbook/blob/master/lib/Db/RecipeDb.php): `lib/Db/RecipeDb.php`
- [Library indexing](https://github.com/nextcloud/cookbook/blob/master/lib/Service/DbCacheService.php): `lib/Service/DbCacheService.php`
- [Search provider](https://github.com/nextcloud/cookbook/blob/master/lib/Search/Provider.php): `lib/Search/Provider.php`
- [User settings](https://github.com/nextcloud/cookbook/blob/master/lib/Helper/UserConfigHelper.php): `lib/Helper/UserConfigHelper.php`
- [Recipe folder](https://github.com/nextcloud/cookbook/blob/master/lib/Helper/UserFolderHelper.php): `lib/Helper/UserFolderHelper.php`
- **Recipe JSON files**

### Images and media

- [Image service](https://github.com/nextcloud/cookbook/blob/master/lib/Service/ImageService.php): `lib/Service/ImageService.php`
- [Image files](https://github.com/nextcloud/cookbook/blob/master/lib/Helper/ImageService/ImageFileHelper.php): `lib/Helper/ImageService/ImageFileHelper.php`
- [Thumbnail files](https://github.com/nextcloud/cookbook/blob/master/lib/Helper/ImageService/ThumbnailFileHelper.php): `lib/Helper/ImageService/ThumbnailFileHelper.php`

### Other components

- **Cookbook user**
- **Recipe website**
- **Nextcloud platform**

## Connections

- Cookbook user → Page routing: browses (evidence: `src/router/index.ts`)
- App bootstrap → Page routing: initializes (evidence: `src/main.ts`)
- App bootstrap → Client state: initializes (evidence: `src/main.ts`)
- Page routing → Search results: routes searches (evidence: `src/router/index.ts`)
- Page routing → Recipe view: routes recipe view (evidence: `src/router/index.ts`)
- Page routing → Recipe editor: routes editing (evidence: `src/router/index.ts`)
- Search results → Client state: loads results (evidence: `src/components/SearchResults.vue`)
- Search results → Recipe list: renders (evidence: `src/components/SearchResults.vue`)
- Recipe view → Client state: reads recipe (evidence: `src/components/RecipeView/RecipeView.vue`)
- Recipe editor → Client state: saves recipe
- Client state → API client: requests data (evidence: `src/store/index.ts`)
- API client → Recipe endpoints: calls endpoints
- Recipe endpoints → Recipe service: delegates (evidence: `lib/Controller/Implementation/RecipeImplementation.php`)
- Category endpoints → Recipe service: uses service (evidence: `lib/Controller/Implementation/CategoryImplementation.php`)
- Cookbook user → Recipe website: imports URL (evidence: `README.md`)
- Recipe service → HTML download: downloads page (evidence: `lib/Service/RecipeService.php`)
- HTML download → Recipe website: fetches HTML (evidence: `lib/Service/HtmlDownloadService.php`)
- HTML download → HTML parsing: parses HTML (evidence: `lib/Service/HtmlDownloadService.php`)
- Recipe service → Recipe extraction: extracts recipe (evidence: `lib/Service/RecipeService.php`)
- Recipe service → Recipe database: updates records (evidence: `lib/Service/RecipeService.php`)
- Recipe service → Recipe JSON files: stores JSON
- Recipe service → Recipe folder: resolves folder (evidence: `lib/Service/RecipeService.php`)
- Recipe service → User settings: reads settings (evidence: `lib/Service/RecipeService.php`)
- Recipe service → Image service: manages images (evidence: `lib/Service/RecipeService.php`)
- Image service → Image files: accesses images (evidence: `lib/Service/ImageService.php`)
- Image service → Thumbnail files: creates thumbnails (evidence: `lib/Service/ImageService.php`)
- Library indexing → Recipe database: syncs index (evidence: `lib/Service/DbCacheService.php`)
- Library indexing → Recipe service: reads recipes (evidence: `lib/Service/DbCacheService.php`)
- Library indexing → User settings: reads settings (evidence: `lib/Service/DbCacheService.php`)
- Search provider → Recipe service: searches recipes (evidence: `lib/Search/Provider.php`)
- Nextcloud platform → Recipe endpoints: dispatches requests
