# aayushsinghal294/rewear architecture

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

- Interactive diagram: https://gitdiagram.com/aayushsinghal294/rewear
- Repository: https://github.com/aayushsinghal294/rewear

## Overview

##### Project type and purpose
- This is a full-stack web application called “ReWear – Community Clothing Exchange.”
- Frontend is a React (Vite) single-page app; backend is a Node.js/Express REST API with data models for users, items, and swap requests.

##### File structure
- client/
– src/main.jsx & public/index.html: entry points
– src/App.jsx, src/pages/*, src/components/*: UI and page views (Home, Browse, Dashboard, etc.)
– src/services/api.js: REST client layer
- server/
– server.js: Express app bootstrap
– routes/*.js: REST endpoints for items and users
– models/*.js: Mongoose (or similar) schemas: User, Item, SwapRequest
– .env: DB connection and secrets

##### README
- Confirms the purpose: a swap and points-based clothing exchange platform.
- Highlights sustainability use case.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Frontend (React SPA)"
        direction TB
        Main["main.jsx"]:::client
        HTML["index.html"]:::client
        App["App.jsx"]:::client
        subgraph "Pages"
            direction TB
            Home["Home.jsx"]:::client
            Browse["Browse.jsx"]:::client
            Dashboard["Dashboard.jsx"]:::client
            ItemDetail["ItemDetail.jsx"]:::client
            ListItem["ListItem.jsx"]:::client
            MySwaps["MySwaps.jsx"]:::client
            ProfileUpdate["ProfileUpdateForm.jsx"]:::client
        end
        subgraph "Components"
            direction TB
            Navbar["Navbar.jsx"]:::client
            Hero["HeroSection.jsx"]:::client
        end
        APIClient["api.js"]:::client
        ViteConfig["vite.config.js"]:::client
        EnvClient[".env"]:::client
        GitignoreClient[".gitignore"]:::client
    end

    subgraph "Backend (Express API)"
        direction TB
        Server["server.js"]:::backend
        subgraph "Routes"
            direction TB
            UserRoutes["users.js"]:::backend
            ItemRoutes["items.js"]:::backend
        end
        subgraph "Models"
            direction TB
            UserModel["User.js"]:::backend
            ItemModel["Item.js"]:::backend
            SwapModel["SwapRequest.js"]:::backend
        end
        EnvServer[".env"]:::backend
        GitignoreServer[".gitignore"]:::backend
        TokenIssuer["JWT Token Issuer"]:::backend
    end

    DB["MongoDB"]:::db
    External["Email/SMS Service"]:::external

    Main --> App
    HTML --> App
    App --> APIClient
    Home --> APIClient
    Browse --> APIClient
    Dashboard --> APIClient
    ItemDetail --> APIClient
    ListItem --> APIClient
    MySwaps --> APIClient
    ProfileUpdate --> APIClient
    Navbar --> APIClient
    Hero --> APIClient

    APIClient --> Server

    Server --> UserRoutes
    Server --> ItemRoutes
    UserRoutes --> UserModel
    ItemRoutes --> ItemModel
    ItemRoutes --> SwapModel

    UserModel --> DB
    ItemModel --> DB
    SwapModel --> DB

    Server -.-> External
    Server --> TokenIssuer
    TokenIssuer -.-> App

    click Main "https://github.com/aayushsinghal294/rewear/blob/main/client/src/main.jsx"
    click HTML "https://github.com/aayushsinghal294/rewear/blob/main/client/index.html"
    click App "https://github.com/aayushsinghal294/rewear/blob/main/client/src/App.jsx"
    click Home "https://github.com/aayushsinghal294/rewear/blob/main/client/src/pages/Home.jsx"
    click Browse "https://github.com/aayushsinghal294/rewear/blob/main/client/src/pages/Browse.jsx"
    click Dashboard "https://github.com/aayushsinghal294/rewear/blob/main/client/src/pages/Dashboard.jsx"
    click ItemDetail "https://github.com/aayushsinghal294/rewear/blob/main/client/src/pages/ItemDetail.jsx"
    click ListItem "https://github.com/aayushsinghal294/rewear/blob/main/client/src/pages/ListItem.jsx"
    click MySwaps "https://github.com/aayushsinghal294/rewear/blob/main/client/src/pages/MySwaps.jsx"
    click ProfileUpdate "https://github.com/aayushsinghal294/rewear/blob/main/client/src/pages/ProfileUpdateForm.jsx"
    click Navbar "https://github.com/aayushsinghal294/rewear/blob/main/client/src/components/Navbar.jsx"
    click Hero "https://github.com/aayushsinghal294/rewear/blob/main/client/src/components/HeroSection.jsx"
    click APIClient "https://github.com/aayushsinghal294/rewear/blob/main/client/src/services/api.js"
    click ViteConfig "https://github.com/aayushsinghal294/rewear/blob/main/client/vite.config.js"
    click EnvClient "https://github.com/aayushsinghal294/rewear/blob/main/client/.env"
    click GitignoreClient "https://github.com/aayushsinghal294/rewear/blob/main/client/.gitignore"
    click Server "https://github.com/aayushsinghal294/rewear/blob/main/server/server.js"
    click UserRoutes "https://github.com/aayushsinghal294/rewear/blob/main/server/routes/users.js"
    click ItemRoutes "https://github.com/aayushsinghal294/rewear/blob/main/server/routes/items.js"
    click UserModel "https://github.com/aayushsinghal294/rewear/blob/main/server/models/User.js"
    click ItemModel "https://github.com/aayushsinghal294/rewear/blob/main/server/models/Item.js"
    click SwapModel "https://github.com/aayushsinghal294/rewear/blob/main/server/models/SwapRequest.js"
    click EnvServer "https://github.com/aayushsinghal294/rewear/blob/main/server/.env"
    click GitignoreServer "https://github.com/aayushsinghal294/rewear/blob/main/server/.gitignore"

    classDef client fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef backend fill:#90EE90,stroke:#333,stroke-width:1px
    classDef db fill:#FFA500,stroke:#333,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:1px
```
