# exerssd/project-kel4-pemweb architecture

> Architecture diagram of the GitHub repository exerssd/project-kel4-pemweb, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/exerssd/project-kel4-pemweb
- Repository: https://github.com/exerssd/project-kel4-pemweb

## Overview

AlifStore is a native PHP/MySQL Robux top-up storefront with a separate admin area. The customer workflow covers account access, browsing packages, submitting an order, and reviewing its status; admins manage the catalog and advance or remove orders. The README also describes search, theme switching, and flash sales, but those are static or frontend capabilities rather than payment or fulfillment integrations. Several frontend modules and some API endpoints were not excerpted, so their internal call wiring is not asserted.

Main entry points: [`backend/includes/auth.php`](https://github.com/exerssd/project-kel4-pemweb/blob/main/backend/includes/auth.php) (Session access control), [`backend/config/database.php`](https://github.com/exerssd/project-kel4-pemweb/blob/main/backend/config/database.php) (Database connection), [`frontend/index.html`](https://github.com/exerssd/project-kel4-pemweb/blob/main/frontend/index.html) (Storefront page), [`frontend/js/main.js`](https://github.com/exerssd/project-kel4-pemweb/blob/main/frontend/js/main.js) (App interactions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Customer storefront"]
  node_store["Storefront page<br/>[index.html]"]
  node_main["App interactions<br/>[main.js]"]
  node_authjs["Customer account UI<br/>[auth.js]"]
  node_catalogdata["Store data<br/>[data.js]"]
  node_render["Catalog rendering<br/>[render.js]"]
  node_modal["Order and account dialogs<br/>[modal.js]"]
end

subgraph group_services["Backend services"]
  node_api_auth["Account API<br/>[auth.php]"]
  node_api_products["Product API<br/>[Products.php]"]
  node_create_order["Order creation<br/>[order-create.php]"]
  node_order_history["Customer order history<br/>[order-status.php]"]
  node_delete_order["Customer order deletion<br/>[order-delete.php]"]
end

subgraph group_admin["Admin operations"]
  node_admin_login["Admin login<br/>[login.php]"]
  node_dashboard["Admin dashboard<br/>[index.php]"]
  node_product_management["Product management<br/>[products.php]"]
  node_order_management["Order management<br/>[orders.php]"]
  node_admin_logout["Admin logout<br/>[logout.php]"]
end

subgraph group_shared["Shared data and access"]
  node_session_access["Session access control<br/>[auth.php]"]
  node_helpers["Request and value helpers<br/>[functions.php]"]
  node_responses["JSON responses<br/>[response.php]"]
  node_database["Database connection<br/>[database.php]"]
  node_schema[("Store database<br/>[schema.sql]")]
end

node_customer(("Customer"))
node_admin_actor(("Administrator"))

node_customer -->|"browses"| node_store
node_admin_actor -->|"signs in"| node_admin_login
node_admin_login -->|"redirects"| node_dashboard
node_dashboard -->|"checks role"| node_session_access
node_dashboard -->|"reads summary"| node_database
node_product_management -->|"checks role"| node_session_access
node_product_management -->|"reads and writes"| node_database
node_order_management -->|"checks role"| node_session_access
node_order_management -->|"reads and updates"| node_database
node_api_auth -->|"uses session"| node_session_access
node_api_auth -->|"parses and cleans"| node_helpers
node_api_auth -.->|"reads and writes"| node_database
node_create_order -->|"requires customer"| node_session_access
node_create_order -->|"parses and validates"| node_helpers
node_create_order -->|"reserves and saves"| node_database
node_order_history -->|"requires customer"| node_session_access
node_order_history -->|"reads orders"| node_database
node_delete_order -->|"requires customer"| node_session_access
node_delete_order -->|"parses request"| node_helpers
node_delete_order -->|"deletes order"| node_database
node_session_access -->|"loads connection"| node_database
node_session_access -->|"rejects access"| node_responses
node_api_products -->|"loads connection"| node_database
node_api_products -->|"formats response"| node_responses
node_store -.->|"loads interactions"| node_main
node_main -.->|"coordinates account UI"| node_authjs
node_main -.->|"coordinates display"| node_render
node_main -.->|"coordinates dialogs"| node_modal
node_render -.->|"uses catalog data"| node_catalogdata
node_modal -.->|"submits order"| node_create_order
node_authjs -.->|"sends account requests"| node_api_auth
node_store -.->|"loads products"| node_api_products
node_store -.->|"requests history"| node_order_history
node_store -.->|"requests deletion"| node_delete_order
node_admin_logout -->|"uses session"| node_session_access
node_schema -.->|"defines stored data"| node_database

click node_store "https://github.com/exerssd/project-kel4-pemweb/blob/main/frontend/index.html"
click node_main "https://github.com/exerssd/project-kel4-pemweb/blob/main/frontend/js/main.js"
click node_authjs "https://github.com/exerssd/project-kel4-pemweb/blob/main/frontend/js/auth.js"
click node_catalogdata "https://github.com/exerssd/project-kel4-pemweb/blob/main/frontend/js/data.js"
click node_render "https://github.com/exerssd/project-kel4-pemweb/blob/main/frontend/js/render.js"
click node_modal "https://github.com/exerssd/project-kel4-pemweb/blob/main/frontend/js/modal.js"
click node_api_auth "https://github.com/exerssd/project-kel4-pemweb/blob/main/backend/api/auth.php"
click node_api_products "https://github.com/exerssd/project-kel4-pemweb/blob/main/backend/api/Products.php"
click node_create_order "https://github.com/exerssd/project-kel4-pemweb/blob/main/backend/api/order-create.php"
click node_order_history "https://github.com/exerssd/project-kel4-pemweb/blob/main/backend/api/order-status.php"
click node_delete_order "https://github.com/exerssd/project-kel4-pemweb/blob/main/backend/api/order-delete.php"
click node_admin_login "https://github.com/exerssd/project-kel4-pemweb/blob/main/backend/admin/login.php"
click node_dashboard "https://github.com/exerssd/project-kel4-pemweb/blob/main/backend/admin/index.php"
click node_product_management "https://github.com/exerssd/project-kel4-pemweb/blob/main/backend/admin/products.php"
click node_order_management "https://github.com/exerssd/project-kel4-pemweb/blob/main/backend/admin/orders.php"
click node_admin_logout "https://github.com/exerssd/project-kel4-pemweb/blob/main/backend/admin/logout.php"
click node_session_access "https://github.com/exerssd/project-kel4-pemweb/blob/main/backend/includes/auth.php"
click node_helpers "https://github.com/exerssd/project-kel4-pemweb/blob/main/backend/includes/functions.php"
click node_responses "https://github.com/exerssd/project-kel4-pemweb/blob/main/backend/includes/response.php"
click node_database "https://github.com/exerssd/project-kel4-pemweb/blob/main/backend/config/database.php"
click node_schema "https://github.com/exerssd/project-kel4-pemweb/blob/main/backend/database/schema.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_store,node_main,node_authjs,node_catalogdata,node_render,node_modal toneBlue
class node_api_auth,node_api_products,node_create_order,node_order_history,node_delete_order toneAmber
class node_admin_login,node_dashboard,node_product_management,node_order_management,node_admin_logout toneMint
class node_session_access,node_helpers,node_responses,node_database,node_schema toneRose
class node_customer,node_admin_actor toneIndigo
```

## Components

### Customer storefront

- [Storefront page](https://github.com/exerssd/project-kel4-pemweb/blob/main/frontend/index.html): `frontend/index.html`
- [App interactions](https://github.com/exerssd/project-kel4-pemweb/blob/main/frontend/js/main.js): `frontend/js/main.js`
- [Customer account UI](https://github.com/exerssd/project-kel4-pemweb/blob/main/frontend/js/auth.js): `frontend/js/auth.js`
- [Store data](https://github.com/exerssd/project-kel4-pemweb/blob/main/frontend/js/data.js): `frontend/js/data.js`
- [Catalog rendering](https://github.com/exerssd/project-kel4-pemweb/blob/main/frontend/js/render.js): `frontend/js/render.js`
- [Order and account dialogs](https://github.com/exerssd/project-kel4-pemweb/blob/main/frontend/js/modal.js): `frontend/js/modal.js`

### Backend services

- [Account API](https://github.com/exerssd/project-kel4-pemweb/blob/main/backend/api/auth.php): `backend/api/auth.php`
- [Product API](https://github.com/exerssd/project-kel4-pemweb/blob/main/backend/api/Products.php): `backend/api/Products.php`
- [Order creation](https://github.com/exerssd/project-kel4-pemweb/blob/main/backend/api/order-create.php): `backend/api/order-create.php`
- [Customer order history](https://github.com/exerssd/project-kel4-pemweb/blob/main/backend/api/order-status.php): `backend/api/order-status.php`
- [Customer order deletion](https://github.com/exerssd/project-kel4-pemweb/blob/main/backend/api/order-delete.php): `backend/api/order-delete.php`

### Admin operations

- [Admin login](https://github.com/exerssd/project-kel4-pemweb/blob/main/backend/admin/login.php): `backend/admin/login.php`
- [Admin dashboard](https://github.com/exerssd/project-kel4-pemweb/blob/main/backend/admin/index.php): `backend/admin/index.php`
- [Product management](https://github.com/exerssd/project-kel4-pemweb/blob/main/backend/admin/products.php): `backend/admin/products.php`
- [Order management](https://github.com/exerssd/project-kel4-pemweb/blob/main/backend/admin/orders.php): `backend/admin/orders.php`
- [Admin logout](https://github.com/exerssd/project-kel4-pemweb/blob/main/backend/admin/logout.php): `backend/admin/logout.php`

### Shared data and access

- [Session access control](https://github.com/exerssd/project-kel4-pemweb/blob/main/backend/includes/auth.php): `backend/includes/auth.php`
- [Request and value helpers](https://github.com/exerssd/project-kel4-pemweb/blob/main/backend/includes/functions.php): `backend/includes/functions.php`
- [JSON responses](https://github.com/exerssd/project-kel4-pemweb/blob/main/backend/includes/response.php): `backend/includes/response.php`
- [Database connection](https://github.com/exerssd/project-kel4-pemweb/blob/main/backend/config/database.php): `backend/config/database.php`
- [Store database](https://github.com/exerssd/project-kel4-pemweb/blob/main/backend/database/schema.sql): `backend/database/schema.sql`

### Other components

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

## Connections

- Customer → Storefront page: browses (evidence: `README.md`)
- Administrator → Admin login: signs in (evidence: `README.md`)
- Admin login → Admin dashboard: redirects (evidence: `backend/admin/login.php`)
- Admin dashboard → Session access control: checks role (evidence: `backend/admin/index.php`)
- Admin dashboard → Database connection: reads summary (evidence: `backend/admin/index.php`)
- Product management → Session access control: checks role (evidence: `backend/admin/products.php`)
- Product management → Database connection: reads and writes (evidence: `backend/admin/products.php`)
- Order management → Session access control: checks role (evidence: `backend/admin/orders.php`)
- Order management → Database connection: reads and updates (evidence: `backend/admin/orders.php`)
- Account API → Session access control: uses session (evidence: `backend/api/auth.php`)
- Account API → Request and value helpers: parses and cleans (evidence: `backend/api/auth.php`)
- Account API → Database connection: reads and writes
- Order creation → Session access control: requires customer (evidence: `backend/api/order-create.php`)
- Order creation → Request and value helpers: parses and validates (evidence: `backend/api/order-create.php`)
- Order creation → Database connection: reserves and saves (evidence: `backend/api/order-create.php`)
- Customer order history → Session access control: requires customer (evidence: `backend/api/order-status.php`)
- Customer order history → Database connection: reads orders (evidence: `backend/api/order-status.php`)
- Customer order deletion → Session access control: requires customer (evidence: `backend/api/order-delete.php`)
- Customer order deletion → Request and value helpers: parses request (evidence: `backend/api/order-delete.php`)
- Customer order deletion → Database connection: deletes order (evidence: `backend/api/order-delete.php`)
- Session access control → Database connection: loads connection (evidence: `backend/includes/auth.php`)
- Session access control → JSON responses: rejects access (evidence: `backend/includes/auth.php`)
- Product API → Database connection: loads connection (evidence: `backend/api/Products.php`)
- Product API → JSON responses: formats response (evidence: `backend/api/Products.php`)
- Storefront page → App interactions: loads interactions
- App interactions → Customer account UI: coordinates account UI
- App interactions → Catalog rendering: coordinates display
- App interactions → Order and account dialogs: coordinates dialogs
- Catalog rendering → Store data: uses catalog data
- Order and account dialogs → Order creation: submits order
- Customer account UI → Account API: sends account requests
- Storefront page → Product API: loads products
- Storefront page → Customer order history: requests history
- Storefront page → Customer order deletion: requests deletion
- Admin logout → Session access control: uses session (evidence: `backend/admin/logout.php`)
- Store database → Database connection: defines stored data
