# avinashanand02/lost-and-found architecture

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

- Interactive diagram: https://gitdiagram.com/avinashanand02/lost-and-found
- Repository: https://github.com/avinashanand02/lost-and-found

## Overview

1. **Overall shape**
   - This is a server-rendered PHP application for a Lost and Found Information System.
   - It is split into two major user-facing boundaries: a **public site** for visitors and a **management/admin site** for authenticated staff and administrators.
   - Persistence is handled by **MySQL** via the SQL schema in `database/lfis_db.sql`, with PHP classes in `classes/` handling DB access and business logic.

2. **Public site boundary**
   - Public entry points live at the repository root: `index.php`, `home.php`, `about.php`, `contact.php`, `found.php`, plus `items/` and `pages/`.
   - The public site lets visitors browse published items, filter by category, view static/dynamic content pages, and submit inquiries.
   - Public pages are assembled from shared layout fragments in `inc/` such as `header.php`, `navigation.php`, `topBarNav.php`, and `footer.php`.

3. **Admin/management boundary**
   - The management UI is isolated under `admin/`.
   - It includes dedicated modules for `categories`, `items`, `user`, `inquiries`, `pages`, and `system_info`, plus a dashboard/home area.
   - Admin pages use their own shared layout components in `admin/inc/`, which mirrors the public site structure but is scoped to authenticated staff workflows.

4. **Authentication and access control**
   - Login/logout for the admin side is handled by `admin/login.php` and supporting logic in `classes/Login.php`.
   - Session gating appears to be centralized in `inc/sess_auth.php` and `admin/inc/sess_auth.php`, which likely protect routes from unauthenticated access.
   - This creates a clear boundary: unauthenticated users stay on public pages; authenticated staff can reach management functions.

5. **Core data/domain model**
   - The main domain objects are:
     - **Users**: admin/staff accounts
     - **Categories**: item classification
     - **Items**: lost/found item records
     - **Inquiries/Messages**: public contact submissions
     - **System/page content**: home/about/contact and other editable text/content blocks
   - These are represented in the `classes/` layer by `Users.php`, `Master.php`, and `SystemSettings.php`, which likely encapsulate CRUD and content retrieval.

6. **Data access and persistence**
   - `classes/DBConnection.php` is the DB access foundation.
   - `config.php` and `initialize.php` likely establish application constants, bootstrap the DB connection, and load required classes/helpers.
   - The SQL file `database/lfis_db.sql` is the authoritative schema/data seed used during setup.

7. **Content management flow**
   - Several public pages are not hard-coded; they are editable through the admin site.
   - The management site updates “Home Page Content,” “About Us,” “Contact Information,” and system details, which are then rendered on the public site.
   - This means the public site is partially CMS-like, with admin editing feeding directly into frontend page rendering.

8. **Item lifecycle flow**
   - Item records are created and maintained in the admin area under `admin/items/`.
   - The public site consumes these records to display published items, including a category-filtered listing and individual item views.
   - Uploaded item images are stored in `uploads/items/`, making media storage separate from code and database records.

9. **Inquiry/message flow**
   - Public visitors can submit inquiries or concerns from the contact interface.
   - Those submissions are stored and reviewed in the admin site under `admin/inquiries/`.
   - This creates a one-way public-to-admin workflow: public input becomes a managed backlog for staff.

10. **Asset and presentation layer**
   - Frontend styling and interactivity live in `assets/`, including CSS, JavaScript, images, and vendor assets.
   - `assets/css/style.css`, `assets/css/custom.css`, and `assets/js/main.js` / `script.js` are the main application-level presentation scripts.
   - Shared page fragments in `inc/` and `admin/inc/` control the page shell, navigation, and footer across both site areas.

11. **File storage boundary**
   - Media uploads are stored under `uploads/`, with subfolders for `avatars`, `banner`, `defaults`, and `items`.
   - This indicates the app separates binary assets from database records and code, with the DB likely storing references/paths.
   - `uploads/avatars` suggests user profile images, while `uploads/banner` and `uploads/defaults` support site-wide branding or fallback content.

12. **Routing and page organization**
   - The app uses a mostly file-based PHP routing model rather than a framework router.
   - Top-level folders such as `items/` and `pages/` provide public views, while admin modules are grouped by function under `admin/`.
   - `.htaccess` files at the root and under `admin/` likely support clean URLs and/or access restrictions.

