# lorenx-jboy/jennylyn_coffeejen architecture

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

- Interactive diagram: https://gitdiagram.com/lorenx-jboy/jennylyn_coffeejen
- Repository: https://github.com/lorenx-jboy/jennylyn_coffeejen

## Overview

Brewstack is a PHP/MySQL account portal. Its central workflow collects registration details, validates them in the browser, submits them for account creation, and then supports login, dashboard access, logout, and credential recovery. The graph preserves the distinct registration, authentication, and recovery stages plus shared database access. Source excerpts establish only some connections; unsampled page behavior and several endpoints are therefore not linked unless the SOURCE INDEX or excerpts support them.

Main entry points: [`config/db.php`](https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/config/db.php) (Database connection), [`php/register.php`](https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/php/register.php) (Registration form), [`js/register/register.js`](https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/js/register/register.js) (Form controller), [`js/register/events.js`](https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/js/register/events.js) (Validation events)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_registration["Registration"]
  node_registration_form["Registration form<br/>[register.php]"]
  node_registration_controller["Form controller<br/>[register.js]"]
  node_registration_events["Validation events<br/>[events.js]"]
  node_validation_rules["Field validators<br/>[validators.js]"]
  node_field_validation["Field rules"]
  node_form_state["Form state<br/>[localStorage.js]"]
  node_email_check["Email check<br/>[check_email.php]"]
  node_username_check["Username check<br/>[check_username.php]"]
  node_registration_submit["Create account"]
end

subgraph group_accounts["Account access"]
  node_login_page["Login page<br/>[login.php]"]
  node_login_handler["Login handler<br/>[login_submit.php]"]
  node_dashboard["Dashboard<br/>[dashboard.php]"]
  node_logout["Logout<br/>[logout.php]"]
end

subgraph group_recovery["Credential recovery"]
  node_forgot_password["Forgot password<br/>[forgot_password.js]"]
  node_reset_page["Reset password<br/>[reset_password.php]"]
  node_reset_api["Reset endpoint<br/>[reset_password.php]"]
  node_question_auth["Security questions"]
end

subgraph group_shared["Shared services"]
  node_database_config["Database connection<br/>[db.php]"]
  node_account_store[("Account database<br/>[brewstack_db.sql]")]
  node_header["Navigation header<br/>[header.php]"]
  node_id_generator["ID generation<br/>[get_next_id.php]"]
end

node_visitor(("Visitor"))

node_visitor -->|"fills"| node_registration_form
node_registration_form -->|"loads"| node_registration_controller
node_registration_controller -->|"binds"| node_registration_events
node_registration_events -->|"applies"| node_validation_rules
node_validation_rules -->|"imports"| node_field_validation
node_registration_controller -->|"saves and restores"| node_form_state
node_registration_events -.->|"checks remotely"| node_email_check
node_registration_events -.->|"checks remotely"| node_username_check
node_registration_controller -->|"submits"| node_registration_submit
node_registration_submit -->|"uses"| node_database_config
node_email_check -->|"uses"| node_database_config
node_username_check -->|"uses"| node_database_config
node_question_auth -->|"uses"| node_database_config
node_visitor -.->|"opens"| node_login_page
node_login_page -.->|"submits credentials"| node_login_handler
node_login_handler -->|"uses"| node_database_config
node_login_handler -.->|"authenticates to"| node_dashboard
node_dashboard -->|"renders"| node_header
node_login_page -->|"renders"| node_header
node_visitor -.->|"starts recovery"| node_forgot_password
node_forgot_password -.->|"authenticates answers"| node_question_auth
node_reset_page -.->|"submits reset"| node_reset_api
node_reset_api -.->|"uses"| node_database_config
node_dashboard -->|"requests logout"| node_logout
node_registration_form -->|"uses"| node_database_config
node_registration_form -.->|"generates ID"| node_id_generator

