# fatimabasem/itcs333-project-store architecture

> Architecture diagram of the GitHub repository fatimabasem/itcs333-project-store, 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/fatimabasem/itcs333-project-store
- Repository: https://github.com/fatimabasem/itcs333-project-store

## Overview

Campus Marketplace is a modular PHP/JavaScript store. A visitor uses the shared frontend, which requests catalog data through the API router; the router dispatches each area to its module handler, and implemented handlers read or write shared database state and return JSON. The README also defines cart, checkout/order, and admin capabilities, but the real cart and admin handlers shown here are placeholders. The graph preserves those documented stages without implying they are implemented. Edges reflect the router and sampled handlers; unsampled page behavior is not inferred.

Main entry points: [`public/api.php`](https://github.com/fatimabasem/itcs333-project-store/blob/master/public/api.php) (API router), [`src/db.php`](https://github.com/fatimabasem/itcs333-project-store/blob/master/src/db.php) (PDO connector), [`modules/m1_auth/handler.php`](https://github.com/fatimabasem/itcs333-project-store/blob/master/modules/m1_auth/handler.php) (Authentication), [`modules/m2_catalog/handler.php`](https://github.com/fatimabasem/itcs333-project-store/blob/master/modules/m2_catalog/handler.php) (Product catalog)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_webapp["Web shell<br/>[index.html]"]
  node_appjs["Catalog loader<br/>[app.js]"]
end

subgraph group_routing["API routing"]
  node_router["API router<br/>[api.php]"]
  node_http["HTTP helpers<br/>[http.php]"]
end

subgraph group_features["Store modules"]
  node_auth["Authentication<br/>[handler.php]"]
  node_catalog["Product catalog<br/>[handler.php]"]
  node_cart["Shopping cart<br/>[handler.php]"]
  node_orders["Checkout and orders<br/>[handler.php]"]
  node_admin["Admin tools<br/>[handler.php]"]
end

subgraph group_persistence["Persistence"]
  node_dbhelpers["PDO connector<br/>[db.php]"]
  node_store[("Marketplace data<br/>[schema.sql]")]
  node_seed["Initial data<br/>[seed.sql]"]
end

node_visitor(("Visitor"))

node_visitor -->|"uses"| node_webapp
node_webapp -.->|"loads shell"| node_appjs
node_appjs -->|"requests catalog"| node_router
node_router -->|"dispatches"| node_auth
node_router -->|"dispatches"| node_catalog
node_router -->|"dispatches"| node_cart
node_router -->|"dispatches"| node_orders
node_router -->|"dispatches"| node_admin
node_router -->|"loads helpers"| node_http
node_auth -->|"opens connection"| node_dbhelpers
node_catalog -->|"opens connection"| node_dbhelpers
node_orders -->|"opens connection"| node_dbhelpers
node_auth -->|"sends responses"| node_http
node_catalog -->|"sends responses"| node_http
node_orders -->|"sends responses"| node_http
node_dbhelpers -->|"bootstraps schema"| node_store
node_dbhelpers -->|"loads seed"| node_seed
node_auth -->|"reads and writes users"| node_store
node_catalog -->|"reads products"| node_store
node_orders -->|"reads and writes orders"| node_store

click node_webapp "https://github.com/fatimabasem/itcs333-project-store/blob/master/public/index.html"
click node_appjs "https://github.com/fatimabasem/itcs333-project-store/blob/master/public/app.js"
click node_router "https://github.com/fatimabasem/itcs333-project-store/blob/master/public/api.php"
click node_http "https://github.com/fatimabasem/itcs333-project-store/blob/master/src/http.php"
click node_auth "https://github.com/fatimabasem/itcs333-project-store/blob/master/modules/m1_auth/handler.php"
click node_catalog "https://github.com/fatimabasem/itcs333-project-store/blob/master/modules/m2_catalog/handler.php"
click node_cart "https://github.com/fatimabasem/itcs333-project-store/blob/master/modules/m3_cart/handler.php"
click node_orders "https://github.com/fatimabasem/itcs333-project-store/blob/master/modules/m4_orders/handler.php"
click node_admin "https://github.com/fatimabasem/itcs333-project-store/blob/master/modules/m5_admin/handler.php"
click node_dbhelpers "https://github.com/fatimabasem/itcs333-project-store/blob/master/src/db.php"
click node_store "https://github.com/fatimabasem/itcs333-project-store/blob/master/schema.sql"
click node_seed "https://github.com/fatimabasem/itcs333-project-store/blob/master/seed.sql"

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_appjs toneBlue
class node_router,node_http toneAmber
class node_auth,node_catalog,node_cart,node_orders,node_admin toneMint
class node_dbhelpers,node_store,node_seed toneRose
class node_visitor toneIndigo
```

## Components

### Frontend

- [Web shell](https://github.com/fatimabasem/itcs333-project-store/blob/master/public/index.html): `public/index.html`
- [Catalog loader](https://github.com/fatimabasem/itcs333-project-store/blob/master/public/app.js): `public/app.js`

### API routing

- [API router](https://github.com/fatimabasem/itcs333-project-store/blob/master/public/api.php): `public/api.php`
- [HTTP helpers](https://github.com/fatimabasem/itcs333-project-store/blob/master/src/http.php): `src/http.php`

### Store modules

- [Authentication](https://github.com/fatimabasem/itcs333-project-store/blob/master/modules/m1_auth/handler.php): `modules/m1_auth/handler.php`
- [Product catalog](https://github.com/fatimabasem/itcs333-project-store/blob/master/modules/m2_catalog/handler.php): `modules/m2_catalog/handler.php`
- [Shopping cart](https://github.com/fatimabasem/itcs333-project-store/blob/master/modules/m3_cart/handler.php): `modules/m3_cart/handler.php`
- [Checkout and orders](https://github.com/fatimabasem/itcs333-project-store/blob/master/modules/m4_orders/handler.php): `modules/m4_orders/handler.php`
- [Admin tools](https://github.com/fatimabasem/itcs333-project-store/blob/master/modules/m5_admin/handler.php): `modules/m5_admin/handler.php`

### Persistence

- [PDO connector](https://github.com/fatimabasem/itcs333-project-store/blob/master/src/db.php): `src/db.php`
- [Marketplace data](https://github.com/fatimabasem/itcs333-project-store/blob/master/schema.sql): `schema.sql`
- [Initial data](https://github.com/fatimabasem/itcs333-project-store/blob/master/seed.sql): `seed.sql`

### Other components

- **Visitor**

## Connections

- Visitor → Web shell: uses (evidence: `README.md`)
- Web shell → Catalog loader: loads shell
- Catalog loader → API router: requests catalog (evidence: `public/app.js`)
- API router → Authentication: dispatches (evidence: `public/api.php`)
- API router → Product catalog: dispatches (evidence: `public/api.php`)
- API router → Shopping cart: dispatches (evidence: `public/api.php`)
- API router → Checkout and orders: dispatches (evidence: `public/api.php`)
- API router → Admin tools: dispatches (evidence: `public/api.php`)
- API router → HTTP helpers: loads helpers (evidence: `public/api.php`)
- Authentication → PDO connector: opens connection (evidence: `modules/m1_auth/handler.php`)
- Product catalog → PDO connector: opens connection (evidence: `modules/m2_catalog/handler.php`)
- Checkout and orders → PDO connector: opens connection (evidence: `modules/m4_orders/handler.php`)
- Authentication → HTTP helpers: sends responses (evidence: `modules/m1_auth/handler.php`)
- Product catalog → HTTP helpers: sends responses (evidence: `modules/m2_catalog/handler.php`)
- Checkout and orders → HTTP helpers: sends responses (evidence: `modules/m4_orders/handler.php`)
- PDO connector → Marketplace data: bootstraps schema (evidence: `src/db.php`)
- PDO connector → Initial data: loads seed (evidence: `src/db.php`)
- Authentication → Marketplace data: reads and writes users (evidence: `modules/m1_auth/handler.php`)
- Product catalog → Marketplace data: reads products (evidence: `modules/m2_catalog/handler.php`)
- Checkout and orders → Marketplace data: reads and writes orders (evidence: `modules/m4_orders/handler.php`)
