# ganesh27-2002/mobile-shop architecture

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

- Interactive diagram: https://gitdiagram.com/ganesh27-2002/mobile-shop
- Repository: https://github.com/ganesh27-2002/mobile-shop

## Overview

Mobile Shop is a full-stack smartphone store: customers browse a catalog, manage a cart and addresses, check out with simulated payment, then track or cancel orders. Administrators manage catalog, inventory, orders, customers, and dashboard reporting. The graph follows the documented frontend/API layers; sampled source confirms server routing and representative controller-to-service calls, while several domain-specific service links are documented capabilities rather than individually inspected implementations.

Main entry points: [`backend/src/models/index.ts`](https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/models/index.ts) (Sequelize models), [`backend/src/routes`](https://github.com/ganesh27-2002/mobile-shop/tree/main/backend/src/routes) (Customer API routes), [`backend/src/routes/adminRoutes.ts`](https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/routes/adminRoutes.ts) (Admin API routes), [`frontend/src/App.tsx`](https://github.com/ganesh27-2002/mobile-shop/blob/main/frontend/src/App.tsx) (React application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Customer storefront"]
  node_webapp["React application<br/>[App.tsx]"]
  node_shop_pages["Storefront pages"]
  node_web_api["API services"]
  node_session["Session and cart state"]
end

subgraph group_commerce["Commerce API"]
  node_api_server["Express API<br/>[server.ts]"]
  node_public_routes["Customer API routes"]
  node_auth["Authentication<br/>[authService.ts]"]
  node_catalog["Catalog and categories<br/>[productService.ts]"]
  node_cart["Shopping cart<br/>[cartService.ts]"]
  node_addresses["Address book<br/>[addressService.ts]"]
  node_checkout["Checkout<br/>[checkoutService.ts]"]
  node_payments["Simulated payments<br/>[paymentService.ts]"]
  node_orders["Orders and tracking<br/>[orderService.ts]"]
end

subgraph group_admin["Administration"]
  node_admin_pages["Admin pages"]
  node_admin_routes["Admin API routes<br/>[adminRoutes.ts]"]
  node_admin_products["Product management"]
  node_admin_categories["Category management"]
  node_inventory["Inventory management"]
  node_admin_orders["Order management"]
  node_admin_customers["Customer management"]
  node_dashboard["Dashboard reporting"]
end

subgraph group_persistence["Persistence"]
  node_models["Sequelize models<br/>[index.ts]"]
  node_database[("PostgreSQL<br/>[database.ts]")]
end

node_customer(("Customer"))
node_administrator(("Administrator"))

node_customer -->|"uses"| node_webapp
node_administrator -->|"uses"| node_webapp
node_webapp -->|"routes"| node_shop_pages
node_webapp -->|"routes"| node_admin_pages
node_shop_pages -->|"requests"| node_web_api
node_admin_pages -->|"requests"| node_web_api
node_webapp -->|"provides state"| node_session
node_web_api -->|"HTTP requests"| node_api_server
node_api_server -->|"dispatches"| node_public_routes
node_api_server -->|"dispatches"| node_admin_routes
node_public_routes -->|"dispatches"| node_auth
node_public_routes -->|"dispatches"| node_catalog
node_public_routes -->|"dispatches"| node_cart
node_public_routes -->|"dispatches"| node_addresses
node_public_routes -->|"dispatches"| node_checkout
node_public_routes -->|"dispatches"| node_orders
node_admin_routes -->|"dispatches"| node_admin_products
node_admin_routes -->|"dispatches"| node_admin_categories
node_admin_routes -->|"dispatches"| node_inventory
node_admin_routes -->|"dispatches"| node_admin_orders
node_admin_routes -->|"dispatches"| node_admin_customers
node_admin_routes -->|"dispatches"| node_dashboard
node_checkout -->|"requests payment"| node_payments
node_auth -->|"reads/writes users"| node_models
node_catalog -->|"reads catalog"| node_models
node_cart -->|"reads/writes cart"| node_models
node_addresses -->|"reads/writes addresses"| node_models
node_checkout -->|"reads/writes checkout data"| node_models
node_payments -->|"records payment"| node_models
node_orders -->|"reads/writes orders"| node_models
node_admin_products -->|"manages products"| node_models
node_admin_categories -->|"manages categories"| node_models
node_inventory -->|"updates stock"| node_models
node_admin_orders -->|"manages orders"| node_models
node_admin_customers -->|"reads customers"| node_models
node_dashboard -->|"reads metrics"| node_models
node_models -->|"persists via"| node_database

click node_webapp "https://github.com/ganesh27-2002/mobile-shop/blob/main/frontend/src/App.tsx"
click node_shop_pages "https://github.com/ganesh27-2002/mobile-shop/tree/main/frontend/src/pages"
click node_admin_pages "https://github.com/ganesh27-2002/mobile-shop/tree/main/frontend/src/pages/admin"
click node_web_api "https://github.com/ganesh27-2002/mobile-shop/tree/main/frontend/src/services"
click node_session "https://github.com/ganesh27-2002/mobile-shop/tree/main/frontend/src/context"
click node_api_server "https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/server.ts"
click node_public_routes "https://github.com/ganesh27-2002/mobile-shop/tree/main/backend/src/routes"
click node_admin_routes "https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/routes/adminRoutes.ts"
click node_auth "https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/services/authService.ts"
click node_catalog "https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/services/productService.ts"
click node_cart "https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/services/cartService.ts"
click node_addresses "https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/services/addressService.ts"
click node_checkout "https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/services/checkoutService.ts"
click node_payments "https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/services/paymentService.ts"
click node_orders "https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/services/orderService.ts"
click node_admin_products "https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/services/adminProductService.ts"
click node_admin_categories "https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/services/adminCategoryService.ts"
click node_inventory "https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/services/adminInventoryService.ts"
click node_admin_orders "https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/services/adminOrderService.ts"
click node_admin_customers "https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/services/adminCustomerService.ts"
click node_dashboard "https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/services/adminDashboardService.ts"
click node_models "https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/models/index.ts"
click node_database "https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/config/database.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_webapp,node_shop_pages,node_web_api,node_session toneBlue
class node_api_server,node_public_routes,node_auth,node_catalog,node_cart,node_addresses,node_checkout,node_payments,node_orders toneAmber
class node_admin_pages,node_admin_routes,node_admin_products,node_admin_categories,node_inventory,node_admin_orders,node_admin_customers,node_dashboard toneMint
class node_models,node_database toneRose
class node_customer,node_administrator toneIndigo
```

## Components

### Customer storefront

- [React application](https://github.com/ganesh27-2002/mobile-shop/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Storefront pages](https://github.com/ganesh27-2002/mobile-shop/tree/main/frontend/src/pages): `frontend/src/pages`
- [API services](https://github.com/ganesh27-2002/mobile-shop/tree/main/frontend/src/services): `frontend/src/services`
- [Session and cart state](https://github.com/ganesh27-2002/mobile-shop/tree/main/frontend/src/context): `frontend/src/context`

### Commerce API

- [Express API](https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/server.ts): `backend/src/server.ts`
- [Customer API routes](https://github.com/ganesh27-2002/mobile-shop/tree/main/backend/src/routes): `backend/src/routes`
- [Authentication](https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/services/authService.ts): `backend/src/services/authService.ts`
- [Catalog and categories](https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/services/productService.ts): `backend/src/services/productService.ts`
- [Shopping cart](https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/services/cartService.ts): `backend/src/services/cartService.ts`
- [Address book](https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/services/addressService.ts): `backend/src/services/addressService.ts`
- [Checkout](https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/services/checkoutService.ts): `backend/src/services/checkoutService.ts`
- [Simulated payments](https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/services/paymentService.ts): `backend/src/services/paymentService.ts`
- [Orders and tracking](https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/services/orderService.ts): `backend/src/services/orderService.ts`

### Administration

- [Admin pages](https://github.com/ganesh27-2002/mobile-shop/tree/main/frontend/src/pages/admin): `frontend/src/pages/admin`
- [Admin API routes](https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/routes/adminRoutes.ts): `backend/src/routes/adminRoutes.ts`
- [Product management](https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/services/adminProductService.ts): `backend/src/services/adminProductService.ts`
- [Category management](https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/services/adminCategoryService.ts): `backend/src/services/adminCategoryService.ts`
- [Inventory management](https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/services/adminInventoryService.ts): `backend/src/services/adminInventoryService.ts`
- [Order management](https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/services/adminOrderService.ts): `backend/src/services/adminOrderService.ts`
- [Customer management](https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/services/adminCustomerService.ts): `backend/src/services/adminCustomerService.ts`
- [Dashboard reporting](https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/services/adminDashboardService.ts): `backend/src/services/adminDashboardService.ts`

### Persistence

- [Sequelize models](https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/models/index.ts): `backend/src/models/index.ts`
- [PostgreSQL](https://github.com/ganesh27-2002/mobile-shop/blob/main/backend/src/config/database.ts): `backend/src/config/database.ts`

### Other components

- **Customer**
- **Administrator**

## Connections

- Customer → React application: uses
- Administrator → React application: uses
- React application → Storefront pages: routes
- React application → Admin pages: routes
- Storefront pages → API services: requests
- Admin pages → API services: requests
- React application → Session and cart state: provides state
- API services → Express API: HTTP requests
- Express API → Customer API routes: dispatches
- Express API → Admin API routes: dispatches
- Customer API routes → Authentication: dispatches
- Customer API routes → Catalog and categories: dispatches
- Customer API routes → Shopping cart: dispatches
- Customer API routes → Address book: dispatches
- Customer API routes → Checkout: dispatches
- Customer API routes → Orders and tracking: dispatches
- Admin API routes → Product management: dispatches
- Admin API routes → Category management: dispatches
- Admin API routes → Inventory management: dispatches
- Admin API routes → Order management: dispatches
- Admin API routes → Customer management: dispatches
- Admin API routes → Dashboard reporting: dispatches
- Checkout → Simulated payments: requests payment
- Authentication → Sequelize models: reads/writes users
- Catalog and categories → Sequelize models: reads catalog
- Shopping cart → Sequelize models: reads/writes cart
- Address book → Sequelize models: reads/writes addresses
- Checkout → Sequelize models: reads/writes checkout data
- Simulated payments → Sequelize models: records payment
- Orders and tracking → Sequelize models: reads/writes orders
- Product management → Sequelize models: manages products
- Category management → Sequelize models: manages categories
- Inventory management → Sequelize models: updates stock
- Order management → Sequelize models: manages orders
- Customer management → Sequelize models: reads customers
- Dashboard reporting → Sequelize models: reads metrics
- Sequelize models → PostgreSQL: persists via
