# grishmitha-123/babafly-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/grishmitha-123/babafly-frontend
- Repository: https://github.com/grishmitha-123/babafly-frontend

## Overview

BabaFly is a React fashion-commerce frontend: shoppers browse and discover products, inspect details, manage a cart or wishlist, check out, and view orders; login and registration provide a separate account flow. App.jsx defines the routes and MainLayout supplies shared navigation. Product pages call the API layer; Redux slices hold auth, cart, and wishlist state, with cart and wishlist persisted in localStorage. Major order, checkout, category, and account screens are retained from the documented routes; their internal behavior is not shown in the excerpts.

Main entry points: [`src/App.jsx`](https://github.com/grishmitha-123/babafly-frontend/blob/main/src/App.jsx) (Route application), [`src/utils/axios.js`](https://github.com/grishmitha-123/babafly-frontend/blob/main/src/utils/axios.js) (Axios API client), [`src/redux/authSlice.js`](https://github.com/grishmitha-123/babafly-frontend/blob/main/src/redux/authSlice.js) (Authentication state), [`src/redux/cartSlice.js`](https://github.com/grishmitha-123/babafly-frontend/blob/main/src/redux/cartSlice.js) (Cart state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Storefront experience"]
  node_app["Route application<br/>[App.jsx]"]
  node_layout["Shared layout<br/>[MainLayout.jsx]"]
  node_navbar["Navigation and search<br/>[Navbar.jsx]"]
  node_home["Home promotions<br/>[Home.jsx]"]
end

subgraph group_commerce["Shopping flows"]
  node_categories["Category browsing<br/>[Categories.jsx]"]
  node_categoryproducts["Category products"]
  node_products["Product discovery<br/>[Products.jsx]"]
  node_productcard["Product presentation<br/>[ProductCard.jsx]"]
  node_details["Product details<br/>[ProductDetails.jsx]"]
  node_cartpage["Shopping cart<br/>[Cart.jsx]"]
  node_checkout["Checkout<br/>[Checkout.jsx]"]
  node_wishlistpage["Wishlist<br/>[Wishlist.jsx]"]
end

subgraph group_account["Account and orders"]
  node_login["Login<br/>[Login.jsx]"]
  node_register["Registration<br/>[Register.jsx]"]
  node_orders["Order history<br/>[Orders.jsx]"]
  node_orderdetails["Order details<br/>[OrderDetails.jsx]"]
end

subgraph group_state["State and API"]
  node_store["Redux store<br/>[store.js]"]
  node_auth["Authentication state<br/>[authSlice.js]"]
  node_cartstate["Cart state<br/>[cartSlice.js]"]
  node_wishliststate["Wishlist state<br/>[wishlistslice.js]"]
  node_api["Axios API client<br/>[axios.js]"]
end

node_shopper(("Shopper"))
node_dummyjson["DummyJSON API"]
node_localstorage[("Browser localStorage")]

node_shopper -->|"opens routes"| node_app
node_app -->|"wraps routes"| node_layout
node_layout -->|"renders"| node_navbar
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_categories
node_app -->|"routes to"| node_categoryproducts
node_app -->|"routes to"| node_products
node_app -->|"routes to"| node_details
node_app -->|"routes to"| node_cartpage
node_app -->|"routes to"| node_checkout
node_app -->|"routes to"| node_wishlistpage
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_register
node_app -->|"routes to"| node_orders
node_app -->|"routes to"| node_orderdetails
node_store -->|"configures reducer"| node_auth
node_store -->|"configures reducer"| node_cartstate
node_store -->|"configures reducer"| node_wishliststate
node_products -->|"fetches products"| node_api
node_categoryproducts -->|"requests products"| node_api
node_details -->|"requests product"| node_api
node_api -->|"sends REST requests"| node_dummyjson
node_products -->|"renders results"| node_productcard
node_categoryproducts -->|"renders results"| node_productcard
node_productcard -->|"dispatches toggle"| node_wishliststate
node_navbar -->|"dispatches logout"| node_auth
node_navbar -->|"resets cart"| node_cartstate
node_navbar -->|"resets wishlist"| node_wishliststate
node_cartpage -->|"dispatches cart actions"| node_cartstate
node_login -->|"uses auth state"| node_auth
node_register -->|"uses auth state"| node_auth
node_wishlistpage -->|"uses wishlist state"| node_wishliststate
node_wishlistpage -->|"uses cart state"| node_cartstate
node_cartstate -->|"persists cart"| node_localstorage
node_wishliststate -->|"persists wishlist"| node_localstorage
node_auth -->|"stores token and user"| node_localstorage
node_api -->|"reads bearer token"| node_localstorage

click node_app "https://github.com/grishmitha-123/babafly-frontend/blob/main/src/App.jsx"
click node_layout "https://github.com/grishmitha-123/babafly-frontend/blob/main/src/layouts/MainLayout.jsx"
click node_navbar "https://github.com/grishmitha-123/babafly-frontend/blob/main/src/components/Navbar.jsx"
click node_home "https://github.com/grishmitha-123/babafly-frontend/blob/main/src/pages/Home.jsx"
click node_categories "https://github.com/grishmitha-123/babafly-frontend/blob/main/src/pages/Categories.jsx"
click node_categoryproducts "https://github.com/grishmitha-123/babafly-frontend/blob/main/src/pages/CategoryProducts.jsx"
click node_products "https://github.com/grishmitha-123/babafly-frontend/blob/main/src/pages/Products.jsx"
click node_productcard "https://github.com/grishmitha-123/babafly-frontend/blob/main/src/components/ProductCard.jsx"
click node_details "https://github.com/grishmitha-123/babafly-frontend/blob/main/src/pages/ProductDetails.jsx"
click node_cartpage "https://github.com/grishmitha-123/babafly-frontend/blob/main/src/pages/Cart.jsx"
click node_checkout "https://github.com/grishmitha-123/babafly-frontend/blob/main/src/pages/Checkout.jsx"
click node_wishlistpage "https://github.com/grishmitha-123/babafly-frontend/blob/main/src/pages/Wishlist.jsx"
click node_login "https://github.com/grishmitha-123/babafly-frontend/blob/main/src/pages/Login.jsx"
click node_register "https://github.com/grishmitha-123/babafly-frontend/blob/main/src/pages/Register.jsx"
click node_orders "https://github.com/grishmitha-123/babafly-frontend/blob/main/src/pages/Orders.jsx"
click node_orderdetails "https://github.com/grishmitha-123/babafly-frontend/blob/main/src/pages/OrderDetails.jsx"
click node_store "https://github.com/grishmitha-123/babafly-frontend/blob/main/src/redux/store.js"
click node_auth "https://github.com/grishmitha-123/babafly-frontend/blob/main/src/redux/authSlice.js"
click node_cartstate "https://github.com/grishmitha-123/babafly-frontend/blob/main/src/redux/cartSlice.js"
click node_wishliststate "https://github.com/grishmitha-123/babafly-frontend/blob/main/src/redux/wishlistslice.js"
click node_api "https://github.com/grishmitha-123/babafly-frontend/blob/main/src/utils/axios.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_layout,node_navbar,node_home toneBlue
class node_categories,node_categoryproducts,node_products,node_productcard,node_details,node_cartpage,node_checkout,node_wishlistpage,node_localstorage toneAmber
class node_login,node_register,node_orders,node_orderdetails,node_dummyjson toneMint
class node_store,node_auth,node_cartstate,node_wishliststate,node_api toneRose
class node_shopper toneIndigo
```

## Components

### Storefront experience

- [Route application](https://github.com/grishmitha-123/babafly-frontend/blob/main/src/App.jsx): `src/App.jsx`
- [Shared layout](https://github.com/grishmitha-123/babafly-frontend/blob/main/src/layouts/MainLayout.jsx): `src/layouts/MainLayout.jsx`
- [Navigation and search](https://github.com/grishmitha-123/babafly-frontend/blob/main/src/components/Navbar.jsx): `src/components/Navbar.jsx`
- [Home promotions](https://github.com/grishmitha-123/babafly-frontend/blob/main/src/pages/Home.jsx): `src/pages/Home.jsx`

### Shopping flows

- [Category browsing](https://github.com/grishmitha-123/babafly-frontend/blob/main/src/pages/Categories.jsx): `src/pages/Categories.jsx`
- [Category products](https://github.com/grishmitha-123/babafly-frontend/blob/main/src/pages/CategoryProducts.jsx): `src/pages/CategoryProducts.jsx`
- [Product discovery](https://github.com/grishmitha-123/babafly-frontend/blob/main/src/pages/Products.jsx): `src/pages/Products.jsx`
- [Product presentation](https://github.com/grishmitha-123/babafly-frontend/blob/main/src/components/ProductCard.jsx): `src/components/ProductCard.jsx`
- [Product details](https://github.com/grishmitha-123/babafly-frontend/blob/main/src/pages/ProductDetails.jsx): `src/pages/ProductDetails.jsx`
- [Shopping cart](https://github.com/grishmitha-123/babafly-frontend/blob/main/src/pages/Cart.jsx): `src/pages/Cart.jsx`
- [Checkout](https://github.com/grishmitha-123/babafly-frontend/blob/main/src/pages/Checkout.jsx): `src/pages/Checkout.jsx`
- [Wishlist](https://github.com/grishmitha-123/babafly-frontend/blob/main/src/pages/Wishlist.jsx): `src/pages/Wishlist.jsx`

### Account and orders

- [Login](https://github.com/grishmitha-123/babafly-frontend/blob/main/src/pages/Login.jsx): `src/pages/Login.jsx`
- [Registration](https://github.com/grishmitha-123/babafly-frontend/blob/main/src/pages/Register.jsx): `src/pages/Register.jsx`
- [Order history](https://github.com/grishmitha-123/babafly-frontend/blob/main/src/pages/Orders.jsx): `src/pages/Orders.jsx`
- [Order details](https://github.com/grishmitha-123/babafly-frontend/blob/main/src/pages/OrderDetails.jsx): `src/pages/OrderDetails.jsx`

### State and API

- [Redux store](https://github.com/grishmitha-123/babafly-frontend/blob/main/src/redux/store.js): `src/redux/store.js`
- [Authentication state](https://github.com/grishmitha-123/babafly-frontend/blob/main/src/redux/authSlice.js): `src/redux/authSlice.js`
- [Cart state](https://github.com/grishmitha-123/babafly-frontend/blob/main/src/redux/cartSlice.js): `src/redux/cartSlice.js`
- [Wishlist state](https://github.com/grishmitha-123/babafly-frontend/blob/main/src/redux/wishlistslice.js): `src/redux/wishlistslice.js`
- [Axios API client](https://github.com/grishmitha-123/babafly-frontend/blob/main/src/utils/axios.js): `src/utils/axios.js`

### Other components

- **Shopper**
- **DummyJSON API**
- **Browser localStorage**

## Connections

- Shopper → Route application: opens routes (evidence: `src/App.jsx`)
- Route application → Shared layout: wraps routes (evidence: `src/App.jsx`)
- Shared layout → Navigation and search: renders (evidence: `src/layouts/MainLayout.jsx`)
- Route application → Home promotions: routes to (evidence: `src/App.jsx`)
- Route application → Category browsing: routes to (evidence: `src/App.jsx`)
- Route application → Category products: routes to (evidence: `src/App.jsx`)
- Route application → Product discovery: routes to (evidence: `src/App.jsx`)
- Route application → Product details: routes to (evidence: `src/App.jsx`)
- Route application → Shopping cart: routes to (evidence: `src/App.jsx`)
- Route application → Checkout: routes to (evidence: `src/App.jsx`)
- Route application → Wishlist: routes to (evidence: `src/App.jsx`)
- Route application → Login: routes to (evidence: `src/App.jsx`)
- Route application → Registration: routes to (evidence: `src/App.jsx`)
- Route application → Order history: routes to (evidence: `src/App.jsx`)
- Route application → Order details: routes to (evidence: `src/App.jsx`)
- Redux store → Authentication state: configures reducer (evidence: `src/redux/store.js`)
- Redux store → Cart state: configures reducer (evidence: `src/redux/store.js`)
- Redux store → Wishlist state: configures reducer (evidence: `src/redux/store.js`)
- Product discovery → Axios API client: fetches products (evidence: `src/pages/Products.jsx`)
- Category products → Axios API client: requests products (evidence: `src/pages/CategoryProducts.jsx`)
- Product details → Axios API client: requests product (evidence: `src/pages/ProductDetails.jsx`)
- Axios API client → DummyJSON API: sends REST requests (evidence: `README.md`)
- Product discovery → Product presentation: renders results (evidence: `src/pages/Products.jsx`)
- Category products → Product presentation: renders results (evidence: `src/pages/CategoryProducts.jsx`)
- Product presentation → Wishlist state: dispatches toggle (evidence: `src/components/ProductCard.jsx`)
- Navigation and search → Authentication state: dispatches logout (evidence: `src/components/Navbar.jsx`)
- Navigation and search → Cart state: resets cart (evidence: `src/components/Navbar.jsx`)
- Navigation and search → Wishlist state: resets wishlist (evidence: `src/components/Navbar.jsx`)
- Shopping cart → Cart state: dispatches cart actions (evidence: `src/pages/Cart.jsx`)
- Login → Authentication state: uses auth state (evidence: `src/pages/Login.jsx`)
- Registration → Authentication state: uses auth state (evidence: `src/pages/Register.jsx`)
- Wishlist → Wishlist state: uses wishlist state (evidence: `src/pages/Wishlist.jsx`)
- Wishlist → Cart state: uses cart state (evidence: `src/pages/Wishlist.jsx`)
- Cart state → Browser localStorage: persists cart (evidence: `src/redux/cartSlice.js`)
- Wishlist state → Browser localStorage: persists wishlist (evidence: `src/redux/wishlistslice.js`)
- Authentication state → Browser localStorage: stores token and user (evidence: `src/redux/authSlice.js`)
- Axios API client → Browser localStorage: reads bearer token (evidence: `src/utils/axios.js`)
