# aidantok/cisc472-locker architecture

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

- Interactive diagram: https://gitdiagram.com/aidantok/cisc472-locker
- Repository: https://github.com/aidantok/cisc472-locker

## Overview

Locker is a small PHP/SQLite shared-secret shelf. Members register or sign in, then view and add account-scoped vault items; a separate recovery flow issues and checks same-day reset tokens. The front controller owns route dispatch, while auth, crypto, and vault modules provide supporting behavior. The README documents seeded member and advisor accounts and campus-mail reset delivery; the mail integration is not shown in sampled source.

Main entry points: [`public/index.php`](https://github.com/aidantok/cisc472-locker/blob/main/public/index.php) (Route handler), [`src/bootstrap.php`](https://github.com/aidantok/cisc472-locker/blob/main/src/bootstrap.php) (App bootstrap), [`src/auth.php`](https://github.com/aidantok/cisc472-locker/blob/main/src/auth.php) (Account sessions), [`src/crypto.php`](https://github.com/aidantok/cisc472-locker/blob/main/src/crypto.php) (Password and tokens)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Web entry"]
  node_router["PHP router<br/>[router.php]"]
  node_front["Route handler<br/>[index.php]"]
  node_bootstrap["App bootstrap<br/>[bootstrap.php]"]
end

subgraph group_identity["Identity and recovery"]
  node_auth["Account sessions<br/>[auth.php]"]
  node_crypto["Password and tokens<br/>[crypto.php]"]
  node_reset_mail["Campus mail"]
  node_auth_views["Account forms"]
  node_reset_view["Reset form<br/>[reset.php]"]
end

subgraph group_vault["Personal vault"]
  node_vault_ops["Vault operations<br/>[vault.php]"]
  node_home_view["Shelf view<br/>[home.php]"]
  node_new_view["New-item form<br/>[new_item.php]"]
end

subgraph group_persistence["Persistence and views"]
  node_db[("SQLite access<br/>[db.php]")]
end

node_member(("Member"))

node_member -->|"requests pages"| node_router
node_router -->|"dispatches requests"| node_front
node_front -->|"loads app"| node_bootstrap
node_bootstrap -->|"loads module"| node_auth
node_bootstrap -->|"loads module"| node_crypto
node_bootstrap -->|"loads module"| node_vault_ops
node_front -->|"handles accounts"| node_auth
node_front -->|"handles resets"| node_crypto
node_front -->|"reads and adds"| node_vault_ops
node_auth -->|"hashes passwords"| node_crypto
node_auth -->|"queries users"| node_db
node_crypto -->|"stores tokens"| node_db
node_vault_ops -->|"reads and writes"| node_db
node_front -->|"renders shelf"| node_home_view
node_front -->|"renders form"| node_new_view
node_front -->|"renders account pages"| node_auth_views
node_front -->|"renders reset page"| node_reset_view
node_front -.->|"queues reset link"| node_reset_mail

click node_router "https://github.com/aidantok/cisc472-locker/blob/main/public/router.php"
click node_front "https://github.com/aidantok/cisc472-locker/blob/main/public/index.php"
click node_bootstrap "https://github.com/aidantok/cisc472-locker/blob/main/src/bootstrap.php"
click node_auth "https://github.com/aidantok/cisc472-locker/blob/main/src/auth.php"
click node_crypto "https://github.com/aidantok/cisc472-locker/blob/main/src/crypto.php"
click node_vault_ops "https://github.com/aidantok/cisc472-locker/blob/main/src/vault.php"
click node_home_view "https://github.com/aidantok/cisc472-locker/blob/main/templates/home.php"
click node_new_view "https://github.com/aidantok/cisc472-locker/blob/main/templates/new_item.php"
click node_auth_views "https://github.com/aidantok/cisc472-locker/tree/main/templates"
click node_reset_view "https://github.com/aidantok/cisc472-locker/blob/main/templates/reset.php"
click node_db "https://github.com/aidantok/cisc472-locker/blob/main/src/db.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_router,node_front,node_bootstrap toneBlue
class node_auth,node_crypto,node_reset_mail,node_auth_views,node_reset_view toneAmber
class node_vault_ops,node_home_view,node_new_view toneMint
class node_db toneRose
class node_member toneIndigo
```

## Components

### Web entry

- [PHP router](https://github.com/aidantok/cisc472-locker/blob/main/public/router.php): `public/router.php`
- [Route handler](https://github.com/aidantok/cisc472-locker/blob/main/public/index.php): `public/index.php`
- [App bootstrap](https://github.com/aidantok/cisc472-locker/blob/main/src/bootstrap.php): `src/bootstrap.php`

### Identity and recovery

- [Account sessions](https://github.com/aidantok/cisc472-locker/blob/main/src/auth.php): `src/auth.php`
- [Password and tokens](https://github.com/aidantok/cisc472-locker/blob/main/src/crypto.php): `src/crypto.php`
- **Campus mail**
- [Account forms](https://github.com/aidantok/cisc472-locker/tree/main/templates): `templates`
- [Reset form](https://github.com/aidantok/cisc472-locker/blob/main/templates/reset.php): `templates/reset.php`

### Personal vault

- [Vault operations](https://github.com/aidantok/cisc472-locker/blob/main/src/vault.php): `src/vault.php`
- [Shelf view](https://github.com/aidantok/cisc472-locker/blob/main/templates/home.php): `templates/home.php`
- [New-item form](https://github.com/aidantok/cisc472-locker/blob/main/templates/new_item.php): `templates/new_item.php`

### Persistence and views

- [SQLite access](https://github.com/aidantok/cisc472-locker/blob/main/src/db.php): `src/db.php`

### Other components

- **Member**

## Connections

- Member → PHP router: requests pages (evidence: `README.md`)
- PHP router → Route handler: dispatches requests (evidence: `public/router.php`)
- Route handler → App bootstrap: loads app (evidence: `public/index.php`)
- App bootstrap → Account sessions: loads module (evidence: `src/bootstrap.php`)
- App bootstrap → Password and tokens: loads module (evidence: `src/bootstrap.php`)
- App bootstrap → Vault operations: loads module (evidence: `src/bootstrap.php`)
- Route handler → Account sessions: handles accounts (evidence: `public/index.php`)
- Route handler → Password and tokens: handles resets (evidence: `public/index.php`)
- Route handler → Vault operations: reads and adds (evidence: `public/index.php`)
- Account sessions → Password and tokens: hashes passwords (evidence: `src/auth.php`)
- Account sessions → SQLite access: queries users (evidence: `src/auth.php`)
- Password and tokens → SQLite access: stores tokens (evidence: `src/crypto.php`)
- Vault operations → SQLite access: reads and writes (evidence: `src/vault.php`)
- Route handler → Shelf view: renders shelf (evidence: `public/index.php`)
- Route handler → New-item form: renders form (evidence: `public/index.php`)
- Route handler → Account forms: renders account pages (evidence: `public/index.php`)
- Route handler → Reset form: renders reset page (evidence: `public/index.php`)
- Route handler → Campus mail: queues reset link (evidence: `README.md`)
