# mhnobakht/github-view-counter-project architecture

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

- Interactive diagram: https://gitdiagram.com/mhnobakht/github-view-counter-project
- Repository: https://github.com/mhnobakht/github-view-counter-project

## Overview

This PHP application provides user registration and login, then lets authenticated users create and view tracked links; visiting a link’s UUID increments its view count and returns a PNG counter badge. The principal flow runs from login through the protected dashboard to link management and tracking. Database.php centralizes MySQL access. The README is empty, and unsampled dashboard routing and page handlers limit certainty about some connections; the graph shows only relationships supported by excerpts or the source index.

Main entry points: [`Classes/Link.php`](https://github.com/mhnobakht/github-view-counter-project/blob/main/Classes/Link.php) (Link operations), [`Classes/Database.php`](https://github.com/mhnobakht/github-view-counter-project/blob/main/Classes/Database.php) (MySQL access), [`Classes/Login.php`](https://github.com/mhnobakht/github-view-counter-project/blob/main/Classes/Login.php) (Authenticate users), [`dashboard.php`](https://github.com/mhnobakht/github-view-counter-project/blob/main/dashboard.php) (Protected dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Account access"]
  node_register_endpoint["Registration form<br/>[register.php]"]
  node_register_logic["Register users<br/>[Register.php]"]
  node_login_endpoint["Login form<br/>[login.php]"]
  node_login_logic["Authenticate users<br/>[Login.php]"]
  node_auth_token["Auth token library"]
end

subgraph group_links["Link tracking"]
  node_link_list["Link listing<br/>[Default.php]"]
  node_link_form["Create link form<br/>[New.php]"]
  node_link_logic["Link operations<br/>[Link.php]"]
  node_badge_endpoint["View badge endpoint<br/>[show.php]"]
end

subgraph group_runtime["Dashboard runtime"]
  node_dashboard["Protected dashboard<br/>[dashboard.php]"]
  node_database[("MySQL access<br/>[Database.php]")]
end

node_visitor(("Browser user"))
node_mysql[("MySQL server")]

node_visitor -->|"submits registration"| node_register_endpoint
node_register_endpoint -->|"creates user"| node_register_logic
node_visitor -->|"submits credentials"| node_login_endpoint
node_login_endpoint -->|"invokes login"| node_login_logic
node_login_logic -->|"checks credentials"| node_database
node_login_logic -->|"generates token"| node_auth_token
node_dashboard -->|"checks or deletes token"| node_auth_token
node_dashboard -->|"references page"| node_link_list
node_link_list -->|"loads links"| node_link_logic
node_link_form -->|"creates link"| node_link_logic
node_link_logic -->|"reads and writes"| node_database
node_register_logic -->|"inserts user"| node_database
node_visitor -->|"requests UUID badge"| node_badge_endpoint
node_badge_endpoint -->|"increments counter"| node_link_logic
node_database -->|"connects via PDO"| node_mysql

click node_register_endpoint "https://github.com/mhnobakht/github-view-counter-project/blob/main/register.php"
click node_register_logic "https://github.com/mhnobakht/github-view-counter-project/blob/main/Classes/Register.php"
click node_login_endpoint "https://github.com/mhnobakht/github-view-counter-project/blob/main/login.php"
click node_login_logic "https://github.com/mhnobakht/github-view-counter-project/blob/main/Classes/Login.php"
click node_dashboard "https://github.com/mhnobakht/github-view-counter-project/blob/main/dashboard.php"
click node_link_list "https://github.com/mhnobakht/github-view-counter-project/blob/main/pages/Default.php"
click node_link_form "https://github.com/mhnobakht/github-view-counter-project/blob/main/pages/New.php"
click node_link_logic "https://github.com/mhnobakht/github-view-counter-project/blob/main/Classes/Link.php"
click node_badge_endpoint "https://github.com/mhnobakht/github-view-counter-project/blob/main/show.php"
click node_database "https://github.com/mhnobakht/github-view-counter-project/blob/main/Classes/Database.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_register_endpoint,node_register_logic,node_login_endpoint,node_login_logic,node_auth_token,node_visitor toneBlue
class node_link_list,node_link_form,node_link_logic,node_badge_endpoint,node_mysql toneAmber
class node_dashboard,node_database toneMint
```

## Components

### Account access

- [Registration form](https://github.com/mhnobakht/github-view-counter-project/blob/main/register.php): `register.php`
- [Register users](https://github.com/mhnobakht/github-view-counter-project/blob/main/Classes/Register.php): `Classes/Register.php`
- [Login form](https://github.com/mhnobakht/github-view-counter-project/blob/main/login.php): `login.php`
- [Authenticate users](https://github.com/mhnobakht/github-view-counter-project/blob/main/Classes/Login.php): `Classes/Login.php`
- **Auth token library**

### Link tracking

- [Link listing](https://github.com/mhnobakht/github-view-counter-project/blob/main/pages/Default.php): `pages/Default.php`
- [Create link form](https://github.com/mhnobakht/github-view-counter-project/blob/main/pages/New.php): `pages/New.php`
- [Link operations](https://github.com/mhnobakht/github-view-counter-project/blob/main/Classes/Link.php): `Classes/Link.php`
- [View badge endpoint](https://github.com/mhnobakht/github-view-counter-project/blob/main/show.php): `show.php`

### Dashboard runtime

- [Protected dashboard](https://github.com/mhnobakht/github-view-counter-project/blob/main/dashboard.php): `dashboard.php`
- [MySQL access](https://github.com/mhnobakht/github-view-counter-project/blob/main/Classes/Database.php): `Classes/Database.php`

### Other components

- **Browser user**
- **MySQL server**

## Connections

- Browser user → Registration form: submits registration (evidence: `register.php`)
- Registration form → Register users: creates user (evidence: `register.php`)
- Browser user → Login form: submits credentials (evidence: `login.php`)
- Login form → Authenticate users: invokes login (evidence: `login.php`)
- Authenticate users → MySQL access: checks credentials (evidence: `Classes/Login.php`)
- Authenticate users → Auth token library: generates token (evidence: `Classes/Login.php`)
- Protected dashboard → Auth token library: checks or deletes token (evidence: `dashboard.php`)
- Protected dashboard → Link listing: references page (evidence: `dashboard.php`)
- Link listing → Link operations: loads links (evidence: `pages/Default.php`)
- Create link form → Link operations: creates link (evidence: `pages/New.php`)
- Link operations → MySQL access: reads and writes (evidence: `Classes/Link.php`)
- Register users → MySQL access: inserts user (evidence: `Classes/Register.php`)
- Browser user → View badge endpoint: requests UUID badge (evidence: `show.php`)
- View badge endpoint → Link operations: increments counter (evidence: `show.php`)
- MySQL access → MySQL server: connects via PDO (evidence: `Classes/Database.php`)
