# himajachaluvadi/lostnfound architecture

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

- Interactive diagram: https://gitdiagram.com/himajachaluvadi/lostnfound
- Repository: https://github.com/himajachaluvadi/lostnfound

## Overview

##### Project type and purpose
- LostNFound is a monolithic, full-stack web application built on the LAMP stack (Linux/Apache/MySQL/PHP).
- Purpose: allow campus users to report, search, and retrieve lost and found items via a simple web interface.

##### File structure
- Top-level directory “minipro” contains all PHP endpoints (login.php, register.php, post_lost_item.php, etc.), CSS, an uploads folder, and DB scripts.
- Key folders/files:
- css/styles.css – static styling
- uploads/ – file storage for item images
- config.php & db.php – database connection and configuration
- create_tables.php – schema initialization
- about.php, dashboard.php, history.php – core UI pages
- send_chat.php, load_chat.php – real-time messaging endpoints

##### README insights
- Confirms technology stack: HTML/CSS/JS frontend, PHP backend, MySQL database.
- Describes features: user authentication, item reporting, search/filter, chat, history.

a. Main components
- Web Client (Browser)
- Web Server (Apache + PHP)
- Database Server (MySQL)
- File Storage (uploads folder)
- (Optional) External Email/SMS service for notifications (if implemented later)
b. Relationships and interactions
1. User sends HTTP(S) requests from browser (login, post item, search).
2. Apache routes to PHP scripts (index.php, register.php, post_found_item.php, etc.).
3. PHP scripts read/write to MySQL via db.php/config.php.
4. For image uploads, PHP moves files into the uploads directory and stores file paths in the database.
5. Chat endpoints poll or push messages between users using load_chat.php and send_chat.php.
6. PHP returns rendered HTML/JSON back to the browser.
c. Architectural patterns
- Monolithic MVC-style:
- Views: .php files output HTML/CSS/JS
- Controllers: core PHP scripts handling form submissions, queries, session management
- Models: SQL queries encapsulated in db.php
- Stateless HTTP requests; session management via PHP sessions.
d. Key technologies
- Frontend: HTML, CSS, vanilla JS
- Backend: PHP 7+
- Database: MySQL
- File System: local disk for uploads

