# razannabilwebdev/final-project-pbw architecture

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

- Interactive diagram: https://gitdiagram.com/razannabilwebdev/final-project-pbw
- Repository: https://github.com/razannabilwebdev/final-project-pbw

## Overview

Groceria is a PHP/MySQL web application for running a small grocery shop. Staff authenticate and enter role-specific dashboards; administrators manage inventory, suppliers, users, reports, and purchasing, while cashiers handle sales and customer records. A sale selects products and a customer, builds a cart, calculates discounts and change, and submits the transaction; reports and dashboards monitor shop activity. The excerpts confirm selected page-to-database and template dependencies. Other business capabilities are documented in the README, but their internal calls were not sampled, so those links are shown as unverified.

Main entry points: [`config/koneksi.php`](https://github.com/razannabilwebdev/final-project-pbw/blob/main/config/koneksi.php) (MySQL database), [`transaksi/index.php`](https://github.com/razannabilwebdev/final-project-pbw/blob/main/transaksi/index.php) (Sale entry and cart), [`config/session.php`](https://github.com/razannabilwebdev/final-project-pbw/blob/main/config/session.php) (Session and roles), [`barang/index.php`](https://github.com/razannabilwebdev/final-project-pbw/blob/main/barang/index.php) (Inventory and stock)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and Accounts"]
  node_login["Sign in<br/>[login.php]"]
  node_registration["Registration<br/>[register.php]"]
  node_otp["OTP verification<br/>[verify_otp.php]"]
  node_otp_service["OTP email flow<br/>[send_otp.php]"]
  node_otp_verify_service["OTP validation<br/>[verify_otp.php]"]
  node_user_admin["User management<br/>[index.php]"]
end

subgraph group_operations["Shop Operations"]
  node_admin_dash["Admin dashboard<br/>[admin.php]"]
  node_cashier_dash["Cashier dashboard<br/>[kasir.php]"]
  node_inventory["Inventory and stock<br/>[index.php]"]
  node_item_forms["Item editing<br/>[edit_barang.php]"]
  node_item_add["Item creation<br/>[tambah_barang.php]"]
  node_purchasing["Stock purchasing<br/>[pembelian.php]"]
  node_suppliers["Supplier management<br/>[index.php]"]
  node_customers["Customer and points<br/>[index.php]"]
end

subgraph group_sales["Sales and Reporting"]
  node_sale_entry["Sale entry and cart<br/>[index.php]"]
  node_product_lookup["Product lookup<br/>[cari_barang.php]"]
  node_customer_lookup["Customer lookup<br/>[cari_pelanggan.php]"]
  node_sale_submit["Transaction processing"]
  node_history["Sales history<br/>[riwayat.php]"]
  node_receipt["Receipt printing<br/>[cetak_struk.php]"]
  node_reports["Sales reports<br/>[laporan.php]"]
  node_report_print["Report printing<br/>[cetak_laporan.php]"]
end

subgraph group_shared["Shared Infrastructure"]
  node_database[("MySQL database<br/>[koneksi.php]")]
  node_session["Session and roles<br/>[session.php]"]
  node_mailer["Email delivery<br/>[mailer.php]"]
  node_templates["Navigation and layout<br/>[sidebar.php]"]
end

node_staff(("Shop staff"))

node_staff -->|"signs in"| node_login
node_staff -.->|"creates account"| node_registration
node_staff -.->|"submits code"| node_otp
node_login -->|"checks account"| node_database
node_login -->|"uses roles"| node_session
node_registration -->|"saves account"| node_database
node_registration -->|"uses session"| node_session
node_otp_service -->|"checks code"| node_database
node_otp_service -->|"sends email"| node_mailer
node_otp -.->|"submits code"| node_otp_verify_service
node_user_admin -->|"reads users"| node_database
node_user_admin -->|"checks admin"| node_session
node_admin_dash -->|"reads metrics"| node_database
node_cashier_dash -->|"reads metrics"| node_database
node_inventory -->|"reads inventory"| node_database
node_inventory -->|"checks roles"| node_session
node_inventory -->|"includes navigation"| node_templates
node_item_forms -->|"loads item"| node_database
node_item_add -->|"writes item"| node_database
node_purchasing -->|"uses database"| node_database
node_suppliers -->|"uses database"| node_database
node_customers -->|"reads customers"| node_database
node_customers -->|"checks roles"| node_session
node_sale_entry -->|"loads customers"| node_database
node_sale_entry -->|"checks login"| node_session
node_sale_entry -.->|"searches products"| node_product_lookup
node_sale_entry -.->|"searches customers"| node_customer_lookup
node_sale_entry -->|"posts cart"| node_sale_submit
node_sale_submit -->|"records sale"| node_database
node_history -->|"reads sales"| node_database
node_receipt -->|"reads transaction"| node_database
node_reports -->|"queries sales"| node_database
node_reports -.->|"offers print"| node_report_print
node_admin_dash -->|"includes navigation"| node_templates
node_cashier_dash -->|"includes navigation"| node_templates

click node_login "https://github.com/razannabilwebdev/final-project-pbw/blob/main/login.php"
click node_registration "https://github.com/razannabilwebdev/final-project-pbw/blob/main/register.php"
click node_otp "https://github.com/razannabilwebdev/final-project-pbw/blob/main/verify_otp.php"
click node_otp_service "https://github.com/razannabilwebdev/final-project-pbw/blob/main/config/send_otp.php"
click node_otp_verify_service "https://github.com/razannabilwebdev/final-project-pbw/blob/main/config/verify_otp.php"
click node_user_admin "https://github.com/razannabilwebdev/final-project-pbw/blob/main/user/index.php"
click node_admin_dash "https://github.com/razannabilwebdev/final-project-pbw/blob/main/dashboard/admin.php"
click node_cashier_dash "https://github.com/razannabilwebdev/final-project-pbw/blob/main/dashboard/kasir.php"
click node_inventory "https://github.com/razannabilwebdev/final-project-pbw/blob/main/barang/index.php"
click node_item_forms "https://github.com/razannabilwebdev/final-project-pbw/blob/main/barang/edit_barang.php"
click node_item_add "https://github.com/razannabilwebdev/final-project-pbw/blob/main/barang/tambah_barang.php"
click node_purchasing "https://github.com/razannabilwebdev/final-project-pbw/blob/main/barang/pembelian.php"
click node_suppliers "https://github.com/razannabilwebdev/final-project-pbw/blob/main/supplier/index.php"
click node_customers "https://github.com/razannabilwebdev/final-project-pbw/blob/main/pelanggan/index.php"
click node_sale_entry "https://github.com/razannabilwebdev/final-project-pbw/blob/main/transaksi/index.php"
click node_product_lookup "https://github.com/razannabilwebdev/final-project-pbw/blob/main/transaksi/cari_barang.php"
click node_customer_lookup "https://github.com/razannabilwebdev/final-project-pbw/blob/main/transaksi/cari_pelanggan.php"
click node_sale_submit "https://github.com/razannabilwebdev/final-project-pbw/blob/main/transaksi/proses_transaksi.php"
click node_history "https://github.com/razannabilwebdev/final-project-pbw/blob/main/transaksi/riwayat.php"
click node_receipt "https://github.com/razannabilwebdev/final-project-pbw/blob/main/transaksi/cetak_struk.php"
click node_reports "https://github.com/razannabilwebdev/final-project-pbw/blob/main/laporan/laporan.php"
click node_report_print "https://github.com/razannabilwebdev/final-project-pbw/blob/main/laporan/cetak_laporan.php"
click node_database "https://github.com/razannabilwebdev/final-project-pbw/blob/main/config/koneksi.php"
click node_session "https://github.com/razannabilwebdev/final-project-pbw/blob/main/config/session.php"
click node_mailer "https://github.com/razannabilwebdev/final-project-pbw/blob/main/config/mailer.php"
click node_templates "https://github.com/razannabilwebdev/final-project-pbw/blob/main/templates/sidebar.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_login,node_registration,node_otp,node_otp_service,node_otp_verify_service,node_user_admin toneBlue
class node_admin_dash,node_cashier_dash,node_inventory,node_item_forms,node_item_add,node_purchasing,node_suppliers,node_customers toneAmber
class node_sale_entry,node_product_lookup,node_customer_lookup,node_sale_submit,node_history,node_receipt,node_reports,node_report_print toneMint
class node_database,node_session,node_mailer,node_templates toneRose
class node_staff toneIndigo
```

## Components

### Access and Accounts

- [Sign in](https://github.com/razannabilwebdev/final-project-pbw/blob/main/login.php): `login.php`
- [Registration](https://github.com/razannabilwebdev/final-project-pbw/blob/main/register.php): `register.php`
- [OTP verification](https://github.com/razannabilwebdev/final-project-pbw/blob/main/verify_otp.php): `verify_otp.php`
- [OTP email flow](https://github.com/razannabilwebdev/final-project-pbw/blob/main/config/send_otp.php): `config/send_otp.php`
- [OTP validation](https://github.com/razannabilwebdev/final-project-pbw/blob/main/config/verify_otp.php): `config/verify_otp.php`
- [User management](https://github.com/razannabilwebdev/final-project-pbw/blob/main/user/index.php): `user/index.php`

### Shop Operations

- [Admin dashboard](https://github.com/razannabilwebdev/final-project-pbw/blob/main/dashboard/admin.php): `dashboard/admin.php`
- [Cashier dashboard](https://github.com/razannabilwebdev/final-project-pbw/blob/main/dashboard/kasir.php): `dashboard/kasir.php`
- [Inventory and stock](https://github.com/razannabilwebdev/final-project-pbw/blob/main/barang/index.php): `barang/index.php`
- [Item editing](https://github.com/razannabilwebdev/final-project-pbw/blob/main/barang/edit_barang.php): `barang/edit_barang.php`
- [Item creation](https://github.com/razannabilwebdev/final-project-pbw/blob/main/barang/tambah_barang.php): `barang/tambah_barang.php`
- [Stock purchasing](https://github.com/razannabilwebdev/final-project-pbw/blob/main/barang/pembelian.php): `barang/pembelian.php`
- [Supplier management](https://github.com/razannabilwebdev/final-project-pbw/blob/main/supplier/index.php): `supplier/index.php`
- [Customer and points](https://github.com/razannabilwebdev/final-project-pbw/blob/main/pelanggan/index.php): `pelanggan/index.php`

### Sales and Reporting

- [Sale entry and cart](https://github.com/razannabilwebdev/final-project-pbw/blob/main/transaksi/index.php): `transaksi/index.php`
- [Product lookup](https://github.com/razannabilwebdev/final-project-pbw/blob/main/transaksi/cari_barang.php): `transaksi/cari_barang.php`
- [Customer lookup](https://github.com/razannabilwebdev/final-project-pbw/blob/main/transaksi/cari_pelanggan.php): `transaksi/cari_pelanggan.php`
- [Transaction processing](https://github.com/razannabilwebdev/final-project-pbw/blob/main/transaksi/proses_transaksi.php): `transaksi/proses_transaksi.php`
- [Sales history](https://github.com/razannabilwebdev/final-project-pbw/blob/main/transaksi/riwayat.php): `transaksi/riwayat.php`
- [Receipt printing](https://github.com/razannabilwebdev/final-project-pbw/blob/main/transaksi/cetak_struk.php): `transaksi/cetak_struk.php`
- [Sales reports](https://github.com/razannabilwebdev/final-project-pbw/blob/main/laporan/laporan.php): `laporan/laporan.php`
- [Report printing](https://github.com/razannabilwebdev/final-project-pbw/blob/main/laporan/cetak_laporan.php): `laporan/cetak_laporan.php`

### Shared Infrastructure

- [MySQL database](https://github.com/razannabilwebdev/final-project-pbw/blob/main/config/koneksi.php): `config/koneksi.php`
- [Session and roles](https://github.com/razannabilwebdev/final-project-pbw/blob/main/config/session.php): `config/session.php`
- [Email delivery](https://github.com/razannabilwebdev/final-project-pbw/blob/main/config/mailer.php): `config/mailer.php`
- [Navigation and layout](https://github.com/razannabilwebdev/final-project-pbw/blob/main/templates/sidebar.php): `templates/sidebar.php`

### Other components

- **Shop staff**

## Connections

- Shop staff → Sign in: signs in (evidence: `login.php`)
- Shop staff → Registration: creates account
- Shop staff → OTP verification: submits code
- Sign in → MySQL database: checks account (evidence: `login.php`)
- Sign in → Session and roles: uses roles (evidence: `login.php`)
- Registration → MySQL database: saves account (evidence: `register.php`)
- Registration → Session and roles: uses session (evidence: `register.php`)
- OTP email flow → MySQL database: checks code (evidence: `config/send_otp.php`)
- OTP email flow → Email delivery: sends email (evidence: `config/send_otp.php`)
- OTP verification → OTP validation: submits code
- User management → MySQL database: reads users (evidence: `user/index.php`)
- User management → Session and roles: checks admin (evidence: `user/index.php`)
- Admin dashboard → MySQL database: reads metrics (evidence: `dashboard/admin.php`)
- Cashier dashboard → MySQL database: reads metrics (evidence: `dashboard/kasir.php`)
- Inventory and stock → MySQL database: reads inventory (evidence: `barang/index.php`)
- Inventory and stock → Session and roles: checks roles (evidence: `barang/index.php`)
- Inventory and stock → Navigation and layout: includes navigation (evidence: `barang/index.php`)
- Item editing → MySQL database: loads item (evidence: `barang/edit_barang.php`)
- Item creation → MySQL database: writes item (evidence: `barang/tambah_barang.php`)
- Stock purchasing → MySQL database: uses database (evidence: `barang/pembelian.php`)
- Supplier management → MySQL database: uses database (evidence: `supplier/index.php`)
- Customer and points → MySQL database: reads customers (evidence: `pelanggan/index.php`)
- Customer and points → Session and roles: checks roles (evidence: `pelanggan/index.php`)
- Sale entry and cart → MySQL database: loads customers (evidence: `transaksi/index.php`)
- Sale entry and cart → Session and roles: checks login (evidence: `transaksi/index.php`)
- Sale entry and cart → Product lookup: searches products
- Sale entry and cart → Customer lookup: searches customers
- Sale entry and cart → Transaction processing: posts cart (evidence: `transaksi/index.php`)
- Transaction processing → MySQL database: records sale (evidence: `transaksi/proses_transaksi.php`)
- Sales history → MySQL database: reads sales (evidence: `transaksi/riwayat.php`)
- Receipt printing → MySQL database: reads transaction (evidence: `transaksi/cetak_struk.php`)
- Sales reports → MySQL database: queries sales (evidence: `laporan/laporan.php`)
- Sales reports → Report printing: offers print
- Admin dashboard → Navigation and layout: includes navigation (evidence: `dashboard/admin.php`)
- Cashier dashboard → Navigation and layout: includes navigation (evidence: `dashboard/kasir.php`)
