# somoye123/meology architecture

> Architecture diagram of the GitHub repository somoye123/meology, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/somoye123/meology
- Repository: https://github.com/somoye123/meology

## Overview

##### Project type and purpose
- This is a single-page application (SPA) built entirely in React that uses Redux for client-side state management.
- It fetches meal data from the external “The Meal DB” REST API, displays a searchable list of meals, and supports viewing details of a selected meal.
- There is no custom backend: the app lives in the browser, interacts with Redux, and makes HTTP calls to a third-party service.

##### File structure
- Top‐level directories:
- public/ – static HTML entry-point (index.html), manifest, robots.txt
- src/ – application source code
- .github/, config files, linter configs, README, package.json
- src/ layers:
- src/components/ – reusable UI components (Navbar, Loading, Meal, MealList, SearchForm)
- src/pages/ – route-level views (Home, About, Error, SingleMeal)
- src/api/ – HTTP utility and mealApi module that wraps fetch calls
- src/redux/ – Redux setup
– actions/ (action creators, actionTypes.js)
– reducers/ (slice reducers, index.js composition, initialState.js)
– configureStore.js (store creation with redux-thunk middleware)
- src/__tests__/ – Jest and React Testing Library unit tests and snapshots

##### Key architectural insights from README
- React + React Router for routing between Home, About, SingleMeal pages
- Redux + redux-thunk for unidirectional data flow and async API calls
- prop-types for runtime component prop validation
- No backend code; external service is the only data provider

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer" 
        direction TB
        Browser["Browser/Client"]:::presentation
        Index["React DOM Bootstrap\n(src/index.js)"]:::presentation
        AppComp["App Component\n(src/components/App.js)"]:::presentation
        Router["React Router"]:::presentation
        subgraph "Page Views"
            direction TB
            HomePage["Home Page\n(src/pages/Home.js)"]:::presentation
            AboutPage["About Page\n(src/pages/About.js)"]:::presentation
            ErrorPage["Error/Fallback Page\n(src/pages/Error.js)"]:::presentation
            SingleMealPage["Single Meal Page\n(src/pages/SingleMeal.js)"]:::presentation
        end
        subgraph "UI Components"
            direction TB
            Navbar["Navbar Component\n(src/components/Navbar.js)"]:::presentation
            LoadingComp["Loading Indicator\n(src/components/Loading.js)"]:::presentation
            MealComp["Single Meal Card\n(src/components/Meal.js)"]:::presentation
            MealListComp["Meal List\n(src/components/MealList.js)"]:::presentation
            SearchFormComp["Search Form\n(src/components/SearchForm.js)"]:::presentation
        end
    end

    %% State Management Layer
    subgraph "State Management Layer"
        direction TB
        StoreConfig["Redux Store Setup\n(src/redux/configureStore.js)"]:::state
        Thunk["redux-thunk Middleware"]:::state
        ActionTypes["Action Types\n(src/redux/actions/actionTypes.js)"]:::state
        subgraph "Action Creators"
            direction TB
            LoadingAction["Loading Actions\n(src/redux/actions/loadingAction.js)"]:::state
            MealAction["Single Meal Actions\n(src/redux/actions/mealAction.js)"]:::state
            MealsAction["Meals List Actions\n(src/redux/actions/mealsAction.js)"]:::state
            SearchTermAction["Search Term Actions\n(src/redux/actions/searchTermAction.js)"]:::state
        end
        subgraph "Reducers"
            direction TB
            InitialState["Initial State\n(src/redux/reducers/initialState.js)"]:::state
            LoadingReducer["Loading Reducer\n(src/redux/reducers/loadingReducer.js)"]:::state
            MealReducer["Single Meal Reducer\n(src/redux/reducers/mealReducer.js)"]:::state
            MealsReducer["Meals List Reducer\n(src/redux/reducers/mealsReducer.js)"]:::state
            SearchTermReducer["Search Term Reducer\n(src/redux/reducers/searchTermReducer.js)"]:::state
            RootReducer["Root Reducer\n(src/redux/reducers/index.js)"]:::state
        end
    end

    %% Data Integration Layer
    subgraph "Data Integration Layer"
        direction TB
        ApiUtils["Fetch Wrapper\n(src/api/apiUtils.js)"]:::integration
        MealApi["Meal API Client\n(src/api/mealApi.js)"]:::integration
        ExternalApi["TheMealDB REST API"]:::external
    end

    %% Data Flow
    Browser -->|loads| Index
    Index -->|renders| AppComp
    AppComp -->|uses| Router
    Router --> HomePage
    Router --> AboutPage
    Router --> ErrorPage
    Router --> SingleMealPage

    HomePage -->|renders| Navbar
    HomePage -->|renders| SearchFormComp
    HomePage -->|renders| MealListComp
    SingleMealPage -->|renders| Navbar
    SingleMealPage -->|renders| MealComp
    anyComp(["UI Components"]) -.->|props| LoadingComp

    %% UI to Actions
    SearchFormComp -->|dispatches| LoadingAction
    SearchFormComp -->|dispatches| MealsAction
    MealListComp -->|dispatches| LoadingAction
    MealListComp -->|dispatches| MealsAction
    SingleMealPage -->|dispatches| LoadingAction
    SingleMealPage -->|dispatches| MealAction

    %% Actions to API
    LoadingAction -->|uses| MealApi
    MealsAction -->|calls| MealApi
    MealAction -->|calls| MealApi
    MealApi -->|calls| ApiUtils
    ApiUtils -->|fetches| ExternalApi

    %% API to Reducers
    ApiUtils -->|response| LoadingAction
    ApiUtils -->|response| MealsAction
    ApiUtils -->|response| MealAction

    %% Reducers update store
    LoadingAction -->|dispatches| LoadingReducer
    MealsAction -->|dispatches| MealsReducer
    MealAction -->|dispatches| MealReducer
    SearchTermAction -->|dispatches| SearchTermReducer
    ActionTypes -->|used by| LoadingAction
    ActionTypes -->|used by| MealsAction
    ActionTypes -->|used by| MealAction
    ActionTypes -->|used by| SearchTermAction
    InitialState -->|provides| RootReducer
    LoadingReducer -->|combined in| RootReducer
    MealsReducer -->|combined in| RootReducer
    MealReducer -->|combined in| RootReducer
    SearchTermReducer -->|combined in| RootReducer
    RootReducer -->|used by| StoreConfig
    Thunk -->|applied in| StoreConfig
    StoreConfig -->|provides| AppComp

    %% Store to UI
    StoreConfig -->|provides| HomePage
    StoreConfig -->|provides| SingleMealPage
    StoreConfig -->|provides| UIComponents

    %% Click Events
    click Browser "https://github.com/somoye123/meology/blob/master/public/index.html"
    click Index "https://github.com/somoye123/meology/blob/master/src/index.js"
    click AppComp "https://github.com/somoye123/meology/blob/master/src/components/App.js"
    click Navbar "https://github.com/somoye123/meology/blob/master/src/components/Navbar.js"
    click LoadingComp "https://github.com/somoye123/meology/blob/master/src/components/Loading.js"
    click MealComp "https://github.com/somoye123/meology/blob/master/src/components/Meal.js"
    click MealListComp "https://github.com/somoye123/meology/blob/master/src/components/MealList.js"
    click SearchFormComp "https://github.com/somoye123/meology/blob/master/src/components/SearchForm.js"
    click HomePage "https://github.com/somoye123/meology/blob/master/src/pages/Home.js"
    click AboutPage "https://github.com/somoye123/meology/blob/master/src/pages/About.js"
    click ErrorPage "https://github.com/somoye123/meology/blob/master/src/pages/Error.js"
    click SingleMealPage "https://github.com/somoye123/meology/blob/master/src/pages/SingleMeal.js"
    click StoreConfig "https://github.com/somoye123/meology/blob/master/src/redux/configureStore.js"
    click ActionTypes "https://github.com/somoye123/meology/blob/master/src/redux/actions/actionTypes.js"
    click LoadingAction "https://github.com/somoye123/meology/blob/master/src/redux/actions/loadingAction.js"
    click MealAction "https://github.com/somoye123/meology/blob/master/src/redux/actions/mealAction.js"
    click MealsAction "https://github.com/somoye123/meology/blob/master/src/redux/actions/mealsAction.js"
    click SearchTermAction "https://github.com/somoye123/meology/blob/master/src/redux/actions/searchTermAction.js"
    click InitialState "https://github.com/somoye123/meology/blob/master/src/redux/reducers/initialState.js"
    click LoadingReducer "https://github.com/somoye123/meology/blob/master/src/redux/reducers/loadingReducer.js"
    click MealReducer "https://github.com/somoye123/meology/blob/master/src/redux/reducers/mealReducer.js"
    click MealsReducer "https://github.com/somoye123/meology/blob/master/src/redux/reducers/mealsReducer.js"
    click SearchTermReducer "https://github.com/somoye123/meology/blob/master/src/redux/reducers/searchTermReducer.js"
    click RootReducer "https://github.com/somoye123/meology/blob/master/src/redux/reducers/index.js"
    click ApiUtils "https://github.com/somoye123/meology/blob/master/src/api/apiUtils.js"
    click MealApi "https://github.com/somoye123/meology/blob/master/src/api/mealApi.js"

    %% Styles
    classDef presentation fill:#D0E8FF,stroke:#333,stroke-width:1px
    classDef state fill:#DFFFD0,stroke:#333,stroke-width:1px
    classDef integration fill:#FFF5D0,stroke:#333,stroke-width:1px
    classDef external fill:#FFD0D0,stroke:#333,stroke-width:1px
```
