# akmallalala/kopitarik architecture

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

- Interactive diagram: https://gitdiagram.com/akmallalala/kopitarik
- Repository: https://github.com/akmallalala/kopitarik

## Overview

KopiTarikBn is a PHP coffee-shop web application. The evidenced workflow is login submission: credentials are checked against admin and customer records, a role-specific session is set, and the browser is redirected to the relevant landing page. The admin dashboard then reads product, category, order, and revenue summaries. The tree and excerpts show login and dashboard behavior, but do not establish implementation details for the storefront, checkout, or linked admin management pages; those are not mapped as implemented components.

Main entry points: [`actions/login_process.php`](https://github.com/akmallalala/kopitarik/blob/main/actions/login_process.php) (Login processor), [`admin/dashboard.php`](https://github.com/akmallalala/kopitarik/blob/main/admin/dashboard.php) (Admin dashboard), [`login.php`](https://github.com/akmallalala/kopitarik/blob/main/login.php) (Login form), [`admin/logout.php`](https://github.com/akmallalala/kopitarik/blob/main/admin/logout.php) (Admin logout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_auth["Authentication"]
  node_login["Login form<br/>[login.php]"]
  node_login_process["Login processor<br/>[login_process.php]"]
  node_admin_guard["Admin session guard<br/>[admin_auth.php]"]
  node_logout["Admin logout<br/>[logout.php]"]
end

subgraph group_admin["Admin dashboard"]
  node_admin_area["Admin dashboard<br/>[dashboard.php]"]
  node_admin_sidebar["Admin navigation<br/>[sidebar.php]"]
end

subgraph group_infra["Shared infrastructure"]
  node_db_connect["PDO connection<br/>[db_connect.php]"]
  node_shop_db[("Coffee shop database<br/>[coffee_shop.sql]")]
end

node_visitor(("Visitor"))
node_home["Storefront entry<br/>[index.php]"]
node_products_page["Product page<br/>[product.php]"]

node_visitor -->|"opens"| node_login
node_login -->|"submits credentials"| node_login_process
node_login_process -->|"queries through"| node_db_connect
node_login_process -->|"checks credentials"| node_shop_db
node_login_process -->|"redirects admin"| node_admin_area
node_login_process -->|"redirects customer"| node_home
node_admin_area -->|"requires"| node_admin_guard
node_admin_area -->|"queries summaries"| node_db_connect
node_admin_area -->|"reads dashboard data"| node_shop_db
node_admin_area -->|"includes navigation"| node_admin_sidebar
node_admin_sidebar -->|"links to"| node_logout
node_visitor -.->|"opens"| node_home
node_visitor -.->|"opens"| node_products_page
node_logout -.->|"redirects"| node_login

click node_login "https://github.com/akmallalala/kopitarik/blob/main/login.php"
click node_login_process "https://github.com/akmallalala/kopitarik/blob/main/actions/login_process.php"
click node_admin_area "https://github.com/akmallalala/kopitarik/blob/main/admin/dashboard.php"
click node_admin_sidebar "https://github.com/akmallalala/kopitarik/blob/main/admin/include/sidebar.php"
click node_admin_guard "https://github.com/akmallalala/kopitarik/blob/main/include/admin_auth.php"
click node_logout "https://github.com/akmallalala/kopitarik/blob/main/admin/logout.php"
click node_db_connect "https://github.com/akmallalala/kopitarik/blob/main/include/db_connect.php"
click node_shop_db "https://github.com/akmallalala/kopitarik/blob/main/database/coffee_shop.sql"
click node_home "https://github.com/akmallalala/kopitarik/blob/main/index.php"
click node_products_page "https://github.com/akmallalala/kopitarik/blob/main/product.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_login_process,node_admin_guard,node_logout toneBlue
class node_admin_area,node_admin_sidebar toneAmber
class node_db_connect,node_shop_db toneMint
class node_visitor toneIndigo
class node_home,node_products_page toneTeal
```

## Components

### Authentication

- [Login form](https://github.com/akmallalala/kopitarik/blob/main/login.php): `login.php`
- [Login processor](https://github.com/akmallalala/kopitarik/blob/main/actions/login_process.php): `actions/login_process.php`
- [Admin session guard](https://github.com/akmallalala/kopitarik/blob/main/include/admin_auth.php): `include/admin_auth.php`
- [Admin logout](https://github.com/akmallalala/kopitarik/blob/main/admin/logout.php): `admin/logout.php`

### Admin dashboard

- [Admin dashboard](https://github.com/akmallalala/kopitarik/blob/main/admin/dashboard.php): `admin/dashboard.php`
- [Admin navigation](https://github.com/akmallalala/kopitarik/blob/main/admin/include/sidebar.php): `admin/include/sidebar.php`

### Shared infrastructure

- [PDO connection](https://github.com/akmallalala/kopitarik/blob/main/include/db_connect.php): `include/db_connect.php`
- [Coffee shop database](https://github.com/akmallalala/kopitarik/blob/main/database/coffee_shop.sql): `database/coffee_shop.sql`

### Other components

- **Visitor**
- [Storefront entry](https://github.com/akmallalala/kopitarik/blob/main/index.php): `index.php`
- [Product page](https://github.com/akmallalala/kopitarik/blob/main/product.php): `product.php`

## Connections

- Visitor → Login form: opens (evidence: `login.php`)
- Login form → Login processor: submits credentials (evidence: `login.php`)
- Login processor → PDO connection: queries through (evidence: `actions/login_process.php`)
- Login processor → Coffee shop database: checks credentials (evidence: `actions/login_process.php`)
- Login processor → Admin dashboard: redirects admin (evidence: `actions/login_process.php`)
- Login processor → Storefront entry: redirects customer (evidence: `actions/login_process.php`)
- Admin dashboard → Admin session guard: requires (evidence: `admin/dashboard.php`)
- Admin dashboard → PDO connection: queries summaries (evidence: `admin/dashboard.php`)
- Admin dashboard → Coffee shop database: reads dashboard data (evidence: `admin/dashboard.php`)
- Admin dashboard → Admin navigation: includes navigation (evidence: `admin/dashboard.php`)
- Admin navigation → Admin logout: links to (evidence: `admin/include/sidebar.php`)
- Visitor → Storefront entry: opens
- Visitor → Product page: opens
- Admin logout → Login form: redirects
