# africandillinger/contact-manager architecture

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

- Interactive diagram: https://gitdiagram.com/africandillinger/contact-manager
- Repository: https://github.com/africandillinger/contact-manager

## Overview

Contact Manager is a small PHP web app for registering and logging in, then listing, searching, adding, editing, and deleting contacts. The browser initiates page requests; authenticated contact pages use the shared database connection, while registration and login access user records. The sampled source shows these actions directly in the page scripts rather than in a separate service layer. The delete endpoint does not include the authentication guard used by the other contact pages.

Main entry points: [`db.php`](https://github.com/africandillinger/contact-manager/blob/main/db.php) (DB connection), [`index.php`](https://github.com/africandillinger/contact-manager/blob/main/index.php) (Contact list), [`login.php`](https://github.com/africandillinger/contact-manager/blob/main/login.php) (Login), [`add.php`](https://github.com/africandillinger/contact-manager/blob/main/add.php) (Add contact)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Account access"]
  node_register["Register<br/>[register.php]"]
  node_login["Login<br/>[login.php]"]
  node_auth["Session guard<br/>[auth.php]"]
  node_logout["Logout<br/>[logout.php]"]
end

subgraph group_contacts["Contact management"]
  node_listing["Contact list<br/>[index.php]"]
  node_add["Add contact<br/>[add.php]"]
  node_edit["Edit contact<br/>[edit.php]"]
  node_delete["Delete contact<br/>[delete.php]"]
end

subgraph group_shared["Shared infrastructure"]
  node_navbar["Navigation<br/>[navbar.php]"]
  node_connection["DB connection<br/>[db.php]"]
end

node_visitor(("Browser user"))
node_contacts_db[("Contacts table")]
node_users_db[("Users table")]

node_visitor -->|"submits"| node_register
node_visitor -->|"submits"| node_login
node_visitor -->|"requests"| node_listing
node_visitor -->|"submits"| node_add
node_visitor -->|"submits"| node_edit
node_visitor -->|"requests"| node_delete
node_visitor -->|"requests"| node_logout
node_register -->|"includes"| node_connection
node_login -->|"includes"| node_connection
node_listing -->|"includes"| node_connection
node_add -->|"includes"| node_connection
node_edit -->|"includes"| node_connection
node_delete -->|"includes"| node_connection
node_connection -->|"connects"| node_contacts_db
node_connection -->|"connects"| node_users_db
node_register -->|"inserts account"| node_users_db
node_login -->|"checks account"| node_users_db
node_login -->|"redirects on success"| node_listing
node_listing -->|"includes guard"| node_auth
node_add -->|"includes guard"| node_auth
node_edit -->|"includes guard"| node_auth
node_auth -->|"redirects if unauthenticated"| node_login
node_listing -->|"searches and reads"| node_contacts_db
node_add -->|"inserts contact"| node_contacts_db
node_edit -->|"reads and updates"| node_contacts_db
node_delete -->|"deletes contact"| node_contacts_db
node_listing -->|"includes navigation"| node_navbar
node_add -->|"includes navigation"| node_navbar
node_edit -->|"includes navigation"| node_navbar
node_navbar -->|"links to"| node_logout
node_logout -->|"redirects to"| node_login

click node_register "https://github.com/africandillinger/contact-manager/blob/main/register.php"
click node_login "https://github.com/africandillinger/contact-manager/blob/main/login.php"
click node_auth "https://github.com/africandillinger/contact-manager/blob/main/includes/auth.php"
click node_logout "https://github.com/africandillinger/contact-manager/blob/main/logout.php"
click node_listing "https://github.com/africandillinger/contact-manager/blob/main/index.php"
click node_add "https://github.com/africandillinger/contact-manager/blob/main/add.php"
click node_edit "https://github.com/africandillinger/contact-manager/blob/main/edit.php"
click node_delete "https://github.com/africandillinger/contact-manager/blob/main/delete.php"
click node_navbar "https://github.com/africandillinger/contact-manager/blob/main/includes/navbar.php"
click node_connection "https://github.com/africandillinger/contact-manager/blob/main/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_register,node_login,node_auth,node_logout,node_visitor toneBlue
class node_listing,node_add,node_edit,node_delete,node_contacts_db,node_users_db toneAmber
class node_navbar,node_connection toneMint
```

## Components

### Account access

- [Register](https://github.com/africandillinger/contact-manager/blob/main/register.php): `register.php`
- [Login](https://github.com/africandillinger/contact-manager/blob/main/login.php): `login.php`
- [Session guard](https://github.com/africandillinger/contact-manager/blob/main/includes/auth.php): `includes/auth.php`
- [Logout](https://github.com/africandillinger/contact-manager/blob/main/logout.php): `logout.php`

### Contact management

- [Contact list](https://github.com/africandillinger/contact-manager/blob/main/index.php): `index.php`
- [Add contact](https://github.com/africandillinger/contact-manager/blob/main/add.php): `add.php`
- [Edit contact](https://github.com/africandillinger/contact-manager/blob/main/edit.php): `edit.php`
- [Delete contact](https://github.com/africandillinger/contact-manager/blob/main/delete.php): `delete.php`

### Shared infrastructure

- [Navigation](https://github.com/africandillinger/contact-manager/blob/main/includes/navbar.php): `includes/navbar.php`
- [DB connection](https://github.com/africandillinger/contact-manager/blob/main/db.php): `db.php`

### Other components

- **Browser user**
- **Contacts table**
- **Users table**

## Connections

- Browser user → Register: submits
- Browser user → Login: submits
- Browser user → Contact list: requests
- Browser user → Add contact: submits
- Browser user → Edit contact: submits
- Browser user → Delete contact: requests
- Browser user → Logout: requests
- Register → DB connection: includes
- Login → DB connection: includes
- Contact list → DB connection: includes
- Add contact → DB connection: includes
- Edit contact → DB connection: includes
- Delete contact → DB connection: includes
- DB connection → Contacts table: connects
- DB connection → Users table: connects
- Register → Users table: inserts account
- Login → Users table: checks account
- Login → Contact list: redirects on success
- Contact list → Session guard: includes guard
- Add contact → Session guard: includes guard
- Edit contact → Session guard: includes guard
- Session guard → Login: redirects if unauthenticated
- Contact list → Contacts table: searches and reads
- Add contact → Contacts table: inserts contact
- Edit contact → Contacts table: reads and updates
- Delete contact → Contacts table: deletes contact
- Contact list → Navigation: includes navigation
- Add contact → Navigation: includes navigation
- Edit contact → Navigation: includes navigation
- Navigation → Logout: links to
- Logout → Login: redirects to
