# fafirruh/dpw architecture

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

- Interactive diagram: https://gitdiagram.com/fafirruh/dpw
- Repository: https://github.com/fafirruh/dpw

## Overview

This repository is a set of practical web-development Jobsheets, with later lessons building a small shop-management application and Jobsheet 7 demonstrating a mini-library. The main user workflow is to open the shop dashboard, manage inventory and customers, record purchases or stock outflows, and review stock and cash summaries. The tree and README establish the lesson progression; sampled pages support the dashboard, listing, authentication, and routing relationships. Other CRUD handlers and financial reporting are represented by their existing directories and documented capabilities, without assuming unsampled call details.

Main entry points: [`Jobsheet10/includes/koneksi.php`](https://github.com/fafirruh/dpw/blob/main/Jobsheet10/includes/koneksi.php) (Database Connection), [`api/index.php`](https://github.com/fafirruh/dpw/blob/main/api/index.php) (PHP Router), [`Jobsheet10/includes/auth.php`](https://github.com/fafirruh/dpw/blob/main/Jobsheet10/includes/auth.php) (Session Guard), [`Jobsheet10/pelanggan/list.php`](https://github.com/fafirruh/dpw/blob/main/Jobsheet10/pelanggan/list.php) (Customer Pages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_routing["Web Entry"]
  node_router["PHP Router<br/>[index.php]"]
end

subgraph group_store["Shop Management"]
  node_home["Shop Dashboard<br/>[index.php]"]
  node_inventory["Inventory Pages<br/>[list.php]"]
  node_inventory_ops["Inventory Actions"]
  node_customers["Customer Pages<br/>[list.php]"]
  node_customer_ops["Customer Actions"]
  node_sales["Purchase Recording<br/>[proses_beli.php]"]
  node_db_config["Database Connection<br/>[koneksi.php]"]
end

subgraph group_identity["Authentication"]
  node_auth_pages["Login Registration"]
  node_auth_guard["Session Guard<br/>[auth.php]"]
end

subgraph group_learning["Earlier Lessons"]
  node_library["Mini Library"]
  node_library_home["Library Dashboard<br/>[index.php]"]
  node_library_catalog["Books Members"]
  node_lesson8["Database Lesson"]
  node_lesson9["CRUD Lesson"]
end

node_visitor(("Shop User"))
node_database[("PostgreSQL Data")]
node_session[("PHP Session")]
node_remember_cookie["Remember Cookie"]

node_visitor -->|"requests page"| node_router
node_router -->|"dispatches PHP"| node_home
node_router -->|"dispatches PHP"| node_inventory
node_router -->|"dispatches PHP"| node_customers
node_router -->|"dispatches PHP"| node_auth_pages
node_home -->|"queries summaries"| node_db_config
node_inventory -->|"reads inventory"| node_db_config
node_inventory_ops -->|"updates inventory"| node_db_config
node_customers -->|"reads customers"| node_db_config
node_customer_ops -->|"updates customers"| node_db_config
node_customers -->|"posts purchase"| node_sales
node_sales -->|"records purchase"| node_db_config
node_db_config -->|"connects to"| node_database
node_auth_pages -->|"checks session"| node_auth_guard
node_auth_guard -->|"reads session"| node_session
node_auth_guard -->|"checks cookie"| node_remember_cookie
node_auth_guard -->|"looks up user"| node_db_config
node_visitor -->|"opens lesson"| node_library_home
node_library_home -->|"links modules"| node_library_catalog
node_visitor -.->|"opens lesson"| node_lesson8
node_visitor -.->|"opens lesson"| node_lesson9

click node_router "https://github.com/fafirruh/dpw/blob/main/api/index.php"
click node_home "https://github.com/fafirruh/dpw/blob/main/Jobsheet10/index.php"
click node_inventory "https://github.com/fafirruh/dpw/blob/main/Jobsheet10/barang/list.php"
click node_inventory_ops "https://github.com/fafirruh/dpw/tree/main/Jobsheet10/barang"
click node_customers "https://github.com/fafirruh/dpw/blob/main/Jobsheet10/pelanggan/list.php"
click node_customer_ops "https://github.com/fafirruh/dpw/tree/main/Jobsheet10/pelanggan"
click node_sales "https://github.com/fafirruh/dpw/blob/main/Jobsheet10/pelanggan/proses_beli.php"
click node_auth_pages "https://github.com/fafirruh/dpw/tree/main/Jobsheet10/auth"
click node_auth_guard "https://github.com/fafirruh/dpw/blob/main/Jobsheet10/includes/auth.php"
click node_db_config "https://github.com/fafirruh/dpw/blob/main/Jobsheet10/includes/koneksi.php"
click node_library "https://github.com/fafirruh/dpw/tree/main/Jobsheet7"
click node_library_home "https://github.com/fafirruh/dpw/blob/main/Jobsheet7/index.php"
click node_library_catalog "https://github.com/fafirruh/dpw/tree/main/Jobsheet7"
click node_lesson8 "https://github.com/fafirruh/dpw/tree/main/Jobsheet8"
click node_lesson9 "https://github.com/fafirruh/dpw/tree/main/Jobsheet9"

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_router,node_visitor toneBlue
class node_home,node_inventory,node_inventory_ops,node_customers,node_customer_ops,node_sales,node_db_config,node_database,node_session toneAmber
class node_auth_pages,node_auth_guard toneMint
class node_library,node_library_home,node_library_catalog,node_lesson8,node_lesson9 toneRose
class node_remember_cookie toneIndigo
```

## Components

### Web Entry

- [PHP Router](https://github.com/fafirruh/dpw/blob/main/api/index.php): `api/index.php`

### Shop Management

- [Shop Dashboard](https://github.com/fafirruh/dpw/blob/main/Jobsheet10/index.php): `Jobsheet10/index.php`
- [Inventory Pages](https://github.com/fafirruh/dpw/blob/main/Jobsheet10/barang/list.php): `Jobsheet10/barang/list.php`
- [Inventory Actions](https://github.com/fafirruh/dpw/tree/main/Jobsheet10/barang): `Jobsheet10/barang`
- [Customer Pages](https://github.com/fafirruh/dpw/blob/main/Jobsheet10/pelanggan/list.php): `Jobsheet10/pelanggan/list.php`
- [Customer Actions](https://github.com/fafirruh/dpw/tree/main/Jobsheet10/pelanggan): `Jobsheet10/pelanggan`
- [Purchase Recording](https://github.com/fafirruh/dpw/blob/main/Jobsheet10/pelanggan/proses_beli.php): `Jobsheet10/pelanggan/proses_beli.php`
- [Database Connection](https://github.com/fafirruh/dpw/blob/main/Jobsheet10/includes/koneksi.php): `Jobsheet10/includes/koneksi.php`

### Authentication

- [Login Registration](https://github.com/fafirruh/dpw/tree/main/Jobsheet10/auth): `Jobsheet10/auth`
- [Session Guard](https://github.com/fafirruh/dpw/blob/main/Jobsheet10/includes/auth.php): `Jobsheet10/includes/auth.php`

### Earlier Lessons

- [Mini Library](https://github.com/fafirruh/dpw/tree/main/Jobsheet7): `Jobsheet7`
- [Library Dashboard](https://github.com/fafirruh/dpw/blob/main/Jobsheet7/index.php): `Jobsheet7/index.php`
- [Books Members](https://github.com/fafirruh/dpw/tree/main/Jobsheet7): `Jobsheet7`
- [Database Lesson](https://github.com/fafirruh/dpw/tree/main/Jobsheet8): `Jobsheet8`
- [CRUD Lesson](https://github.com/fafirruh/dpw/tree/main/Jobsheet9): `Jobsheet9`

### Other components

- **Shop User**
- **PostgreSQL Data**
- **PHP Session**
- **Remember Cookie**

## Connections

- Shop User → PHP Router: requests page
- PHP Router → Shop Dashboard: dispatches PHP
- PHP Router → Inventory Pages: dispatches PHP
- PHP Router → Customer Pages: dispatches PHP
- PHP Router → Login Registration: dispatches PHP
- Shop Dashboard → Database Connection: queries summaries
- Inventory Pages → Database Connection: reads inventory
- Inventory Actions → Database Connection: updates inventory
- Customer Pages → Database Connection: reads customers
- Customer Actions → Database Connection: updates customers
- Customer Pages → Purchase Recording: posts purchase
- Purchase Recording → Database Connection: records purchase
- Database Connection → PostgreSQL Data: connects to
- Login Registration → Session Guard: checks session
- Session Guard → PHP Session: reads session
- Session Guard → Remember Cookie: checks cookie
- Session Guard → Database Connection: looks up user
- Shop User → Library Dashboard: opens lesson
- Library Dashboard → Books Members: links modules
- Shop User → Database Lesson: opens lesson
- Shop User → CRUD Lesson: opens lesson
