# devang44/apnacart architecture

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

- Interactive diagram: https://gitdiagram.com/devang44/apnacart
- Repository: https://github.com/devang44/apnacart

## Overview

ApnaCart is a PHP/MySQL online shopping application with a customer storefront and an admin seller panel. The customer journey runs from product discovery and product detail through cart, checkout/payment, order placement, and order tracking; accounts and wishlists support that journey. Admin pages manage the catalog, offers, users, orders, and reporting. The excerpts show database use, cart offer calculation, and product-to-cart/checkout links; other connections below are limited to source-index references. Unsampled features are represented where the tree supports them, without assuming their internal call sequence.

Main entry points: [`config/db.php`](https://github.com/devang44/apnacart/blob/main/config/db.php) (ApnaCart database), [`product.php`](https://github.com/devang44/apnacart/blob/main/product.php) (Product detail), [`cart.php`](https://github.com/devang44/apnacart/blob/main/cart.php) (Shopping cart), [`payment.php`](https://github.com/devang44/apnacart/blob/main/payment.php) (Payment)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_home["Home discovery<br/>[index.php]"]
  node_catalog["Product browsing<br/>[shop.php]"]
  node_product["Product detail<br/>[product.php]"]
end

subgraph group_customer["Customer journey"]
  node_account["Account access<br/>[register.php]"]
  node_login["Customer login<br/>[login.php]"]
  node_cart["Shopping cart<br/>[cart.php]"]
  node_checkout["Checkout<br/>[checkout.php]"]
  node_payment["Payment<br/>[payment.php]"]
  node_orderplace["Order placement<br/>[place_order.php]"]
  node_orders["Order tracking<br/>[orders.php]"]
  node_invoice["Order invoice<br/>[invoice.php]"]
  node_wishlist["Wishlist<br/>[wishlist.php]"]
end

subgraph group_admin["Seller administration"]
  node_admin_dashboard["Admin dashboard<br/>[index.php]"]
  node_admin_catalog["Catalog management<br/>[add_product.php]"]
  node_admin_edit["Product editing<br/>[edit_product.php]"]
  node_admin_offers["Offer management<br/>[offers.php]"]
  node_admin_orders["Order management<br/>[orders.php]"]
  node_admin_users["User management<br/>[users.php]"]
  node_admin_report["Invoice reporting<br/>[invoice_report.php]"]
end

subgraph group_shared["Shared services"]
  node_offer_rules["Offer calculation"]
  node_navigation["Store navigation<br/>[navbar.php]"]
  node_database[("ApnaCart database<br/>[db.php]")]
end

node_shopper(("Shopper"))

node_shopper -->|"opens"| node_home
node_shopper -->|"browses"| node_catalog
node_shopper -->|"views"| node_product
node_product -->|"adds item"| node_cart
node_product -->|"buys now"| node_checkout
node_shopper -->|"registers"| node_account
node_shopper -->|"signs in"| node_login
node_shopper -->|"updates"| node_cart
node_shopper -->|"checks out"| node_checkout
node_shopper -->|"pays"| node_payment
node_shopper -->|"tracks order"| node_orders
node_shopper -->|"saves items"| node_wishlist
node_shopper -->|"views bill"| node_invoice
node_cart -->|"calculates discount"| node_offer_rules
node_payment -->|"calculates discount"| node_offer_rules
node_home -->|"queries products"| node_database
node_catalog -->|"queries catalog"| node_database
node_product -->|"loads product"| node_database
node_cart -->|"reads and updates"| node_database
node_checkout -->|"queries data"| node_database
node_payment -->|"queries data"| node_database
node_orderplace -.->|"writes order"| node_database
node_orders -->|"queries orders"| node_database
node_invoice -->|"queries order"| node_database
node_wishlist -->|"queries wishlist"| node_database
node_admin_dashboard -->|"queries metrics"| node_database
node_admin_catalog -->|"manages products"| node_database
node_admin_edit -->|"updates products"| node_database
node_admin_offers -->|"manages offers"| node_database
node_admin_orders -->|"manages orders"| node_database
node_admin_users -->|"manages users"| node_database
node_admin_report -->|"queries invoices"| node_database
node_navigation -->|"loads categories"| node_database

click node_home "https://github.com/devang44/apnacart/blob/main/index.php"
click node_catalog "https://github.com/devang44/apnacart/blob/main/shop.php"
click node_product "https://github.com/devang44/apnacart/blob/main/product.php"
click node_account "https://github.com/devang44/apnacart/blob/main/register.php"
click node_login "https://github.com/devang44/apnacart/blob/main/login.php"
click node_cart "https://github.com/devang44/apnacart/blob/main/cart.php"
click node_checkout "https://github.com/devang44/apnacart/blob/main/checkout.php"
click node_payment "https://github.com/devang44/apnacart/blob/main/payment.php"
click node_orderplace "https://github.com/devang44/apnacart/blob/main/place_order.php"
click node_orders "https://github.com/devang44/apnacart/blob/main/orders.php"
click node_invoice "https://github.com/devang44/apnacart/blob/main/invoice.php"
click node_wishlist "https://github.com/devang44/apnacart/blob/main/wishlist.php"
click node_admin_dashboard "https://github.com/devang44/apnacart/blob/main/admin/index.php"
click node_admin_catalog "https://github.com/devang44/apnacart/blob/main/admin/add_product.php"
click node_admin_edit "https://github.com/devang44/apnacart/blob/main/admin/edit_product.php"
click node_admin_offers "https://github.com/devang44/apnacart/blob/main/admin/offers.php"
click node_admin_orders "https://github.com/devang44/apnacart/blob/main/admin/orders.php"
click node_admin_users "https://github.com/devang44/apnacart/blob/main/admin/users.php"
click node_admin_report "https://github.com/devang44/apnacart/blob/main/admin/invoice_report.php"
click node_offer_rules "https://github.com/devang44/apnacart/blob/main/include/offer_functions.php"
click node_navigation "https://github.com/devang44/apnacart/blob/main/include/navbar.php"
click node_database "https://github.com/devang44/apnacart/blob/main/config/db.php"

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_home,node_catalog,node_product toneBlue
class node_account,node_login,node_cart,node_checkout,node_payment,node_orderplace,node_orders,node_invoice,node_wishlist toneAmber
class node_admin_dashboard,node_admin_catalog,node_admin_edit,node_admin_offers,node_admin_orders,node_admin_users,node_admin_report toneMint
class node_offer_rules,node_navigation,node_database toneRose
class node_shopper toneIndigo
```

## Components

### Storefront

- [Home discovery](https://github.com/devang44/apnacart/blob/main/index.php): `index.php`
- [Product browsing](https://github.com/devang44/apnacart/blob/main/shop.php): `shop.php`
- [Product detail](https://github.com/devang44/apnacart/blob/main/product.php): `product.php`

### Customer journey

- [Account access](https://github.com/devang44/apnacart/blob/main/register.php): `register.php`
- [Customer login](https://github.com/devang44/apnacart/blob/main/login.php): `login.php`
- [Shopping cart](https://github.com/devang44/apnacart/blob/main/cart.php): `cart.php`
- [Checkout](https://github.com/devang44/apnacart/blob/main/checkout.php): `checkout.php`
- [Payment](https://github.com/devang44/apnacart/blob/main/payment.php): `payment.php`
- [Order placement](https://github.com/devang44/apnacart/blob/main/place_order.php): `place_order.php`
- [Order tracking](https://github.com/devang44/apnacart/blob/main/orders.php): `orders.php`
- [Order invoice](https://github.com/devang44/apnacart/blob/main/invoice.php): `invoice.php`
- [Wishlist](https://github.com/devang44/apnacart/blob/main/wishlist.php): `wishlist.php`

### Seller administration

- [Admin dashboard](https://github.com/devang44/apnacart/blob/main/admin/index.php): `admin/index.php`
- [Catalog management](https://github.com/devang44/apnacart/blob/main/admin/add_product.php): `admin/add_product.php`
- [Product editing](https://github.com/devang44/apnacart/blob/main/admin/edit_product.php): `admin/edit_product.php`
- [Offer management](https://github.com/devang44/apnacart/blob/main/admin/offers.php): `admin/offers.php`
- [Order management](https://github.com/devang44/apnacart/blob/main/admin/orders.php): `admin/orders.php`
- [User management](https://github.com/devang44/apnacart/blob/main/admin/users.php): `admin/users.php`
- [Invoice reporting](https://github.com/devang44/apnacart/blob/main/admin/invoice_report.php): `admin/invoice_report.php`

### Shared services

- [Offer calculation](https://github.com/devang44/apnacart/blob/main/include/offer_functions.php): `include/offer_functions.php`
- [Store navigation](https://github.com/devang44/apnacart/blob/main/include/navbar.php): `include/navbar.php`
- [ApnaCart database](https://github.com/devang44/apnacart/blob/main/config/db.php): `config/db.php`

### Other components

- **Shopper**

## Connections

- Shopper → Home discovery: opens (evidence: `index.php`)
- Shopper → Product browsing: browses (evidence: `shop.php`)
- Shopper → Product detail: views (evidence: `product.php`)
- Product detail → Shopping cart: adds item (evidence: `product.php`)
- Product detail → Checkout: buys now (evidence: `product.php`)
- Shopper → Account access: registers (evidence: `register.php`)
- Shopper → Customer login: signs in (evidence: `login.php`)
- Shopper → Shopping cart: updates (evidence: `cart.php`)
- Shopper → Checkout: checks out (evidence: `checkout.php`)
- Shopper → Payment: pays (evidence: `payment.php`)
- Shopper → Order tracking: tracks order (evidence: `orders.php`)
- Shopper → Wishlist: saves items (evidence: `wishlist.php`)
- Shopper → Order invoice: views bill
- Shopping cart → Offer calculation: calculates discount (evidence: `cart.php`)
- Payment → Offer calculation: calculates discount (evidence: `payment.php`)
- Home discovery → ApnaCart database: queries products (evidence: `index.php`)
- Product browsing → ApnaCart database: queries catalog (evidence: `shop.php`)
- Product detail → ApnaCart database: loads product (evidence: `product.php`)
- Shopping cart → ApnaCart database: reads and updates (evidence: `cart.php`)
- Checkout → ApnaCart database: queries data (evidence: `checkout.php`)
- Payment → ApnaCart database: queries data (evidence: `payment.php`)
- Order placement → ApnaCart database: writes order
- Order tracking → ApnaCart database: queries orders (evidence: `orders.php`)
- Order invoice → ApnaCart database: queries order (evidence: `invoice.php`)
- Wishlist → ApnaCart database: queries wishlist (evidence: `wishlist.php`)
- Admin dashboard → ApnaCart database: queries metrics (evidence: `admin/index.php`)
- Catalog management → ApnaCart database: manages products (evidence: `admin/add_product.php`)
- Product editing → ApnaCart database: updates products (evidence: `admin/edit_product.php`)
- Offer management → ApnaCart database: manages offers (evidence: `admin/offers.php`)
- Order management → ApnaCart database: manages orders (evidence: `admin/orders.php`)
- User management → ApnaCart database: manages users (evidence: `admin/users.php`)
- Invoice reporting → ApnaCart database: queries invoices (evidence: `admin/invoice_report.php`)
- Store navigation → ApnaCart database: loads categories (evidence: `include/navbar.php`)
