# ernestjavier/cookpediav2 architecture

> Architecture diagram of the GitHub repository ernestjavier/cookpediav2, 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/ernestjavier/cookpediav2
- Repository: https://github.com/ernestjavier/cookpediav2

## Overview

Cookpedia is a mobile-first recipe discovery and account app: users sign in or register, browse/search and filter recipes, inspect recipe details, save favorites, and manage profile preferences and settings. The React/Ionic frontend routes users by authentication state; shared context coordinates API requests and UI state. The Express API handles auth and recipe/account endpoints backed by SQLite. README documents broader capability areas, while several route implementations and UI modules were not sampled; their relationships are included only where explicitly documented.

Main entry points: [`src/components/AppContext.jsx`](https://github.com/ernestjavier/cookpediav2/blob/main/src/components/AppContext.jsx) (App state), [`src/pages/Dashboard.jsx`](https://github.com/ernestjavier/cookpediav2/blob/main/src/pages/Dashboard.jsx) (Recipe dashboard), [`src/App.jsx`](https://github.com/ernestjavier/cookpediav2/blob/main/src/App.jsx) (Route shell), [`src/pages/Profile.jsx`](https://github.com/ernestjavier/cookpediav2/blob/main/src/pages/Profile.jsx) (Profile)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Mobile client"]
  node_app["Route shell<br/>[App.jsx]"]
  node_login["Sign in / sign up<br/>[Login.jsx]"]
  node_context["App state<br/>[AppContext.jsx]"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_domain["Recipe experience"]
  node_dashboard["Recipe dashboard<br/>[Dashboard.jsx]"]
  node_profile["Profile<br/>[Profile.jsx]"]
  node_recipe_card["Recipe cards<br/>[RecipeCard.jsx]"]
  node_featured["Featured recipe"]
  node_recipe_detail["Recipe detail"]
  node_favorites["Favorites list"]
  node_settings["Preferences and settings<br/>[SettingsModal.jsx]"]
  node_navigation["Bottom navigation<br/>[BottomNav.jsx]"]
  node_image["Image fallback"]
end

subgraph group_service["API services"]
  node_api["Express API<br/>[index.js]"]
  node_auth["Password and tokens<br/>[auth.js]"]
  node_middleware["Auth middleware<br/>[middleware.js]"]
end

subgraph group_persistence["SQLite persistence"]
  node_seed["Initial recipe data<br/>[seedData.js]"]
  node_db[("SQLite database<br/>[db.js]")]
end

node_user(("Cookpedia user"))

node_user -->|"uses"| node_app
node_app -->|"routes guests"| node_login
node_app -->|"routes users"| node_dashboard
node_app -->|"routes users"| node_profile
node_app -->|"provides state"| node_context
node_login -->|"authenticates through"| node_context
node_dashboard -->|"reads recipe state"| node_context
node_profile -->|"reads account state"| node_context
node_context -->|"requests data"| node_api_client
node_api_client -->|"sends HTTP requests"| node_api
node_api -->|"returns JSON"| node_api_client
node_api -->|"verifies and creates tokens"| node_auth
node_api -->|"protects routes"| node_middleware
node_api -->|"queries and updates"| node_db
node_db -->|"loads initial records"| node_seed
node_db -->|"hashes new passwords"| node_auth
node_dashboard -->|"renders recipes"| node_recipe_card
node_dashboard -->|"renders recommendation"| node_featured
node_dashboard -->|"opens details"| node_recipe_detail
node_profile -->|"opens saved recipes"| node_favorites
node_profile -->|"opens settings"| node_settings
node_dashboard -->|"renders navigation"| node_navigation
node_profile -->|"renders navigation"| node_navigation
node_recipe_card -->|"uses fallback image"| node_image
node_featured -->|"uses fallback image"| node_image
node_recipe_detail -->|"uses fallback image"| node_image
node_recipe_detail -->|"toggles favorites"| node_context
node_favorites -->|"reads favorites"| node_context
node_settings -->|"updates preferences"| node_context

click node_app "https://github.com/ernestjavier/cookpediav2/blob/main/src/App.jsx"
click node_login "https://github.com/ernestjavier/cookpediav2/blob/main/src/pages/Login.jsx"
click node_dashboard "https://github.com/ernestjavier/cookpediav2/blob/main/src/pages/Dashboard.jsx"
click node_profile "https://github.com/ernestjavier/cookpediav2/blob/main/src/pages/Profile.jsx"
click node_context "https://github.com/ernestjavier/cookpediav2/blob/main/src/components/AppContext.jsx"
click node_api_client "https://github.com/ernestjavier/cookpediav2/blob/main/src/services/api.js"
click node_recipe_card "https://github.com/ernestjavier/cookpediav2/blob/main/src/components/RecipeCard.jsx"
click node_featured "https://github.com/ernestjavier/cookpediav2/blob/main/src/components/FeaturedRecipeCard.jsx"
click node_recipe_detail "https://github.com/ernestjavier/cookpediav2/blob/main/src/components/RecipeDetailModal.jsx"
click node_favorites "https://github.com/ernestjavier/cookpediav2/blob/main/src/components/FavoritesListModal.jsx"
click node_settings "https://github.com/ernestjavier/cookpediav2/blob/main/src/components/SettingsModal.jsx"
click node_navigation "https://github.com/ernestjavier/cookpediav2/blob/main/src/components/BottomNav.jsx"
click node_image "https://github.com/ernestjavier/cookpediav2/blob/main/src/components/ImageWithFallback.jsx"
click node_api "https://github.com/ernestjavier/cookpediav2/blob/main/server/src/index.js"
click node_auth "https://github.com/ernestjavier/cookpediav2/blob/main/server/src/auth.js"
click node_middleware "https://github.com/ernestjavier/cookpediav2/blob/main/server/src/middleware.js"
click node_seed "https://github.com/ernestjavier/cookpediav2/blob/main/server/src/seedData.js"
click node_db "https://github.com/ernestjavier/cookpediav2/blob/main/server/src/db.js"

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_login,node_context,node_api_client,node_user toneBlue
class node_dashboard,node_profile,node_recipe_card,node_featured,node_recipe_detail,node_favorites,node_settings,node_navigation,node_image toneAmber
class node_api,node_auth,node_middleware toneMint
class node_seed,node_db toneRose
```

## Components

### Mobile client

- [Route shell](https://github.com/ernestjavier/cookpediav2/blob/main/src/App.jsx): `src/App.jsx`
- [Sign in / sign up](https://github.com/ernestjavier/cookpediav2/blob/main/src/pages/Login.jsx): `src/pages/Login.jsx`
- [App state](https://github.com/ernestjavier/cookpediav2/blob/main/src/components/AppContext.jsx): `src/components/AppContext.jsx`
- [API client](https://github.com/ernestjavier/cookpediav2/blob/main/src/services/api.js): `src/services/api.js`

### Recipe experience

- [Recipe dashboard](https://github.com/ernestjavier/cookpediav2/blob/main/src/pages/Dashboard.jsx): `src/pages/Dashboard.jsx`
- [Profile](https://github.com/ernestjavier/cookpediav2/blob/main/src/pages/Profile.jsx): `src/pages/Profile.jsx`
- [Recipe cards](https://github.com/ernestjavier/cookpediav2/blob/main/src/components/RecipeCard.jsx): `src/components/RecipeCard.jsx`
- [Featured recipe](https://github.com/ernestjavier/cookpediav2/blob/main/src/components/FeaturedRecipeCard.jsx): `src/components/FeaturedRecipeCard.jsx`
- [Recipe detail](https://github.com/ernestjavier/cookpediav2/blob/main/src/components/RecipeDetailModal.jsx): `src/components/RecipeDetailModal.jsx`
- [Favorites list](https://github.com/ernestjavier/cookpediav2/blob/main/src/components/FavoritesListModal.jsx): `src/components/FavoritesListModal.jsx`
- [Preferences and settings](https://github.com/ernestjavier/cookpediav2/blob/main/src/components/SettingsModal.jsx): `src/components/SettingsModal.jsx`
- [Bottom navigation](https://github.com/ernestjavier/cookpediav2/blob/main/src/components/BottomNav.jsx): `src/components/BottomNav.jsx`
- [Image fallback](https://github.com/ernestjavier/cookpediav2/blob/main/src/components/ImageWithFallback.jsx): `src/components/ImageWithFallback.jsx`

### API services

- [Express API](https://github.com/ernestjavier/cookpediav2/blob/main/server/src/index.js): `server/src/index.js`
- [Password and tokens](https://github.com/ernestjavier/cookpediav2/blob/main/server/src/auth.js): `server/src/auth.js`
- [Auth middleware](https://github.com/ernestjavier/cookpediav2/blob/main/server/src/middleware.js): `server/src/middleware.js`

### SQLite persistence

- [Initial recipe data](https://github.com/ernestjavier/cookpediav2/blob/main/server/src/seedData.js): `server/src/seedData.js`
- [SQLite database](https://github.com/ernestjavier/cookpediav2/blob/main/server/src/db.js): `server/src/db.js`

### Other components

- **Cookpedia user**

## Connections

- Cookpedia user → Route shell: uses (evidence: `README.md`)
- Route shell → Sign in / sign up: routes guests (evidence: `src/App.jsx`)
- Route shell → Recipe dashboard: routes users (evidence: `src/App.jsx`)
- Route shell → Profile: routes users (evidence: `src/App.jsx`)
- Route shell → App state: provides state (evidence: `src/App.jsx`)
- Sign in / sign up → App state: authenticates through (evidence: `src/pages/Login.jsx`)
- Recipe dashboard → App state: reads recipe state (evidence: `src/pages/Dashboard.jsx`)
- Profile → App state: reads account state (evidence: `src/pages/Profile.jsx`)
- App state → API client: requests data (evidence: `src/components/AppContext.jsx`)
- API client → Express API: sends HTTP requests (evidence: `README.md`)
- Express API → API client: returns JSON (evidence: `README.md`)
- Express API → Password and tokens: verifies and creates tokens (evidence: `server/src/index.js`)
- Express API → Auth middleware: protects routes (evidence: `server/src/index.js`)
- Express API → SQLite database: queries and updates (evidence: `server/src/index.js`)
- SQLite database → Initial recipe data: loads initial records (evidence: `server/src/db.js`)
- SQLite database → Password and tokens: hashes new passwords (evidence: `server/src/db.js`)
- Recipe dashboard → Recipe cards: renders recipes (evidence: `src/pages/Dashboard.jsx`)
- Recipe dashboard → Featured recipe: renders recommendation (evidence: `src/pages/Dashboard.jsx`)
- Recipe dashboard → Recipe detail: opens details (evidence: `README.md`)
- Profile → Favorites list: opens saved recipes (evidence: `src/pages/Profile.jsx`)
- Profile → Preferences and settings: opens settings (evidence: `README.md`)
- Recipe dashboard → Bottom navigation: renders navigation (evidence: `src/pages/Dashboard.jsx`)
- Profile → Bottom navigation: renders navigation (evidence: `src/pages/Profile.jsx`)
- Recipe cards → Image fallback: uses fallback image (evidence: `src/components/RecipeCard.jsx`)
- Featured recipe → Image fallback: uses fallback image (evidence: `src/components/FeaturedRecipeCard.jsx`)
- Recipe detail → Image fallback: uses fallback image (evidence: `src/components/RecipeDetailModal.jsx`)
- Recipe detail → App state: toggles favorites (evidence: `src/components/RecipeDetailModal.jsx`)
- Favorites list → App state: reads favorites (evidence: `src/components/FavoritesListModal.jsx`)
- Preferences and settings → App state: updates preferences (evidence: `src/components/SettingsModal.jsx`)