##### Detail
- Sub-components if necessary (Session Manager, Chat module).
- Authentication flow separately (login → session cookie → authorize dashboard).
- Scan/filter/search logic as part of the PHP layer.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interface Layer
    Browser["Browser (UI)"]:::frontend
    staticAssets["styles.css"]:::frontend

    %% Application Server Layer
    subgraph "Web Server"
        direction TB
        Apache["Apache + PHP"]:::backend
        Controllers["Controllers"]:::backend
        subgraph "Models & Config"
            direction TB
            config["config.php"]:::datastore
            db["db.php"]:::datastore
        end
        createTables["create_tables.php"]:::datastore
    end

    %% Data Stores
    dbServer["MySQL Database"]:::datastore
    fileStorage["File Storage\n(minipro/uploads/)"]:::datastore

    %% Controller Endpoints
    register["register.php"]:::backend
    login["login.php"]:::backend
    logout["logout.php"]:::backend
    changePwd["change_password.php"]:::backend
    updateProfile["update_profile.php"]:::backend
    index["index.php"]:::backend
    about["about.php"]:::backend
    dashboard["dashboard.php"]:::backend
    history["history.php"]:::backend
    postLost["post_lost_item.php"]:::backend
    postFound["post_found_item.php"]:::backend
    deleteItem["delete_item.php"]:::backend
    updateStatus["update_status.php"]:::backend
    itemStatus["item_status.php"]:::backend
    searchItems["search_items.php"]:::backend
    loadChat["load_chat.php"]:::backend
    sendChat["send_chat.php"]:::backend
    sendMsg["send_message.php"]:::backend

    %% Connections
    Browser -->|"HTTP GET/POST"| Apache
    Apache -->|"routes to"| Controllers
    Controllers --> register
    Controllers --> login
    Controllers --> logout
    Controllers --> changePwd
    Controllers --> updateProfile
    Controllers --> index
    Controllers --> about
    Controllers --> dashboard
    Controllers --> history
    Controllers --> postLost
    Controllers --> postFound
    Controllers --> deleteItem
    Controllers --> updateStatus
    Controllers --> itemStatus
    Controllers --> searchItems
    Controllers --> loadChat
    Controllers --> sendChat
    Controllers --> sendMsg

    Controllers --> config
    Controllers --> db
    Controllers --> fileStorage
    config --> dbServer
    db --> dbServer
    createTables --> dbServer

    Browser -->|"GET /css/styles.css"| staticAssets
    staticAssets -->|"CSS"| Browser
    Apache -->|"HTTP RESP"| Browser

    %% Click Events
    click staticAssets "https://github.com/himajachaluvadi/lostnfound/blob/main/minipro/css/styles.css"
    click fileStorage "https://github.com/himajachaluvadi/lostnfound/tree/main/minipro/uploads/"
    click config "https://github.com/himajachaluvadi/lostnfound/blob/main/minipro/config.php"
    click db "https://github.com/himajachaluvadi/lostnfound/blob/main/minipro/db.php"
    click createTables "https://github.com/himajachaluvadi/lostnfound/blob/main/minipro/create_tables.php"
    click register "https://github.com/himajachaluvadi/lostnfound/blob/main/minipro/register.php"
    click login "https://github.com/himajachaluvadi/lostnfound/blob/main/minipro/login.php"
    click logout "https://github.com/himajachaluvadi/lostnfound/blob/main/minipro/logout.php"
    click changePwd "https://github.com/himajachaluvadi/lostnfound/blob/main/minipro/change_password.php"
    click updateProfile "https://github.com/himajachaluvadi/lostnfound/blob/main/minipro/update_profile.php"
    click index "https://github.com/himajachaluvadi/lostnfound/blob/main/minipro/index.php"
    click about "https://github.com/himajachaluvadi/lostnfound/blob/main/minipro/about.php"
    click dashboard "https://github.com/himajachaluvadi/lostnfound/blob/main/minipro/dashboard.php"
    click history "https://github.com/himajachaluvadi/lostnfound/blob/main/minipro/history.php"
    click postLost "https://github.com/himajachaluvadi/lostnfound/blob/main/minipro/post_lost_item.php"
    click postFound "https://github.com/himajachaluvadi/lostnfound/blob/main/minipro/post_found_item.php"
    click deleteItem "https://github.com/himajachaluvadi/lostnfound/blob/main/minipro/delete_item.php"
    click updateStatus "https://github.com/himajachaluvadi/lostnfound/blob/main/minipro/update_status.php"
    click itemStatus "https://github.com/himajachaluvadi/lostnfound/blob/main/minipro/item_status.php"
    click searchItems "https://github.com/himajachaluvadi/lostnfound/blob/main/minipro/search_items.php"
    click loadChat "https://github.com/himajachaluvadi/lostnfound/blob/main/minipro/load_chat.php"
    click sendChat "https://github.com/himajachaluvadi/lostnfound/blob/main/minipro/send_chat.php"
    click sendMsg "https://github.com/himajachaluvadi/lostnfound/blob/main/minipro/send_message.php"

    %% Styles
    classDef frontend fill:#B3DFFD,stroke:#333,stroke-width:1px
    classDef backend fill:#BEE7AA,stroke:#333,stroke-width:1px
    classDef datastore fill:#FFD59E,stroke:#333,stroke-width:1px
    class Controllers,Apache,register,login,logout,changePwd,updateProfile,index,about,dashboard,history,postLost,postFound,deleteItem,updateStatus,itemStatus,searchItems,loadChat,sendChat,sendMsg backend
    class config,db,createTables,dbServer,fileStorage datastore
    class Browser,staticAssets frontend
```