click node_registration_form "https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/php/register.php"
click node_registration_controller "https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/js/register/register.js"
click node_registration_events "https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/js/register/events.js"
click node_validation_rules "https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/js/register/validation/validators.js"
click node_field_validation "https://github.com/lorenx-jboy/jennylyn_coffeejen/tree/main/js/register/validation"
click node_form_state "https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/js/register/localStorage.js"
click node_email_check "https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/api/check_email.php"
click node_username_check "https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/api/check_username.php"
click node_registration_submit "https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/php/register_submit.php"
click node_login_page "https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/php/login.php"
click node_login_handler "https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/php/login_submit.php"
click node_dashboard "https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/php/dashboard.php"
click node_logout "https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/php/logout.php"
click node_forgot_password "https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/js/forgot_password.js"
click node_reset_page "https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/php/reset_password.php"
click node_reset_api "https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/api/reset_password.php"
click node_question_auth "https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/api/authenticate_questions.php"
click node_database_config "https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/config/db.php"
click node_account_store "https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/brewstack_db.sql"
click node_header "https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/includes/header.php"
click node_id_generator "https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/config/get_next_id.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_registration_form,node_registration_controller,node_registration_events,node_validation_rules,node_field_validation,node_form_state,node_email_check,node_username_check,node_registration_submit toneBlue
class node_login_page,node_login_handler,node_dashboard,node_logout toneAmber
class node_forgot_password,node_reset_page,node_reset_api,node_question_auth toneMint
class node_database_config,node_account_store,node_header,node_id_generator toneRose
class node_visitor toneIndigo
```

## Components

### Registration

- [Registration form](https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/php/register.php): `php/register.php`
- [Form controller](https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/js/register/register.js): `js/register/register.js`
- [Validation events](https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/js/register/events.js): `js/register/events.js`
- [Field validators](https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/js/register/validation/validators.js): `js/register/validation/validators.js`
- [Field rules](https://github.com/lorenx-jboy/jennylyn_coffeejen/tree/main/js/register/validation): `js/register/validation`
- [Form state](https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/js/register/localStorage.js): `js/register/localStorage.js`
- [Email check](https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/api/check_email.php): `api/check_email.php`
- [Username check](https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/api/check_username.php): `api/check_username.php`
- [Create account](https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/php/register_submit.php): `php/register_submit.php`

### Account access

- [Login page](https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/php/login.php): `php/login.php`
- [Login handler](https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/php/login_submit.php): `php/login_submit.php`
- [Dashboard](https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/php/dashboard.php): `php/dashboard.php`
- [Logout](https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/php/logout.php): `php/logout.php`

### Credential recovery

- [Forgot password](https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/js/forgot_password.js): `js/forgot_password.js`
- [Reset password](https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/php/reset_password.php): `php/reset_password.php`
- [Reset endpoint](https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/api/reset_password.php): `api/reset_password.php`
- [Security questions](https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/api/authenticate_questions.php): `api/authenticate_questions.php`

### Shared services

- [Database connection](https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/config/db.php): `config/db.php`
- [Account database](https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/brewstack_db.sql): `brewstack_db.sql`
- [Navigation header](https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/includes/header.php): `includes/header.php`
- [ID generation](https://github.com/lorenx-jboy/jennylyn_coffeejen/blob/main/config/get_next_id.php): `config/get_next_id.php`

### Other components

- **Visitor**

## Connections

- Visitor → Registration form: fills (evidence: `php/register.php`)
- Registration form → Form controller: loads (evidence: `php/register.php`)
- Form controller → Validation events: binds (evidence: `js/register/register.js`)
- Validation events → Field validators: applies (evidence: `js/register/events.js`)
- Field validators → Field rules: imports (evidence: `js/register/validation/validators.js`)
- Form controller → Form state: saves and restores (evidence: `js/register/register.js`)
- Validation events → Email check: checks remotely
- Validation events → Username check: checks remotely
- Form controller → Create account: submits (evidence: `js/register/register.js`)
- Create account → Database connection: uses (evidence: `php/register_submit.php`)
- Email check → Database connection: uses (evidence: `api/check_email.php`)
- Username check → Database connection: uses (evidence: `api/check_username.php`)
- Security questions → Database connection: uses (evidence: `api/authenticate_questions.php`)
- Visitor → Login page: opens
- Login page → Login handler: submits credentials
- Login handler → Database connection: uses (evidence: `php/login_submit.php`)
- Login handler → Dashboard: authenticates to
- Dashboard → Navigation header: renders (evidence: `php/dashboard.php`)
- Login page → Navigation header: renders (evidence: `php/login.php`)
- Visitor → Forgot password: starts recovery
- Forgot password → Security questions: authenticates answers
- Reset password → Reset endpoint: submits reset
- Reset endpoint → Database connection: uses
- Dashboard → Logout: requests logout
- Registration form → Database connection: uses (evidence: `php/register.php`)
- Registration form → ID generation: generates ID
