# sivabalaji-tn/tamizhmart architecture

> Architecture diagram of the GitHub repository sivabalaji-tn/tamizhmart, 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/sivabalaji-tn/tamizhmart
- Repository: https://github.com/sivabalaji-tn/tamizhmart

## Overview

TamizhMart is a multi-tenant PHP commerce platform: shoppers discover a shop, browse its catalog, manage a cart, and place COD or Razorpay orders; shop owners configure and operate their storefronts, while super-admins manage platform accounts and subscriptions. The map preserves authentication, email, payments, and PWA capabilities documented in the README. Excerpts and the SOURCE INDEX support only some implementation links; less-visible feature connections are omitted rather than inferred.

Main entry points: [`owner/dashboard.php`](https://github.com/sivabalaji-tn/tamizhmart/blob/main/owner/dashboard.php) (Owner dashboard), [`config/db.php`](https://github.com/sivabalaji-tn/tamizhmart/blob/main/config/db.php) (MySQL database), [`shop/index.php`](https://github.com/sivabalaji-tn/tamizhmart/blob/main/shop/index.php) (Shop home), [`shop/checkout.php`](https://github.com/sivabalaji-tn/tamizhmart/blob/main/shop/checkout.php) (Checkout & orders)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_store["Customer storefront"]
  node_storefront["Shop home<br/>[index.php]"]
  node_catalog["Catalog &amp; product<br/>[products.php]"]
  node_cart["Shopping cart<br/>[cart.php]"]
  node_checkout["Checkout &amp; orders<br/>[checkout.php]"]
  node_payments["Razorpay payments"]
end

subgraph group_identity["Authentication"]
  node_customer_account["Customer account<br/>[login.php]"]
  node_oauth["Google OAuth"]
  node_otp["OTP recovery<br/>[verify_otp.php]"]
end

subgraph group_owner["Shop operations"]
  node_owner_dashboard["Owner dashboard<br/>[dashboard.php]"]
  node_products["Product management<br/>[products.php]"]
  node_orders["Order management<br/>[orders.php]"]
  node_campaigns["Campaigns<br/>[campaigns.php]"]
  node_settings["Store settings &amp; theme<br/>[settings.php]"]
  node_analytics["Analytics<br/>[analytics.php]"]
end

subgraph group_platform["Platform administration"]
  node_admin_console["Admin console<br/>[dashboard.php]"]
  node_subscriptions["Plans &amp; subscriptions<br/>[subscriptions.php]"]
  node_audit["Audit &amp; commissions<br/>[audit.php]"]
end

subgraph group_services["Shared services"]
  node_database[("MySQL database<br/>[db.php]")]
  node_mailer["PHPMailer<br/>[PHPMailer.php]"]
  node_pwa["PWA offline support<br/>[sw.js]"]
  node_offline_page["Offline fallback<br/>[offline.php]"]
end

node_shopper(("Shopper"))
node_owner(("Shop owner"))
node_superadmin(("Platform administrator"))
node_smtp["Gmail SMTP"]

node_shopper -->|"visits"| node_storefront
node_storefront -->|"browses"| node_catalog
node_shopper -->|"updates"| node_cart
node_cart -->|"checks out"| node_checkout
node_checkout -->|"pays online"| node_payments
node_shopper -->|"signs in"| node_customer_account
node_customer_account -->|"offers sign-in"| node_oauth
node_customer_account -->|"supports recovery"| node_otp
node_owner -->|"manages shop"| node_owner_dashboard
node_owner_dashboard -->|"manages products"| node_products
node_owner_dashboard -->|"manages orders"| node_orders
node_owner_dashboard -->|"runs campaigns"| node_campaigns
node_owner_dashboard -->|"configures storefront"| node_settings
node_owner_dashboard -->|"views analytics"| node_analytics
node_campaigns -->|"sends email"| node_mailer
node_mailer -->|"delivers mail"| node_smtp
node_superadmin -->|"manages platform"| node_admin_console
node_admin_console -->|"manages plans"| node_subscriptions
node_subscriptions -->|"records collections"| node_audit
node_storefront -->|"reads shop data"| node_database
node_checkout -->|"records orders"| node_database
node_owner_dashboard -->|"uses database"| node_database
node_subscriptions -->|"reads and writes"| node_database
node_pwa -.->|"offline fallback"| node_offline_page

click node_storefront "https://github.com/sivabalaji-tn/tamizhmart/blob/main/shop/index.php"
click node_catalog "https://github.com/sivabalaji-tn/tamizhmart/blob/main/shop/products.php"
click node_cart "https://github.com/sivabalaji-tn/tamizhmart/blob/main/shop/cart.php"
click node_checkout "https://github.com/sivabalaji-tn/tamizhmart/blob/main/shop/checkout.php"
click node_payments "https://github.com/sivabalaji-tn/tamizhmart/blob/main/shop/razorpay_create_order.php"
click node_customer_account "https://github.com/sivabalaji-tn/tamizhmart/blob/main/auth/login.php"
click node_oauth "https://github.com/sivabalaji-tn/tamizhmart/blob/main/auth/google_oauth_init.php"
click node_otp "https://github.com/sivabalaji-tn/tamizhmart/blob/main/auth/verify_otp.php"
click node_owner_dashboard "https://github.com/sivabalaji-tn/tamizhmart/blob/main/owner/dashboard.php"
click node_products "https://github.com/sivabalaji-tn/tamizhmart/blob/main/owner/products.php"
click node_orders "https://github.com/sivabalaji-tn/tamizhmart/blob/main/owner/orders.php"
click node_campaigns "https://github.com/sivabalaji-tn/tamizhmart/blob/main/owner/campaigns.php"
click node_settings "https://github.com/sivabalaji-tn/tamizhmart/blob/main/owner/settings.php"
click node_analytics "https://github.com/sivabalaji-tn/tamizhmart/blob/main/owner/analytics.php"
click node_admin_console "https://github.com/sivabalaji-tn/tamizhmart/blob/main/superadmin/dashboard.php"
click node_subscriptions "https://github.com/sivabalaji-tn/tamizhmart/blob/main/superadmin/subscriptions.php"
click node_audit "https://github.com/sivabalaji-tn/tamizhmart/blob/main/superadmin/includes/audit.php"
click node_database "https://github.com/sivabalaji-tn/tamizhmart/blob/main/config/db.php"
click node_mailer "https://github.com/sivabalaji-tn/tamizhmart/blob/main/PHPMailer-master/src/PHPMailer.php"
click node_pwa "https://github.com/sivabalaji-tn/tamizhmart/blob/main/sw.js"
click node_offline_page "https://github.com/sivabalaji-tn/tamizhmart/blob/main/offline.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_storefront,node_catalog,node_cart,node_checkout,node_payments toneBlue
class node_customer_account,node_oauth,node_otp toneAmber
class node_owner_dashboard,node_products,node_orders,node_campaigns,node_settings,node_analytics toneMint
class node_admin_console,node_subscriptions,node_audit toneRose
class node_database,node_mailer,node_pwa,node_offline_page,node_shopper,node_owner,node_superadmin,node_smtp toneIndigo
```

## Components

### Customer storefront

- [Shop home](https://github.com/sivabalaji-tn/tamizhmart/blob/main/shop/index.php): `shop/index.php`
- [Catalog & product](https://github.com/sivabalaji-tn/tamizhmart/blob/main/shop/products.php): `shop/products.php`
- [Shopping cart](https://github.com/sivabalaji-tn/tamizhmart/blob/main/shop/cart.php): `shop/cart.php`
- [Checkout & orders](https://github.com/sivabalaji-tn/tamizhmart/blob/main/shop/checkout.php): `shop/checkout.php`
- [Razorpay payments](https://github.com/sivabalaji-tn/tamizhmart/blob/main/shop/razorpay_create_order.php): `shop/razorpay_create_order.php`

### Authentication

- [Customer account](https://github.com/sivabalaji-tn/tamizhmart/blob/main/auth/login.php): `auth/login.php`
- [Google OAuth](https://github.com/sivabalaji-tn/tamizhmart/blob/main/auth/google_oauth_init.php): `auth/google_oauth_init.php`
- [OTP recovery](https://github.com/sivabalaji-tn/tamizhmart/blob/main/auth/verify_otp.php): `auth/verify_otp.php`

### Shop operations

- [Owner dashboard](https://github.com/sivabalaji-tn/tamizhmart/blob/main/owner/dashboard.php): `owner/dashboard.php`
- [Product management](https://github.com/sivabalaji-tn/tamizhmart/blob/main/owner/products.php): `owner/products.php`
- [Order management](https://github.com/sivabalaji-tn/tamizhmart/blob/main/owner/orders.php): `owner/orders.php`
- [Campaigns](https://github.com/sivabalaji-tn/tamizhmart/blob/main/owner/campaigns.php): `owner/campaigns.php`
- [Store settings & theme](https://github.com/sivabalaji-tn/tamizhmart/blob/main/owner/settings.php): `owner/settings.php`
- [Analytics](https://github.com/sivabalaji-tn/tamizhmart/blob/main/owner/analytics.php): `owner/analytics.php`

### Platform administration

- [Admin console](https://github.com/sivabalaji-tn/tamizhmart/blob/main/superadmin/dashboard.php): `superadmin/dashboard.php`
- [Plans & subscriptions](https://github.com/sivabalaji-tn/tamizhmart/blob/main/superadmin/subscriptions.php): `superadmin/subscriptions.php`
- [Audit & commissions](https://github.com/sivabalaji-tn/tamizhmart/blob/main/superadmin/includes/audit.php): `superadmin/includes/audit.php`

### Shared services

- [MySQL database](https://github.com/sivabalaji-tn/tamizhmart/blob/main/config/db.php): `config/db.php`
- [PHPMailer](https://github.com/sivabalaji-tn/tamizhmart/blob/main/PHPMailer-master/src/PHPMailer.php): `PHPMailer-master/src/PHPMailer.php`
- [PWA offline support](https://github.com/sivabalaji-tn/tamizhmart/blob/main/sw.js): `sw.js`
- [Offline fallback](https://github.com/sivabalaji-tn/tamizhmart/blob/main/offline.php): `offline.php`

### Other components

- **Shopper**
- **Shop owner**
- **Platform administrator**
- **Gmail SMTP**

## Connections

- Shopper → Shop home: visits
- Shop home → Catalog & product: browses
- Shopper → Shopping cart: updates
- Shopping cart → Checkout & orders: checks out
- Checkout & orders → Razorpay payments: pays online
- Shopper → Customer account: signs in
- Customer account → Google OAuth: offers sign-in (evidence: `auth/login.php`)
- Customer account → OTP recovery: supports recovery
- Shop owner → Owner dashboard: manages shop
- Owner dashboard → Product management: manages products
- Owner dashboard → Order management: manages orders
- Owner dashboard → Campaigns: runs campaigns
- Owner dashboard → Store settings & theme: configures storefront
- Owner dashboard → Analytics: views analytics
- Campaigns → PHPMailer: sends email (evidence: `owner/campaigns.php`)
- PHPMailer → Gmail SMTP: delivers mail
- Platform administrator → Admin console: manages platform
- Admin console → Plans & subscriptions: manages plans
- Plans & subscriptions → Audit & commissions: records collections (evidence: `superadmin/subscriptions.php`)
- Shop home → MySQL database: reads shop data (evidence: `shop/index.php`)
- Checkout & orders → MySQL database: records orders (evidence: `shop/checkout.php`)
- Owner dashboard → MySQL database: uses database
- Plans & subscriptions → MySQL database: reads and writes (evidence: `superadmin/subscriptions.php`)
- PWA offline support → Offline fallback: offline fallback
