# mangesh587/techkart architecture

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

- Interactive diagram: https://gitdiagram.com/mangesh587/techkart
- Repository: https://github.com/mangesh587/techkart

## Overview

TechKart is an electronics storefront with customer accounts, a cart and checkout, order tracking, and an admin console for catalog and order management. The principal customer workflow is browsing products, selecting a product, managing a cart, submitting checkout details, and viewing order history; authentication supports protected customer and admin actions. The React application routes to the storefront and account pages, while an Express API provides authentication, product, and order endpoints backed by MongoDB. Several page-to-API links are dashed because their fetch calls were not shown in the excerpts.

Main entry points: [`frontend/src/App.jsx`](https://github.com/mangesh587/techkart/blob/main/frontend/src/App.jsx) (App Router), [`backend/routes/orderRoutes.js`](https://github.com/mangesh587/techkart/blob/main/backend/routes/orderRoutes.js) (Order Endpoints), [`backend/routes/productRoutes.js`](https://github.com/mangesh587/techkart/blob/main/backend/routes/productRoutes.js) (Product Endpoints), [`backend/server.js`](https://github.com/mangesh587/techkart/blob/main/backend/server.js) (API Server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_app["App Router<br/>[App.jsx]"]
  node_navbar["Navigation<br/>[Navbar.jsx]"]
  node_home["Home<br/>[Home.jsx]"]
  node_products["Product Listing<br/>[Products.jsx]"]
  node_product_details["Product Details<br/>[ProductDetails.jsx]"]
end

subgraph group_accounts["Accounts"]
  node_login["Login<br/>[Login.jsx]"]
  node_register["Registration<br/>[Register.jsx]"]
  node_admin_guard["Admin Route Guard<br/>[AdminRoute.jsx]"]
end

subgraph group_commerce_admin["Commerce &amp; Admin"]
  node_cart["Cart<br/>[Cart.jsx]"]
  node_checkout["Checkout<br/>[Checkout.jsx]"]
  node_my_orders["Order History<br/>[MyOrders.jsx]"]
  node_admin_dashboard["Admin Dashboard<br/>[AdminDashboard.jsx]"]
end

subgraph group_api["Backend API"]
  node_server["API Server<br/>[server.js]"]
  node_auth_routes["Auth Endpoints<br/>[authRoutes.js]"]
  node_product_routes["Product Endpoints<br/>[productRoutes.js]"]
  node_order_routes["Order Endpoints<br/>[orderRoutes.js]"]
  node_auth_middleware["Auth Middleware<br/>[authMiddleware.js]"]
end

subgraph group_data["Data Models"]
  node_user_model[("User Model<br/>[User.js]")]
  node_product_model[("Product Model<br/>[Product.js]")]
  node_order_model[("Order Model<br/>[Order.js]")]
end

node_customer(("Customer"))
node_admin(("Administrator"))
node_mongo[("MongoDB")]

node_customer -->|"uses"| node_app
node_admin -->|"uses"| node_app
node_app -->|"renders"| node_navbar
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_products
node_app -->|"routes to"| node_product_details
node_app -->|"routes to"| node_cart
node_app -->|"routes to"| node_checkout
node_app -->|"routes to"| node_my_orders
node_app -->|"guards route"| node_admin_guard
node_app -->|"routes to"| node_admin_dashboard
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_register
node_server -->|"mounts"| node_product_routes
node_server -->|"mounts"| node_order_routes
node_server -->|"mounts"| node_auth_routes
node_server -->|"connects"| node_mongo
node_auth_routes -->|"reads and saves"| node_user_model
node_order_routes -->|"looks up"| node_user_model
node_order_routes -->|"queries and updates"| node_order_model
node_product_routes -->|"queries and updates"| node_product_model
node_order_routes -->|"uses protection"| node_auth_middleware
node_product_routes -->|"uses protection"| node_auth_middleware
node_login -.->|"authenticates"| node_auth_routes
node_register -.->|"registers"| node_auth_routes
node_products -.->|"requests catalog"| node_product_routes
node_product_details -.->|"requests item"| node_product_routes
node_admin_dashboard -.->|"manages catalog"| node_product_routes
node_checkout -.->|"submits order"| node_order_routes
node_my_orders -.->|"requests history"| node_order_routes
node_admin_dashboard -.->|"manages orders"| node_order_routes

click node_app "https://github.com/mangesh587/techkart/blob/main/frontend/src/App.jsx"
click node_navbar "https://github.com/mangesh587/techkart/blob/main/frontend/src/components/Navbar.jsx"
click node_home "https://github.com/mangesh587/techkart/blob/main/frontend/src/pages/Home.jsx"
click node_products "https://github.com/mangesh587/techkart/blob/main/frontend/src/pages/Products.jsx"
click node_product_details "https://github.com/mangesh587/techkart/blob/main/frontend/src/pages/ProductDetails.jsx"
click node_cart "https://github.com/mangesh587/techkart/blob/main/frontend/src/pages/Cart.jsx"
click node_checkout "https://github.com/mangesh587/techkart/blob/main/frontend/src/pages/Checkout.jsx"
click node_my_orders "https://github.com/mangesh587/techkart/blob/main/frontend/src/pages/MyOrders.jsx"
click node_admin_dashboard "https://github.com/mangesh587/techkart/blob/main/frontend/src/pages/AdminDashboard.jsx"
click node_login "https://github.com/mangesh587/techkart/blob/main/frontend/src/pages/Login.jsx"
click node_register "https://github.com/mangesh587/techkart/blob/main/frontend/src/pages/Register.jsx"
click node_admin_guard "https://github.com/mangesh587/techkart/blob/main/frontend/src/components/AdminRoute.jsx"
click node_server "https://github.com/mangesh587/techkart/blob/main/backend/server.js"
click node_auth_routes "https://github.com/mangesh587/techkart/blob/main/backend/routes/authRoutes.js"
click node_product_routes "https://github.com/mangesh587/techkart/blob/main/backend/routes/productRoutes.js"
click node_order_routes "https://github.com/mangesh587/techkart/blob/main/backend/routes/orderRoutes.js"
click node_auth_middleware "https://github.com/mangesh587/techkart/blob/main/backend/middleware/authMiddleware.js"
click node_user_model "https://github.com/mangesh587/techkart/blob/main/backend/models/User.js"
click node_product_model "https://github.com/mangesh587/techkart/blob/main/backend/models/Product.js"
click node_order_model "https://github.com/mangesh587/techkart/blob/main/backend/models/Order.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_navbar,node_home,node_products,node_product_details toneBlue
class node_login,node_register,node_admin_guard,node_mongo toneAmber
class node_cart,node_checkout,node_my_orders,node_admin_dashboard toneMint
class node_server,node_auth_routes,node_product_routes,node_order_routes,node_auth_middleware toneRose
class node_user_model,node_product_model,node_order_model,node_customer,node_admin toneIndigo
```

## Components

### Storefront

- [App Router](https://github.com/mangesh587/techkart/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Navigation](https://github.com/mangesh587/techkart/blob/main/frontend/src/components/Navbar.jsx): `frontend/src/components/Navbar.jsx`
- [Home](https://github.com/mangesh587/techkart/blob/main/frontend/src/pages/Home.jsx): `frontend/src/pages/Home.jsx`
- [Product Listing](https://github.com/mangesh587/techkart/blob/main/frontend/src/pages/Products.jsx): `frontend/src/pages/Products.jsx`
- [Product Details](https://github.com/mangesh587/techkart/blob/main/frontend/src/pages/ProductDetails.jsx): `frontend/src/pages/ProductDetails.jsx`

### Accounts

- [Login](https://github.com/mangesh587/techkart/blob/main/frontend/src/pages/Login.jsx): `frontend/src/pages/Login.jsx`
- [Registration](https://github.com/mangesh587/techkart/blob/main/frontend/src/pages/Register.jsx): `frontend/src/pages/Register.jsx`
- [Admin Route Guard](https://github.com/mangesh587/techkart/blob/main/frontend/src/components/AdminRoute.jsx): `frontend/src/components/AdminRoute.jsx`

### Commerce & Admin

- [Cart](https://github.com/mangesh587/techkart/blob/main/frontend/src/pages/Cart.jsx): `frontend/src/pages/Cart.jsx`
- [Checkout](https://github.com/mangesh587/techkart/blob/main/frontend/src/pages/Checkout.jsx): `frontend/src/pages/Checkout.jsx`
- [Order History](https://github.com/mangesh587/techkart/blob/main/frontend/src/pages/MyOrders.jsx): `frontend/src/pages/MyOrders.jsx`
- [Admin Dashboard](https://github.com/mangesh587/techkart/blob/main/frontend/src/pages/AdminDashboard.jsx): `frontend/src/pages/AdminDashboard.jsx`

### Backend API

- [API Server](https://github.com/mangesh587/techkart/blob/main/backend/server.js): `backend/server.js`
- [Auth Endpoints](https://github.com/mangesh587/techkart/blob/main/backend/routes/authRoutes.js): `backend/routes/authRoutes.js`
- [Product Endpoints](https://github.com/mangesh587/techkart/blob/main/backend/routes/productRoutes.js): `backend/routes/productRoutes.js`
- [Order Endpoints](https://github.com/mangesh587/techkart/blob/main/backend/routes/orderRoutes.js): `backend/routes/orderRoutes.js`
- [Auth Middleware](https://github.com/mangesh587/techkart/blob/main/backend/middleware/authMiddleware.js): `backend/middleware/authMiddleware.js`

### Data Models

- [User Model](https://github.com/mangesh587/techkart/blob/main/backend/models/User.js): `backend/models/User.js`
- [Product Model](https://github.com/mangesh587/techkart/blob/main/backend/models/Product.js): `backend/models/Product.js`
- [Order Model](https://github.com/mangesh587/techkart/blob/main/backend/models/Order.js): `backend/models/Order.js`

### Other components

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

## Connections

- Customer → App Router: uses (evidence: `frontend/src/App.jsx`)
- Administrator → App Router: uses (evidence: `frontend/src/App.jsx`)
- App Router → Navigation: renders (evidence: `frontend/src/App.jsx`)
- App Router → Home: routes to (evidence: `frontend/src/App.jsx`)
- App Router → Product Listing: routes to (evidence: `frontend/src/App.jsx`)
- App Router → Product Details: routes to (evidence: `frontend/src/App.jsx`)
- App Router → Cart: routes to (evidence: `frontend/src/App.jsx`)
- App Router → Checkout: routes to (evidence: `frontend/src/App.jsx`)
- App Router → Order History: routes to (evidence: `frontend/src/App.jsx`)
- App Router → Admin Route Guard: guards route (evidence: `frontend/src/App.jsx`)
- App Router → Admin Dashboard: routes to (evidence: `frontend/src/App.jsx`)
- App Router → Login: routes to (evidence: `frontend/src/App.jsx`)
- App Router → Registration: routes to (evidence: `frontend/src/App.jsx`)
- API Server → Product Endpoints: mounts (evidence: `backend/server.js`)
- API Server → Order Endpoints: mounts (evidence: `backend/server.js`)
- API Server → Auth Endpoints: mounts (evidence: `backend/server.js`)
- API Server → MongoDB: connects (evidence: `backend/server.js`)
- Auth Endpoints → User Model: reads and saves (evidence: `backend/routes/authRoutes.js`)
- Order Endpoints → User Model: looks up (evidence: `backend/routes/orderRoutes.js`)
- Order Endpoints → Order Model: queries and updates (evidence: `backend/routes/orderRoutes.js`)
- Product Endpoints → Product Model: queries and updates (evidence: `backend/routes/productRoutes.js`)
- Order Endpoints → Auth Middleware: uses protection (evidence: `backend/routes/orderRoutes.js`)
- Product Endpoints → Auth Middleware: uses protection (evidence: `backend/routes/productRoutes.js`)
- Login → Auth Endpoints: authenticates
- Registration → Auth Endpoints: registers
- Product Listing → Product Endpoints: requests catalog
- Product Details → Product Endpoints: requests item
- Admin Dashboard → Product Endpoints: manages catalog
- Checkout → Order Endpoints: submits order
- Order History → Order Endpoints: requests history
- Admin Dashboard → Order Endpoints: manages orders
