# ankitraj10/mealstogo architecture

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

- Interactive diagram: https://gitdiagram.com/ankitraj10/mealstogo
- Repository: https://github.com/ankitraj10/mealstogo

## Overview

##### Project Type and Purpose
- This is a cross-platform mobile application built with Expo and React Native.
- Purpose: a location-aware restaurant finder with user authentication and favourite management. Users can search restaurants by city or on a map, view details, register/login, and save favourites.

##### File Structure
- Top-level “app” directory: uses Expo’s file-based routing (app/_layout.tsx). All route screens live here.
- “assets”: static assets (fonts, images, helper scripts).
- “src”: core app code
- src/components: generic UI components (typography, spacers, favourite bar)
- src/features: feature modules
– account (login/register screens + styling)
– map (map screen, callouts, search component)
– restaurant (list/search, detail screens, info cards)
- src/infrastructure: cross-cutting concerns
– navigation (stack/tab navigators)
- src/services: business logic & state management via React Contexts
– authentication, favourites, location, restaurants (with mocks & real service)
- Configs: package.json, tsconfig.json, app.json

##### Insights from README
- Expo app using create-expo-app template
- Emphasis on file-based routing

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer"
        Layout["_layout.tsx"]:::ui
        subgraph "Reusable UI Components"
            Spacer["Spacer"]:::ui
            Typography["Typography"]:::ui
            FavBar["FavouriteBar"]:::ui
            FavItem["Favourite"]:::ui
            SafeArea["SafeArea"]:::ui
        end
    end

    %% Feature Modules
    subgraph "Feature Modules"
        subgraph "Account Feature"
            AccountScreen["account.screen.js"]:::ui
            LoginScreen["login.screen.js"]:::ui
            RegisterScreen["register.screen.js"]:::ui
            AccountStyle["account.style.js"]:::ui
        end
        subgraph "Map Feature"
            MapScreen["map.screen.js"]:::ui
            MapCallout["map-callout.component.js"]:::ui
            MapSearch["search.component.js"]:::ui
        end
        subgraph "Restaurant Feature"
            RestaurantsList["restaurants.screens.js"]:::ui
            RestaurantDetails["restaurant-details.screens.js"]:::ui
            CompactInfo["compact-restaurant-info.component.js"]:::ui
            InfoCard["restaurant-info-card.component.js"]:::ui
            InfoStyles["restaurant-info-card.styles.js"]:::ui
            RestaurantSearch["search.component.js"]:::ui
        end
    end

    %% Infrastructure Layer
    subgraph "Infrastructure Layer"
        subgraph "Navigation"
            AppNav["app.navigator.js"]:::infra
            AccountNav["account.navigator.js"]:::infra
            RestaurantNav["restaurant.navigator.js"]:::infra
            NavIndex["index.js"]:::infra
        end
        subgraph "Theme"
            ThemeIndex["index.js"]:::infra
            Colors["colors.js"]:::infra
            Fonts["fonts.js"]:::infra
            Sizes["sizes.js"]:::infra
            Spacing["spacing.js"]:::infra
        end
    end

    %% Service Layer
    subgraph "Service Layer"
        subgraph "Authentication"
            AuthContext["authentication.context.js"]:::services
            AuthService["authentication.service.js"]:::services
        end
        subgraph "Location"
            LocationContext["location.context.js"]:::services
            LocationService["location.service.js"]:::services
            LocationMock["location.mock.js"]:::external
        end
        subgraph "Restaurants"
            RestaurantsContext["restraunts.context.js"]:::services
            RestaurantsService["restraunts.service.js"]:::services
            RestaurantsMock["mock/index.js"]:::external
        end
        subgraph "Favourites"
            FavouritesContext["favourite.context.js"]:::services
        end
    end

    %% External APIs & Mocks
    subgraph "External Systems"
        ExternalAPI["Geolocation & Restaurant API"]:::external
        JSONAntwerp["antwerp.json"]:::external
        JSONChicago["chicago.json"]:::external
        JSONSF["san_francisco.json"]:::external
        JSONToronto["toronto.json"]:::external
    end

    %% Entry Point
    AppEntry["App.js"]:::ui

    %% Relationships
    AppEntry -->|"wraps"| AuthContext
    AuthContext -->|"wraps"| LocationContext
    LocationContext -->|"wraps"| RestaurantsContext
    RestaurantsContext -->|"wraps"| FavouritesContext
    FavouritesContext -->|"provides to"| Layout

    Layout -->|"uses navigators"| AppNav
    AppNav -->|"routes to"| AccountNav
    AppNav -->|"routes to"| RestaurantNav

    AccountNav --> AccountScreen
    AccountScreen -->|"uses style"| AccountStyle
    AccountScreen -->|"navigateTo()"| LoginScreen
    LoginScreen -->|"navigateTo()"| RegisterScreen

    Layout -->|"renders"| MapScreen
    MapScreen --> MapCallout
    MapScreen --> MapSearch

    Layout -->|"renders"| RestaurantsList
    RestaurantsList --> RestaurantSearch
    RestaurantsList --> CompactInfo
    CompactInfo --> InfoCard
    InfoCard --> InfoStyles
    RestaurantsList --> RestaurantDetails

    %% UI to Service calls
    AccountScreen -->|"login() / register()"| AuthService
    MapSearch -->|"fetchLocation()"| LocationService
    LocationService -->|"return mock"| LocationMock
    RestaurantsList -->|"fetchRestaurants()"| RestaurantsService
    RestaurantsService -->|"return mock"| RestaurantsMock
    RestaurantDetails -->|"addFavourite()"| FavouritesContext
    FavouritesContext -->|"update"| FavouritesContext

    %% Services to External API
    LocationService -->|"real API"| ExternalAPI
    RestaurantsService -->|"real API"| ExternalAPI

    %% Click Events
    click Layout "https://github.com/ankitraj10/mealstogo/blob/main/app/_layout.tsx"
    click AppEntry "https://github.com/ankitraj10/mealstogo/blob/main/src/App.js"
    click Spacer "https://github.com/ankitraj10/mealstogo/blob/main/src/components/spacer.component.js"
    click Typography "https://github.com/ankitraj10/mealstogo/blob/main/src/components/typography.component.js"
    click FavBar "https://github.com/ankitraj10/mealstogo/blob/main/src/components/favourite/favourite-bar.component.js"
    click FavItem "https://github.com/ankitraj10/mealstogo/blob/main/src/components/favourite/favourite.component.js"
    click SafeArea "https://github.com/ankitraj10/mealstogo/blob/main/src/components/utility/safe-area.component.js"
    click AccountStyle "https://github.com/ankitraj10/mealstogo/blob/main/src/features/account/component/account.style.js"
    click AccountScreen "https://github.com/ankitraj10/mealstogo/blob/main/src/features/account/screens/account.screen.js"
    click LoginScreen "https://github.com/ankitraj10/mealstogo/blob/main/src/features/account/screens/login.screen.js"
    click RegisterScreen "https://github.com/ankitraj10/mealstogo/blob/main/src/features/account/screens/register.screen.js"
    click MapScreen "https://github.com/ankitraj10/mealstogo/blob/main/src/features/map/screens/map.screen.js"
    click MapCallout "https://github.com/ankitraj10/mealstogo/blob/main/src/features/map/component/map-callout.component.js"
    click MapSearch "https://github.com/ankitraj10/mealstogo/blob/main/src/features/map/component/search.component.js"
    click RestaurantsList "https://github.com/ankitraj10/mealstogo/blob/main/src/features/reastaurant/screens/restaurants.screens.js"
    click RestaurantDetails "https://github.com/ankitraj10/mealstogo/blob/main/src/features/reastaurant/screens/restaurant-details.screens.js"
    click CompactInfo "https://github.com/ankitraj10/mealstogo/blob/main/src/features/reastaurant/components/compact-restaurant-info.component.js"
    click InfoCard "https://github.com/ankitraj10/mealstogo/blob/main/src/features/reastaurant/components/reastaurant-info-card.component.js"
    click InfoStyles "https://github.com/ankitraj10/mealstogo/blob/main/src/features/reastaurant/components/restaurant-info-card.styles.js"
    click RestaurantSearch "https://github.com/ankitraj10/mealstogo/blob/main/src/features/reastaurant/components/search.component.js"
    click AppNav "https://github.com/ankitraj10/mealstogo/blob/main/src/infrastructure/navigation/app.navigator.js"
    click AccountNav "https://github.com/ankitraj10/mealstogo/blob/main/src/infrastructure/navigation/account.navigator.js"
    click RestaurantNav "https://github.com/ankitraj10/mealstogo/blob/main/src/infrastructure/navigation/restaurant.navigator.js"
    click NavIndex "https://github.com/ankitraj10/mealstogo/blob/main/src/infrastructure/navigation/index.js"
    click ThemeIndex "https://github.com/ankitraj10/mealstogo/blob/main/src/infrastructure/theme/index.js"
    click Colors "https://github.com/ankitraj10/mealstogo/blob/main/src/infrastructure/theme/colors.js"
    click Fonts "https://github.com/ankitraj10/mealstogo/blob/main/src/infrastructure/theme/fonts.js"
    click Sizes "https://github.com/ankitraj10/mealstogo/blob/main/src/infrastructure/theme/sizes.js"
    click Spacing "https://github.com/ankitraj10/mealstogo/blob/main/src/infrastructure/theme/spacing.js"
    click AuthContext "https://github.com/ankitraj10/mealstogo/blob/main/src/services/authentication/authentication.context.js"
    click AuthService "https://github.com/ankitraj10/mealstogo/blob/main/src/services/authentication/authentication.service.js"
    click LocationContext "https://github.com/ankitraj10/mealstogo/blob/main/src/services/location/location.context.js"
    click LocationService "https://github.com/ankitraj10/mealstogo/blob/main/src/services/location/location.service.js"
    click LocationMock "https://github.com/ankitraj10/mealstogo/blob/main/src/services/location/location.mock.js"
    click RestaurantsContext "https://github.com/ankitraj10/mealstogo/blob/main/src/services/restraunts/restraunts.context.js"
    click RestaurantsService "https://github.com/ankitraj10/mealstogo/blob/main/src/services/restraunts/restraunts.service.js"
    click RestaurantsMock "https://github.com/ankitraj10/mealstogo/blob/main/src/services/restraunts/mock/index.js"
    click FavouritesContext "https://github.com/ankitraj10/mealstogo/blob/main/src/services/favourites/favourite.context.js"

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef services fill:#90EE90,stroke:#333,stroke-width:1px
    classDef infra fill:#FFA500,stroke:#333,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:1px
```
