# sanjeevyadavit/magento_react_native architecture

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

- Interactive diagram: https://gitdiagram.com/sanjeevyadavit/magento_react_native
- Repository: https://github.com/sanjeevyadavit/magento_react_native

## Overview

MageCart is a React Native Magento 2 shopping app. The visible user flow enters the app, navigates among home, categories, and cart, and can open login or signup; login requests a customer token, stores it, and returns to the main tabs. The repository also includes profile navigation, Magento REST access, persistent user state, localization, and theming. Several screens and API helpers are identified by the source index but were not excerpted, so their internal behavior is not inferred here.

Main entry points: [`src/navigation/AppNavigation.tsx`](https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/navigation/AppNavigation.tsx) (Navigation), [`src/screens/login/LoginScreen.tsx`](https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/screens/login/LoginScreen.tsx) (Login screen), [`src/api/apiClient.ts`](https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/api/apiClient.ts) (HTTP client), [`src/store/useUserStore.ts`](https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/store/useUserStore.ts) (User store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App navigation"]
  node_app["App entry<br/>[App.tsx]"]
  node_navigation["Navigation<br/>[AppNavigation.tsx]"]
  node_home["Home screen<br/>[HomeScreen.tsx]"]
  node_categories["Categories"]
  node_cart["Cart screen<br/>[CartScreen.tsx]"]
  node_login["Login screen<br/>[LoginScreen.tsx]"]
  node_signup["Signup screen<br/>[SignupScreen.tsx]"]
  node_profile["Profile screen<br/>[ProfileScreen.tsx]"]
end

subgraph group_commerce["Magento access"]
  node_guest_auth["Guest auth API<br/>[guestApi.ts]"]
  node_rest_service["REST service<br/>[apiService.ts]"]
  node_api_client["HTTP client<br/>[apiClient.ts]"]
  node_config["Store config<br/>[index.ts]"]
end

subgraph group_state["User state"]
  node_user_store[("User store<br/>[useUserStore.ts]")]
  node_persistent_store["Persistence helper"]
end

subgraph group_presentation["Presentation"]
  node_theme_provider["Theme provider<br/>[ThemeProvider.tsx]"]
  node_theme_hook["Theme hook<br/>[useTheme.ts]"]
  node_i18n["Localization<br/>[i18n.ts]"]
end

node_customer(("App user"))
node_magento["Magento REST"]

node_customer -.->|"opens app"| node_navigation
node_app -->|"renders"| node_navigation
node_app -->|"wraps in"| node_theme_provider
node_navigation -->|"registers"| node_home
node_navigation -->|"registers"| node_categories
node_navigation -->|"registers"| node_cart
node_navigation -->|"registers"| node_login
node_navigation -->|"registers"| node_signup
node_navigation -->|"registers"| node_profile
node_login -->|"requests login"| node_guest_auth
node_guest_auth -->|"uses"| node_rest_service
node_rest_service -->|"sends requests"| node_api_client
node_api_client -->|"calls REST"| node_magento
node_api_client -->|"reads config"| node_config
node_login -->|"saves token"| node_user_store
node_navigation -->|"checks token"| node_user_store
node_user_store -->|"created with"| node_persistent_store
node_home -->|"uses theme"| node_theme_hook
node_theme_hook -->|"reads theme"| node_theme_provider
node_navigation -.->|"uses translations"| node_i18n

click node_app "https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/App.tsx"
click node_navigation "https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/navigation/AppNavigation.tsx"
click node_home "https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/screens/home/HomeScreen.tsx"
click node_categories "https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/screens/categories/CategoriesScreen.tsx"
click node_cart "https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/screens/cart/CartScreen.tsx"
click node_login "https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/screens/login/LoginScreen.tsx"
click node_signup "https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/screens/signup/SignupScreen.tsx"
click node_profile "https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/screens/profile/ProfileScreen.tsx"
click node_guest_auth "https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/api/guestApi.ts"
click node_rest_service "https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/api/apiService.ts"
click node_api_client "https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/api/apiClient.ts"
click node_config "https://github.com/sanjeevyadavit/magento_react_native/blob/main/config/index.ts"
click node_user_store "https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/store/useUserStore.ts"
click node_persistent_store "https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/store/createPersistentStore.ts"
click node_theme_provider "https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/theme/ThemeProvider.tsx"
click node_theme_hook "https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/theme/useTheme.ts"
click node_i18n "https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/i18n/i18n.ts"

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_navigation,node_home,node_categories,node_cart,node_login,node_signup,node_profile,node_customer toneBlue
class node_guest_auth,node_rest_service,node_api_client,node_config toneAmber
class node_user_store,node_persistent_store toneMint
class node_theme_provider,node_theme_hook,node_i18n toneRose
class node_magento toneIndigo
```

## Components

### App navigation

- [App entry](https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/App.tsx): `src/App.tsx`
- [Navigation](https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/navigation/AppNavigation.tsx): `src/navigation/AppNavigation.tsx`
- [Home screen](https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/screens/home/HomeScreen.tsx): `src/screens/home/HomeScreen.tsx`
- [Categories](https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/screens/categories/CategoriesScreen.tsx): `src/screens/categories/CategoriesScreen.tsx`
- [Cart screen](https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/screens/cart/CartScreen.tsx): `src/screens/cart/CartScreen.tsx`
- [Login screen](https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/screens/login/LoginScreen.tsx): `src/screens/login/LoginScreen.tsx`
- [Signup screen](https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/screens/signup/SignupScreen.tsx): `src/screens/signup/SignupScreen.tsx`
- [Profile screen](https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/screens/profile/ProfileScreen.tsx): `src/screens/profile/ProfileScreen.tsx`

### Magento access

- [Guest auth API](https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/api/guestApi.ts): `src/api/guestApi.ts`
- [REST service](https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/api/apiService.ts): `src/api/apiService.ts`
- [HTTP client](https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/api/apiClient.ts): `src/api/apiClient.ts`
- [Store config](https://github.com/sanjeevyadavit/magento_react_native/blob/main/config/index.ts): `config/index.ts`

### User state

- [User store](https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/store/useUserStore.ts): `src/store/useUserStore.ts`
- [Persistence helper](https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/store/createPersistentStore.ts): `src/store/createPersistentStore.ts`

### Presentation

- [Theme provider](https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/theme/ThemeProvider.tsx): `src/theme/ThemeProvider.tsx`
- [Theme hook](https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/theme/useTheme.ts): `src/theme/useTheme.ts`
- [Localization](https://github.com/sanjeevyadavit/magento_react_native/blob/main/src/i18n/i18n.ts): `src/i18n/i18n.ts`

### Other components

- **App user**
- **Magento REST**

## Connections

- App user → Navigation: opens app
- App entry → Navigation: renders (evidence: `src/App.tsx`)
- App entry → Theme provider: wraps in (evidence: `src/App.tsx`)
- Navigation → Home screen: registers (evidence: `src/navigation/AppNavigation.tsx`)
- Navigation → Categories: registers (evidence: `src/navigation/AppNavigation.tsx`)
- Navigation → Cart screen: registers (evidence: `src/navigation/AppNavigation.tsx`)
- Navigation → Login screen: registers (evidence: `src/navigation/AppNavigation.tsx`)
- Navigation → Signup screen: registers (evidence: `src/navigation/AppNavigation.tsx`)
- Navigation → Profile screen: registers (evidence: `src/navigation/AppNavigation.tsx`)
- Login screen → Guest auth API: requests login (evidence: `src/screens/login/LoginScreen.tsx`)
- Guest auth API → REST service: uses (evidence: `src/api/guestApi.ts`)
- REST service → HTTP client: sends requests (evidence: `src/api/apiService.ts`)
- HTTP client → Magento REST: calls REST (evidence: `src/api/apiClient.ts`)
- HTTP client → Store config: reads config (evidence: `src/api/apiClient.ts`)
- Login screen → User store: saves token (evidence: `src/screens/login/LoginScreen.tsx`)
- Navigation → User store: checks token (evidence: `src/navigation/AppNavigation.tsx`)
- User store → Persistence helper: created with (evidence: `src/store/useUserStore.ts`)
- Home screen → Theme hook: uses theme (evidence: `src/screens/home/HomeScreen.tsx`)
- Theme hook → Theme provider: reads theme (evidence: `src/theme/useTheme.ts`)
- Navigation → Localization: uses translations
