# rajbhokare/indiakart-ecommerce architecture

> Architecture diagram of the GitHub repository rajbhokare/indiakart-ecommerce, 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/rajbhokare/indiakart-ecommerce
- Repository: https://github.com/rajbhokare/indiakart-ecommerce

## Overview

IndiaKart is an e-commerce web application with server-rendered storefront, account, and cart pages, plus browser-side shopping interactions. Its main workflow is browsing and filtering products, adding items to a cart, and viewing the cart; account and contact flows are additional capabilities. The excerpts show both database-backed server handlers and separate route modules, but do not show how those modules are mounted, so no mounting relationship is asserted. README-described UI features are included where their implementation is not shown.

Main entry points: [`server.js`](https://github.com/rajbhokare/indiakart-ecommerce/blob/main/server.js) (Express application), [`db.js`](https://github.com/rajbhokare/indiakart-ecommerce/blob/main/db.js) (MySQL database), [`public`](https://github.com/rajbhokare/indiakart-ecommerce/tree/main/public) (Static assets), [`routes/contact.js`](https://github.com/rajbhokare/indiakart-ecommerce/blob/main/routes/contact.js) (Contact handler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_server["Express application<br/>[server.js]"]
  node_catalog["Product catalog<br/>[server.js]"]
  node_product_api["Product API<br/>[server.js]"]
  node_contact_handlers["Contact handler<br/>[contact.js]"]
  node_contact_api["Contact API<br/>[server.js]"]
  node_newsletter["Newsletter endpoint<br/>[server.js]"]
  node_product_ui["Product interactions<br/>[script.js]"]
  node_form_ui["Form interactions<br/>[script.js]"]
end

subgraph group_commerce["Commerce"]
  node_cart_handlers["Cart handlers<br/>[cart.js]"]
  node_db[("MySQL database<br/>[db.js]")]
  node_cart_ui["Cart interactions<br/>[script.js]"]
end

subgraph group_identity["Accounts"]
  node_auth_handlers["Auth handlers<br/>[auth.js]"]
  node_account["Account and orders<br/>[server.js]"]
end

subgraph group_presentation["Presentation"]
  node_views["Page templates"]
  node_assets["Static assets"]
end

node_shopper(("Shopper"))
node_local_storage[("Browser localStorage")]
node_client(("Browser"))

node_server -->|"handles routes"| node_catalog
node_server -->|"serves API"| node_product_api
node_server -->|"handles account"| node_account
node_server -->|"serves API"| node_contact_api
node_server -->|"serves endpoint"| node_newsletter
node_server -->|"queries"| node_db
node_server -->|"renders pages"| node_views
node_auth_handlers -->|"queries users"| node_db
node_cart_handlers -->|"queries cart"| node_db
node_contact_handlers -->|"stores messages"| node_db
node_client -.->|"loads"| node_assets
node_product_ui -->|"persists cart"| node_local_storage
node_cart_ui -->|"reads cart"| node_local_storage
node_form_ui -->|"shows feedback"| node_client
node_server -->|"serves static files"| node_assets

click node_server "https://github.com/rajbhokare/indiakart-ecommerce/blob/main/server.js"
click node_catalog "https://github.com/rajbhokare/indiakart-ecommerce/blob/main/server.js"
click node_product_api "https://github.com/rajbhokare/indiakart-ecommerce/blob/main/server.js"
click node_auth_handlers "https://github.com/rajbhokare/indiakart-ecommerce/blob/main/routes/auth.js"
click node_account "https://github.com/rajbhokare/indiakart-ecommerce/blob/main/server.js"
click node_cart_handlers "https://github.com/rajbhokare/indiakart-ecommerce/blob/main/routes/cart.js"
click node_contact_handlers "https://github.com/rajbhokare/indiakart-ecommerce/blob/main/routes/contact.js"
click node_contact_api "https://github.com/rajbhokare/indiakart-ecommerce/blob/main/server.js"
click node_newsletter "https://github.com/rajbhokare/indiakart-ecommerce/blob/main/server.js"
click node_db "https://github.com/rajbhokare/indiakart-ecommerce/blob/main/db.js"
click node_cart_ui "https://github.com/rajbhokare/indiakart-ecommerce/blob/main/public/script.js"
click node_product_ui "https://github.com/rajbhokare/indiakart-ecommerce/blob/main/public/script.js"
click node_form_ui "https://github.com/rajbhokare/indiakart-ecommerce/blob/main/public/script.js"
click node_views "https://github.com/rajbhokare/indiakart-ecommerce/tree/main/views"
click node_assets "https://github.com/rajbhokare/indiakart-ecommerce/tree/main/public"

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_server,node_catalog,node_product_api,node_contact_handlers,node_contact_api,node_newsletter,node_product_ui,node_form_ui,node_client toneBlue
class node_cart_handlers,node_db,node_cart_ui,node_local_storage toneAmber
class node_auth_handlers,node_account toneMint
class node_views,node_assets toneRose
class node_shopper toneIndigo
```

## Components

### Storefront

- [Express application](https://github.com/rajbhokare/indiakart-ecommerce/blob/main/server.js): `server.js`
- [Product catalog](https://github.com/rajbhokare/indiakart-ecommerce/blob/main/server.js): `server.js`
- [Product API](https://github.com/rajbhokare/indiakart-ecommerce/blob/main/server.js): `server.js`
- [Contact handler](https://github.com/rajbhokare/indiakart-ecommerce/blob/main/routes/contact.js): `routes/contact.js`
- [Contact API](https://github.com/rajbhokare/indiakart-ecommerce/blob/main/server.js): `server.js`
- [Newsletter endpoint](https://github.com/rajbhokare/indiakart-ecommerce/blob/main/server.js): `server.js`
- [Product interactions](https://github.com/rajbhokare/indiakart-ecommerce/blob/main/public/script.js): `public/script.js`
- [Form interactions](https://github.com/rajbhokare/indiakart-ecommerce/blob/main/public/script.js): `public/script.js`

### Commerce

- [Cart handlers](https://github.com/rajbhokare/indiakart-ecommerce/blob/main/routes/cart.js): `routes/cart.js`
- [MySQL database](https://github.com/rajbhokare/indiakart-ecommerce/blob/main/db.js): `db.js`
- [Cart interactions](https://github.com/rajbhokare/indiakart-ecommerce/blob/main/public/script.js): `public/script.js`

### Accounts

- [Auth handlers](https://github.com/rajbhokare/indiakart-ecommerce/blob/main/routes/auth.js): `routes/auth.js`
- [Account and orders](https://github.com/rajbhokare/indiakart-ecommerce/blob/main/server.js): `server.js`

### Presentation

- [Page templates](https://github.com/rajbhokare/indiakart-ecommerce/tree/main/views): `views`
- [Static assets](https://github.com/rajbhokare/indiakart-ecommerce/tree/main/public): `public`

### Other components

- **Shopper**
- **Browser localStorage**
- **Browser**

## Connections

- Express application → Product catalog: handles routes (evidence: `server.js`)
- Express application → Product API: serves API (evidence: `server.js`)
- Express application → Account and orders: handles account (evidence: `server.js`)
- Express application → Contact API: serves API (evidence: `server.js`)
- Express application → Newsletter endpoint: serves endpoint (evidence: `server.js`)
- Express application → MySQL database: queries (evidence: `server.js`)
- Express application → Page templates: renders pages (evidence: `server.js`)
- Auth handlers → MySQL database: queries users (evidence: `routes/auth.js`)
- Cart handlers → MySQL database: queries cart (evidence: `routes/cart.js`)
- Contact handler → MySQL database: stores messages (evidence: `routes/contact.js`)
- Browser → Static assets: loads
- Product interactions → Browser localStorage: persists cart (evidence: `public/script.js`)
- Cart interactions → Browser localStorage: reads cart (evidence: `public/script.js`)
- Form interactions → Browser: shows feedback (evidence: `public/script.js`)
- Express application → Static assets: serves static files (evidence: `server.js`)
