# 23abhishek2024/23abhishek2024--foundify-lost-found-web-app architecture

> Architecture diagram of the GitHub repository 23abhishek2024/23abhishek2024--foundify-lost-found-web-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/23abhishek2024/23abhishek2024--foundify-lost-found-web-app
- Repository: https://github.com/23abhishek2024/23abhishek2024--foundify-lost-found-web-app

## Overview

##### Project type and purpose
- This is a full-stack Lost & Found web application (“Foundify”) built on Node.js and Express.
- Users can register/login, report lost or found items, view others’ reports, chat in real time, and manage profiles.

##### File structure
- app.js: main Express server setup, middleware, route registration, static serving, Socket.io initialization.
- models/: Mongoose schemas for User, LostItem, FoundItem, Comment, Message (data layer).
- routes/: Express route handlers for user (registration, login, profile), item (report lost/found, listing), and chat (real-time messaging).
- views/: EJS templates (MVC’s view layer) for pages—index, login, register, reportLost, reportFound, chat, inbox, profiles.
- public/: client assets—CSS, client-side JS (including socket.js), uploaded images.
- .env: environment variables (DB URI, secrets, port).

##### README
- Minimal content; confirms project name and that it’s a web app. No embedded architecture notes—so infer from code.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Frontend (Browser)"
        direction TB
        Index["Index View"]:::frontend
        Login["Login View"]:::frontend
        Register["Registration View"]:::frontend
        ReportLost["Report Lost Item View"]:::frontend
        ReportFound["Report Found Item View"]:::frontend
        ChatView["Chat View"]:::frontend
        Inbox["Inbox View"]:::frontend
        Profile["User Profile View"]:::frontend
        UserProfile["Other User Profile View"]:::frontend
        Header["Header Partial"]:::frontend
        Footer["Footer Partial"]:::frontend
        SocketJS["Socket Init (socket.js)"]:::frontend
        Styles["Stylesheet (style.css)"]:::frontend
    end

    subgraph "Backend (Express Server)"
        direction TB
        App["Express Server (app.js)"]:::backend
        Env["Env Config (.env)"]:::config
        subgraph "Routes"
            direction TB
            UserRoute["User Routes"]:::backend
            ItemRoute["Item Routes"]:::backend
            ChatRoute["Chat Routes"]:::backend
        end
        subgraph "Models"
            direction TB
            UserModel["User Model"]:::backend
            LostModel["LostItem Model"]:::backend
            FoundModel["FoundItem Model"]:::backend
            CommentModel["Comment Model"]:::backend
            MessageModel["Message Model"]:::backend
        end
    end

    subgraph "Data & Storage"
        direction TB
        DB["MongoDB"]:::database
        Storage["Uploads Storage"]:::storage
    end

    %% Connections: HTTP flows
    Index -->|renders via HTTP| App
    Login -->|renders via HTTP| App
    Register -->|renders via HTTP| App
    ReportLost -->|renders via HTTP| App
    ReportFound -->|renders via HTTP| App
    ChatView -->|renders via HTTP| App
    Inbox -->|renders via HTTP| App
    Profile -->|renders via HTTP| App
    UserProfile -->|renders via HTTP| App
    Styles -->|served statically| App
    Header -->|included in views| App
    Footer -->|included in views| App

    %% Real-time WebSocket
    SocketJS -->|WebSocket events| App

    %% Server internals
    App -->|loads config| Env
    App -->|uses routes| UserRoute
    App -->|uses routes| ItemRoute
    App -->|uses routes| ChatRoute
    UserRoute -->|calls| UserModel
    ItemRoute -->|calls| LostModel
    ItemRoute -->|calls| FoundModel
    UserRoute -->|calls| CommentModel
    ChatRoute -->|calls| MessageModel

    %% Data layer
    UserModel -->|reads/writes| DB
    LostModel -->|reads/writes| DB
    FoundModel -->|reads/writes| DB
    CommentModel -->|reads/writes| DB
    MessageModel -->|reads/writes| DB

    %% File uploads
    App -->|uploads to| Storage
    Storage -->|serves static| App

    %% Click Events
    click App "https://github.com/23abhishek2024/23abhishek2024--foundify-lost-found-web-app/blob/main/app.js"
    click Env "https://github.com/23abhishek2024/23abhishek2024--foundify-lost-found-web-app/blob/main/.env"
    click UserModel "https://github.com/23abhishek2024/23abhishek2024--foundify-lost-found-web-app/blob/main/models/user.js"
    click LostModel "https://github.com/23abhishek2024/23abhishek2024--foundify-lost-found-web-app/blob/main/models/lostItem.js"
    click FoundModel "https://github.com/23abhishek2024/23abhishek2024--foundify-lost-found-web-app/blob/main/models/foundItem.js"
    click CommentModel "https://github.com/23abhishek2024/23abhishek2024--foundify-lost-found-web-app/blob/main/models/comment.js"
    click MessageModel "https://github.com/23abhishek2024/23abhishek2024--foundify-lost-found-web-app/blob/main/models/message.js"
    click UserRoute "https://github.com/23abhishek2024/23abhishek2024--foundify-lost-found-web-app/blob/main/routes/user.js"
    click ItemRoute "https://github.com/23abhishek2024/23abhishek2024--foundify-lost-found-web-app/blob/main/routes/item.js"
    click ChatRoute "https://github.com/23abhishek2024/23abhishek2024--foundify-lost-found-web-app/blob/main/routes/chat.js"
    click Index "https://github.com/23abhishek2024/23abhishek2024--foundify-lost-found-web-app/blob/main/views/index.ejs"
    click Login "https://github.com/23abhishek2024/23abhishek2024--foundify-lost-found-web-app/blob/main/views/login.ejs"
    click Register "https://github.com/23abhishek2024/23abhishek2024--foundify-lost-found-web-app/blob/main/views/register.ejs"
    click ReportLost "https://github.com/23abhishek2024/23abhishek2024--foundify-lost-found-web-app/blob/main/views/reportLost.ejs"
    click ReportFound "https://github.com/23abhishek2024/23abhishek2024--foundify-lost-found-web-app/blob/main/views/reportFound.ejs"
    click ChatView "https://github.com/23abhishek2024/23abhishek2024--foundify-lost-found-web-app/blob/main/views/chat.ejs"
    click Inbox "https://github.com/23abhishek2024/23abhishek2024--foundify-lost-found-web-app/blob/main/views/inbox.ejs"
    click Profile "https://github.com/23abhishek2024/23abhishek2024--foundify-lost-found-web-app/blob/main/views/profile.ejs"
    click UserProfile "https://github.com/23abhishek2024/23abhishek2024--foundify-lost-found-web-app/blob/main/views/userProfile.ejs"
    click Header "https://github.com/23abhishek2024/23abhishek2024--foundify-lost-found-web-app/blob/main/views/partials/header.ejs"
    click Footer "https://github.com/23abhishek2024/23abhishek2024--foundify-lost-found-web-app/blob/main/views/partials/footer.ejs"
    click SocketJS "https://github.com/23abhishek2024/23abhishek2024--foundify-lost-found-web-app/blob/main/public/js/socket.js"
    click Styles "https://github.com/23abhishek2024/23abhishek2024--foundify-lost-found-web-app/blob/main/public/style.css"
    click Storage "https://github.com/23abhishek2024/23abhishek2024--foundify-lost-found-web-app/tree/main/public/uploads"

    classDef frontend fill:#D0E8FF,stroke:#0366d6,color:#0366d6
    classDef backend fill:#E0FFE0,stroke:#28a745,color:#28a745
    classDef database fill:#FFE0B2,stroke:#ff9800,color:#e65100
    classDef storage fill:#FFF9C4,stroke:#fdd835,color:#f9a825
    classDef config fill:#E0E0E0,stroke:#9e9e9e,color:#616161
```