13. **Infrastructure assumptions**
   - The README indicates a classic LAMP/XAMPP deployment: Apache + PHP + MySQL.
   - There is no indication of external APIs or background workers; the system appears to be synchronous request/response CRUD web application.
   - Architecture therefore centers on server-rendered PHP pages, shared includes, MySQL persistence, and file-based asset storage.

14. **What to show in an architecture diagram**
   - Draw two frontends: **Public Site** and **Admin Site**.
   - Connect both to the **shared PHP application layer** (`classes/`, `config.php`, `initialize.php`), then to **MySQL database** and **uploads filesystem**.
   - Show the admin site as an authenticated path feeding management data back into public content and item listings.
   - Show inquiries flowing from public contact forms into admin review screens.

Main entry points: [`classes/Master.php`](https://github.com/avinashanand02/lost-and-found/blob/main/classes/Master.php) (Domain Models), [`inc/header.php`](https://github.com/avinashanand02/lost-and-found/blob/main/inc/header.php) (Public Layout), [`admin/inc/header.php`](https://github.com/avinashanand02/lost-and-found/blob/main/admin/inc/header.php) (Admin Layout), [`admin/items/index.php`](https://github.com/avinashanand02/lost-and-found/blob/main/admin/items/index.php) (Items)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public_site["Public Site"]
  node_index_php["Landing<br/>public entry<br/>[index.php]"]
  node_home_php["Home<br/>public page<br/>[home.php]"]
  node_about_php["About<br/>public page<br/>[about.php]"]
  node_contact_php["Contact<br/>public page<br/>[contact.php]"]
  node_found_php["Found Items<br/>public listing<br/>[found.php]"]
  node_items_public["Item Views<br/>public module<br/>[index.php]"]
  node_pages_public["Content Pages<br/>public module<br/>[about.html]"]
  node_public_layout["Public Layout<br/>shared UI<br/>[header.php]"]
end

subgraph group_admin_site["Admin Site"]
  node_admin_login["Admin Login<br/>auth entry<br/>[login.php]"]
  node_admin_dashboard["Dashboard<br/>admin home<br/>[home.php]"]
  node_admin_categories["Categories<br/>admin module<br/>[index.php]"]
  node_admin_items["Items<br/>admin module<br/>[index.php]"]
  node_admin_inquiries["Inquiries<br/>admin module<br/>[index.php]"]
  node_admin_pages["Pages<br/>admin module<br/>[about_page.php]"]
  node_admin_system["System Info<br/>admin module<br/>[index.php]"]
  node_admin_users["Users<br/>admin module<br/>[index.php]"]
  node_admin_layout["Admin Layout<br/>shared UI<br/>[header.php]"]
end

subgraph group_shared_app["Shared App Layer"]
  node_bootstrap["Bootstrap<br/>[initialize.php]"]
  node_db_conn["DB Connection<br/>data access<br/>[DBConnection.php]"]
  node_auth_logic["Login Logic<br/>auth service<br/>[Login.php]"]
  node_domain_models["Domain Models<br/>business logic<br/>[Master.php]"]
end

subgraph group_data_storage["Data & Storage"]
  node_schema[("MySQL Schema<br/>database<br/>[lfis_db.sql]")]
  node_uploads["Uploads<br/>file storage"]
end

subgraph group_assets["Frontend Assets"]
  node_styles["Styles<br/>presentation<br/>[style.css]"]
  node_scripts["Scripts<br/>presentation<br/>[main.js]"]
end

node_index_php -->|"renders with"| node_public_layout
node_home_php -->|"renders with"| node_public_layout
node_about_php -->|"renders with"| node_public_layout
node_contact_php -->|"renders with"| node_public_layout
node_found_php -->|"renders with"| node_public_layout
node_items_public -->|"renders with"| node_public_layout
node_pages_public -->|"renders with"| node_public_layout
node_admin_dashboard -->|"renders with"| node_admin_layout
node_admin_categories -->|"renders with"| node_admin_layout
node_admin_items -->|"renders with"| node_admin_layout
node_admin_inquiries -->|"renders with"| node_admin_layout
node_admin_pages -->|"renders with"| node_admin_layout
node_admin_system -->|"renders with"| node_admin_layout
node_admin_users -->|"renders with"| node_admin_layout
node_index_php -->|"boots"| node_bootstrap
node_admin_login -->|"boots"| node_bootstrap
node_admin_dashboard -->|"boots"| node_bootstrap
node_bootstrap -->|"creates"| node_db_conn
node_bootstrap -->|"loads"| node_auth_logic
node_auth_logic -->|"reads users"| node_schema
node_domain_models -->|"reads/writes"| node_schema
node_db_conn -->|"connects to"| node_schema
node_public_layout -->|"uses"| node_styles
node_public_layout -->|"uses"| node_scripts
node_admin_layout -->|"uses"| node_styles
node_admin_layout -->|"uses"| node_scripts
node_admin_login -->|"authenticates via"| node_auth_logic
node_admin_categories -->|"manages"| node_domain_models
node_admin_items -->|"manages"| node_domain_models
node_admin_inquiries -->|"reviews"| node_domain_models
node_admin_pages -->|"edits"| node_domain_models
node_admin_system -->|"updates"| node_domain_models
node_admin_users -->|"manages"| node_domain_models
node_found_php -->|"lists items"| node_domain_models
node_items_public -->|"shows items"| node_domain_models
node_contact_php -->|"submits inquiry"| node_domain_models
node_admin_pages -->|"updates content"| node_schema
node_admin_items -->|"stores images"| node_uploads
node_admin_users -->|"stores avatars"| node_uploads
node_items_public -->|"shows media"| node_uploads
node_index_php -.->|"links to admin path"| node_admin_dashboard
node_contact_php -.->|"feeds"| node_admin_inquiries
node_admin_pages -.->|"publishes content"| node_home_php
node_admin_pages -.->|"publishes content"| node_about_php
node_admin_system -.->|"publishes info"| node_contact_php
node_admin_items -.->|"publishes items"| node_found_php
node_admin_items -.->|"publishes items"| node_items_public

click node_index_php "https://github.com/avinashanand02/lost-and-found/blob/main/index.php"
click node_home_php "https://github.com/avinashanand02/lost-and-found/blob/main/home.php"
click node_about_php "https://github.com/avinashanand02/lost-and-found/blob/main/about.php"
click node_contact_php "https://github.com/avinashanand02/lost-and-found/blob/main/contact.php"
click node_found_php "https://github.com/avinashanand02/lost-and-found/blob/main/found.php"
click node_items_public "https://github.com/avinashanand02/lost-and-found/blob/main/items/index.php"
click node_pages_public "https://github.com/avinashanand02/lost-and-found/blob/main/pages/about.html"
click node_public_layout "https://github.com/avinashanand02/lost-and-found/blob/main/inc/header.php"
click node_admin_login "https://github.com/avinashanand02/lost-and-found/blob/main/admin/login.php"
click node_admin_dashboard "https://github.com/avinashanand02/lost-and-found/blob/main/admin/home.php"
click node_admin_categories "https://github.com/avinashanand02/lost-and-found/blob/main/admin/categories/index.php"
click node_admin_items "https://github.com/avinashanand02/lost-and-found/blob/main/admin/items/index.php"
click node_admin_inquiries "https://github.com/avinashanand02/lost-and-found/blob/main/admin/inquiries/index.php"
click node_admin_pages "https://github.com/avinashanand02/lost-and-found/blob/main/admin/pages/about_page.php"
click node_admin_system "https://github.com/avinashanand02/lost-and-found/blob/main/admin/system_info/index.php"
click node_admin_users "https://github.com/avinashanand02/lost-and-found/blob/main/admin/user/index.php"
click node_admin_layout "https://github.com/avinashanand02/lost-and-found/blob/main/admin/inc/header.php"
click node_bootstrap "https://github.com/avinashanand02/lost-and-found/blob/main/initialize.php"
click node_db_conn "https://github.com/avinashanand02/lost-and-found/blob/main/classes/DBConnection.php"
click node_auth_logic "https://github.com/avinashanand02/lost-and-found/blob/main/classes/Login.php"
click node_domain_models "https://github.com/avinashanand02/lost-and-found/blob/main/classes/Master.php"
click node_schema "https://github.com/avinashanand02/lost-and-found/blob/main/database/lfis_db.sql"
click node_uploads "https://github.com/avinashanand02/lost-and-found/tree/main/uploads/items"
click node_styles "https://github.com/avinashanand02/lost-and-found/blob/main/assets/css/style.css"
click node_scripts "https://github.com/avinashanand02/lost-and-found/blob/main/assets/js/main.js"

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_index_php,node_home_php,node_about_php,node_contact_php,node_found_php,node_items_public,node_pages_public,node_public_layout toneBlue
class node_admin_login,node_admin_dashboard,node_admin_categories,node_admin_items,node_admin_inquiries,node_admin_pages,node_admin_system,node_admin_users,node_admin_layout toneAmber
class node_bootstrap,node_db_conn,node_auth_logic,node_domain_models toneMint
class node_schema,node_uploads toneRose
class node_styles,node_scripts toneIndigo
```

## Components

### Public Site

Visitor-facing pages and shared public layout

- [Landing](https://github.com/avinashanand02/lost-and-found/blob/main/index.php): public entry · Main public entry point · `index.php`
- [Home](https://github.com/avinashanand02/lost-and-found/blob/main/home.php): public page · Public home page · `home.php`
- [About](https://github.com/avinashanand02/lost-and-found/blob/main/about.php): public page · Public about page · `about.php`
- [Contact](https://github.com/avinashanand02/lost-and-found/blob/main/contact.php): public page · Public contact/inquiry page · `contact.php`
- [Found Items](https://github.com/avinashanand02/lost-and-found/blob/main/found.php): public listing · Public found-item browsing page · `found.php`
- [Item Views](https://github.com/avinashanand02/lost-and-found/blob/main/items/index.php): public module · Public item listing and detail views · `items/index.php`
- [Content Pages](https://github.com/avinashanand02/lost-and-found/blob/main/pages/about.html): public module · Public static/content pages · `pages/about.html`
- [Public Layout](https://github.com/avinashanand02/lost-and-found/blob/main/inc/header.php): shared UI · Header, navigation, top bar, footer for public pages · `inc/header.php`

### Admin Site

Authenticated staff and management modules

- [Admin Login](https://github.com/avinashanand02/lost-and-found/blob/main/admin/login.php): auth entry · Staff authentication entry point · `admin/login.php`
- [Dashboard](https://github.com/avinashanand02/lost-and-found/blob/main/admin/home.php): admin home · Authenticated admin landing page · `admin/home.php`
- [Categories](https://github.com/avinashanand02/lost-and-found/blob/main/admin/categories/index.php): admin module · Category management screens · `admin/categories/index.php`
- [Items](https://github.com/avinashanand02/lost-and-found/blob/main/admin/items/index.php): admin module · Item management screens · `admin/items/index.php`
- [Inquiries](https://github.com/avinashanand02/lost-and-found/blob/main/admin/inquiries/index.php): admin module · Inquiry review screens · `admin/inquiries/index.php`
- [Pages](https://github.com/avinashanand02/lost-and-found/blob/main/admin/pages/about_page.php): admin module · Editable content pages · `admin/pages/about_page.php`
- [System Info](https://github.com/avinashanand02/lost-and-found/blob/main/admin/system_info/index.php): admin module · Site contact and system settings · `admin/system_info/index.php`
- [Users](https://github.com/avinashanand02/lost-and-found/blob/main/admin/user/index.php): admin module · Staff account management · `admin/user/index.php`
- [Admin Layout](https://github.com/avinashanand02/lost-and-found/blob/main/admin/inc/header.php): shared UI · Admin header, navigation, top bar, footer · `admin/inc/header.php`

### Shared App Layer

Common PHP bootstrap, auth, and domain classes

- [Bootstrap](https://github.com/avinashanand02/lost-and-found/blob/main/initialize.php): app bootstrap · Configuration and initialization · `initialize.php`
- [DB Connection](https://github.com/avinashanand02/lost-and-found/blob/main/classes/DBConnection.php): data access · Database connection foundation · `classes/DBConnection.php`
- [Login Logic](https://github.com/avinashanand02/lost-and-found/blob/main/classes/Login.php): auth service · Admin login and session handling · `classes/Login.php`
- [Domain Models](https://github.com/avinashanand02/lost-and-found/blob/main/classes/Master.php): business logic · Users, master data, and system settings logic · `classes/Master.php`

### Data & Storage

Database schema and uploaded media files

- [MySQL Schema](https://github.com/avinashanand02/lost-and-found/blob/main/database/lfis_db.sql): database · Application schema and seed data · `database/lfis_db.sql`
- [Uploads](https://github.com/avinashanand02/lost-and-found/tree/main/uploads/items): file storage · Stored avatars, banners, defaults, and item images · `uploads/items`

### Frontend Assets

Styles, scripts, and static presentation resources

- [Styles](https://github.com/avinashanand02/lost-and-found/blob/main/assets/css/style.css): presentation · Application CSS assets · `assets/css/style.css`
- [Scripts](https://github.com/avinashanand02/lost-and-found/blob/main/assets/js/main.js): presentation · Application JavaScript assets · `assets/js/main.js`

## Connections

- Landing → Public Layout: renders with · Public landing pages use shared layout
- Home → Public Layout: renders with · Public pages share the common shell
- About → Public Layout: renders with · Public pages share the common shell
- Contact → Public Layout: renders with · Public pages share the common shell
- Found Items → Public Layout: renders with · Public pages share the common shell
- Item Views → Public Layout: renders with · Public item views use shared layout
- Content Pages → Public Layout: renders with · Content pages use shared layout fragments
- Dashboard → Admin Layout: renders with · Admin pages use the authenticated shell
- Categories → Admin Layout: renders with · Admin modules use shared admin layout
- Items → Admin Layout: renders with · Admin modules use shared admin layout
- Inquiries → Admin Layout: renders with · Admin modules use shared admin layout
- Pages → Admin Layout: renders with · Admin modules use shared admin layout
- System Info → Admin Layout: renders with · Admin modules use shared admin layout
- Users → Admin Layout: renders with · Admin modules use shared admin layout
- Landing → Bootstrap: boots · Public entry loads shared initialization
- Admin Login → Bootstrap: boots · Admin login loads shared initialization
- Dashboard → Bootstrap: boots · Authenticated admin pages load shared initialization
- Bootstrap → DB Connection: creates · Initialization sets up database access
- Bootstrap → Login Logic: loads · Initialization loads authentication support
- Login Logic → MySQL Schema: reads users · Authentication validates staff accounts in the database
- Domain Models → MySQL Schema: reads/writes · Business logic persists domain records
- DB Connection → MySQL Schema: connects to · Database access layer talks to MySQL
- Public Layout → Styles: uses · Public shell pulls application styles
- Public Layout → Scripts: uses · Public shell pulls application scripts
- Admin Layout → Styles: uses · Admin shell pulls application styles
- Admin Layout → Scripts: uses · Admin shell pulls application scripts
- Admin Login → Login Logic: authenticates via · Login form uses shared login logic
- Categories → Domain Models: manages · Category CRUD is driven by shared models
- Items → Domain Models: manages · Item CRUD is driven by shared models
- Inquiries → Domain Models: reviews · Inquiry review uses shared data logic
- Pages → Domain Models: edits · Editable content is stored through shared models
- System Info → Domain Models: updates · System/contact information is managed through shared models
- Users → Domain Models: manages · Staff user records are maintained through shared models
- Found Items → Domain Models: lists items · Public found-item browsing consumes item data
- Item Views → Domain Models: shows items · Public item listing/detail pages consume item data
- Contact → Domain Models: submits inquiry · Public contact submissions are stored as inquiries
- Pages → MySQL Schema: updates content · Editable pages persist to the database
- Items → Uploads: stores images · Item management uses uploaded media files
- Users → Uploads: stores avatars · User profiles may reference uploaded avatars
- Item Views → Uploads: shows media · Public item views render item images
- Landing → Dashboard: links to admin path · Administrative workflow is separate from public access
- Contact → Inquiries: feeds · Public inquiries become admin review items
- Pages → Home: publishes content · Admin-edited content feeds public pages
- Pages → About: publishes content · Admin-edited content feeds public pages
- System Info → Contact: publishes info · Admin-updated contact details feed public contact page
- Items → Found Items: publishes items · Admin-managed items appear on public listings
- Items → Item Views: publishes items · Admin-managed items appear on public views
