# devsp1312/rutgers-marketplace architecture

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

- Interactive diagram: https://gitdiagram.com/devsp1312/rutgers-marketplace
- Repository: https://github.com/devsp1312/rutgers-marketplace

## Overview

##### Project type and purpose
- RU-Marketplace is a full-stack web application for Rutgers students to buy/sell items.
- Key functional areas: authentication (Rutgers NetID), product listing/search, user profiles & wishlist, admin dashboard, image uploads, Google Calendar integration.

##### File structure
- Top-level directories:
- FrontEnd/ → static assets (HTML, CSS, JS), React-style Components and Pages
- Back End/ → backend todos (implicit Express code lives at root: server.js, index.js)
- Database/ → MongoDB helper functions (db_funcs.js) and documentation
- uploads/ → file storage for product images
- test/ → integration/unit tests (.mjs)
- Root files: server.js (Express entry), package.json, index.html, adminPage.html, profile.html, Product.html, CSS/JS for various pages.

##### README
- Confirms tech stack: Frontend (HTML/CSS/JS), Backend (Node.js/Express), Database (MongoDB), Auth (Rutgers NetID), Google Calendar API.
- Features noted: authentication flows, CRUD listings, search/autocomplete, user profile & wishlist, admin interface, calendar scheduling, image uploads, reporting.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client"
        A["Client Browser"]:::external
    end

    %% Frontend Layer
    subgraph "Frontend Layer"
        direction TB
        FL1["Main Landing Page"]:::frontend
        FL2["Sign-in Page"]:::frontend
        FL3["Product Listing Component"]:::frontend
        FL4["Product Details Page"]:::frontend
        FL5["Profile Page"]:::frontend
        FL6["Admin Dashboard Page"]:::frontend
        FL7["Admin Dashboard Script"]:::frontend
        FL8["Message Seller Feature"]:::frontend
        FL9["Schedule Meeting Feature"]:::frontend
    end

    %% Backend/API Layer
    subgraph "Backend/API Layer"
        direction TB
        B1["Express Server"]:::backend
        B2["Additional Routes / Startup Logic"]:::backend
        B3["Authentication Service"]:::backend
        B4["Product Service"]:::backend
        B5["User & Wishlist Service"]:::backend
        B6["Admin Service"]:::backend
        B7["Image Upload Service"]:::backend
        B8["Scheduling Service"]:::backend
    end

    %% Database Layer
    subgraph "Database"
        DB["MongoDB"]:::db
        DBAccess["DB Access Layer (db_funcs.js)"]:::db
    end

    %% File Storage
    subgraph "File Storage"
        FS["Uploads Directory"]:::storage
    end

    %% External Services
    subgraph "External Services"
        direction TB
        E1["Rutgers NetID (CAS)"]:::external
        E2["Google Calendar API"]:::external
    end

    %% Connections
    A -->|loads| FL1
    A -->|loads| FL2
    A -->|loads| FL4
    A -->|loads| FL5
    A -->|loads| FL6

    FL1 -->|calls /api/products| B4
    FL3 -->|calls /api/products| B4
    FL4 -->|calls /api/products/:id| B4
    FL2 -->|calls /api/users/auth| B3
    FL5 -->|calls /api/users/profile| B5
    FL5 -->|calls /api/wishlist| B5
    FL6 -->|calls /api/admin/*| B6
    FL7 -->|logic for admin| B6
    FL8 -->|calls /api/message| B5
    FL9 -->|calls /api/schedule| B8

    B1 --> B2
    B2 --> B3
    B2 --> B4
    B2 --> B5
    B2 --> B6
    B2 --> B7
    B2 --> B8

    B3 -->|reads/writes| DBAccess
    B4 -->|reads/writes| DBAccess
    B5 -->|reads/writes| DBAccess
    B6 -->|reads/writes| DBAccess
    B7 -->|saves files| FS
    B8 -->|calls| E2

    B3 -->|redirects/auth| E1

    DBAccess --> DB

    %% Click Events
    click FL1 "https://github.com/devsp1312/rutgers-marketplace/blob/main/index.html"
    click FL2 "https://github.com/devsp1312/rutgers-marketplace/blob/main/FrontEnd/Pages/signin.html"
    click FL3 "https://github.com/devsp1312/rutgers-marketplace/blob/main/FrontEnd/Components/productListing.js"
    click FL4 "https://github.com/devsp1312/rutgers-marketplace/blob/main/Product.html"
    click FL5 "https://github.com/devsp1312/rutgers-marketplace/blob/main/profile.html"
    click FL6 "https://github.com/devsp1312/rutgers-marketplace/blob/main/adminPage.html"
    click FL7 "https://github.com/devsp1312/rutgers-marketplace/blob/main/adminPage.js"
    click FL8 "https://github.com/devsp1312/rutgers-marketplace/blob/main/messageSeller.js"
    click FL9 "https://github.com/devsp1312/rutgers-marketplace/blob/main/scheduleMeeting.js"
    click B1 "https://github.com/devsp1312/rutgers-marketplace/blob/main/server.js"
    click B2 "https://github.com/devsp1312/rutgers-marketplace/blob/main/index.js"
    click DBAccess "https://github.com/devsp1312/rutgers-marketplace/blob/main/Database/db_funcs.js"
    click FS "https://github.com/devsp1312/rutgers-marketplace/tree/main/uploads/"

    %% Styles
    classDef frontend fill:#E3F2FD,stroke:#90CAF9
    classDef backend fill:#BBDEFB,stroke:#64B5F6
    classDef db fill:#90CAF9,stroke:#42A5F5,stroke-width:2px
    classDef external fill:#C8E6C9,stroke:#66BB6A
    classDef storage fill:#FFE0B2,stroke:#FFB74D
```
