# vanaiyan/thrifting.lk architecture

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

- Interactive diagram: https://gitdiagram.com/vanaiyan/thrifting.lk
- Repository: https://github.com/vanaiyan/thrifting.lk

## Overview

This repository implements a marketplace-style web application with a React frontend and Express/Mongoose backend. The visible user workflow is browsing the home and product views, and registering or logging in; the backend also provides product-management, account-recovery, profile, and user-search endpoints, plus a chat interface and user-search endpoint. The backend route-to-controller and controller-to-model links are supported by the source index; unsampled frontend networking and chat behavior are not inferred.

Main entry points: [`frontend/src/App.js`](https://github.com/vanaiyan/thrifting.lk/blob/main/frontend/src/App.js) (Page routing), [`backend/controllers/authController.js`](https://github.com/vanaiyan/thrifting.lk/blob/main/backend/controllers/authController.js) (Account workflows), [`backend/app.js`](https://github.com/vanaiyan/thrifting.lk/blob/main/backend/app.js) (HTTP application), [`frontend/src/Components/Home/ProductRow1.js`](https://github.com/vanaiyan/thrifting.lk/blob/main/frontend/src/Components/Home/ProductRow1.js) (Product displays)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_routes_ui["Page routing<br/>[App.js]"]
  node_home["Marketplace home<br/>[HomePage.js]"]
  node_product_views["Product displays<br/>[ProductRow1.js]"]
  node_product_cards["Product cards<br/>[ProductCardsm.js]"]
  node_product_list["Product listing<br/>[Products.js]"]
  node_chat_page["Chat interface<br/>[ChatPage.js]"]
  node_chat_view["Chat conversation<br/>[Chat.js]"]
  node_chat_actions["Chat actions<br/>[chatActions.js]"]
end

subgraph group_identity["Accounts and identity"]
  node_auth_pages["Login and signup<br/>[LoginMain.js]"]
  node_login_forms["Login forms<br/>[LoginDesk.js]"]
  node_signup_forms["Signup forms<br/>[SignUpDesk.js]"]
  node_user_actions["User actions<br/>[userAction.js]"]
  node_auth_routes["Account routes<br/>[auth.js]"]
  node_auth_controller["Account workflows<br/>[authController.js]"]
  node_auth_middleware["Authentication<br/>[authenticate.js]"]
  node_user_model[("User records<br/>[userModel.js]")]
  node_jwt_helper["Token helper<br/>[jwt.js]"]
  node_email_helper["Email helper<br/>[email.js]"]
end

subgraph group_catalog["Product catalog"]
  node_product_routes["Product routes<br/>[product.js]"]
  node_product_controller["Product workflows"]
  node_product_model[("Product records<br/>[productModel.js]")]
end

subgraph group_server["API and persistence"]
  node_api_app["HTTP application<br/>[app.js]"]
  node_query_features["Search and paging<br/>[apiFeatures.js]"]
  node_chat_routes["Chat user routes<br/>[chat.js]"]
  node_chat_controller["User search<br/>[chatController.js]"]
  node_db_config[("Database connection<br/>[database.js]")]
  node_server_entry["Server startup<br/>[server.js]"]
end

node_visitor(("Visitor"))

node_visitor -->|"opens"| node_routes_ui
node_routes_ui -->|"routes to"| node_home
node_routes_ui -->|"routes to"| node_auth_pages
node_routes_ui -->|"routes to"| node_chat_page
node_home -->|"renders"| node_product_views
node_product_views -->|"renders"| node_product_cards
node_product_views -->|"uses"| node_product_list
node_auth_pages -->|"renders"| node_login_forms
node_auth_pages -->|"renders"| node_signup_forms
node_login_forms -->|"dispatches"| node_user_actions
node_chat_page -->|"renders"| node_chat_view
node_chat_page -->|"uses"| node_chat_actions
node_api_app -->|"mounts"| node_auth_routes
node_api_app -->|"mounts"| node_product_routes
node_api_app -->|"mounts"| node_chat_routes
node_auth_routes -->|"dispatches"| node_auth_controller
node_auth_routes -->|"guards"| node_auth_middleware
node_auth_controller -->|"reads and writes"| node_user_model
node_auth_controller -->|"issues token"| node_jwt_helper
node_auth_controller -->|"sends recovery email"| node_email_helper
node_auth_middleware -->|"loads user"| node_user_model
node_product_routes -->|"dispatches"| node_product_controller
node_product_routes -->|"guards"| node_auth_middleware
node_product_controller -->|"queries"| node_product_model
node_product_controller -->|"filters results"| node_query_features
node_chat_routes -->|"dispatches"| node_chat_controller
node_chat_controller -->|"searches users"| node_user_model
node_chat_controller -->|"searches with"| node_query_features
node_server_entry -->|"starts"| node_api_app
node_server_entry -->|"connects database"| node_db_config

click node_routes_ui "https://github.com/vanaiyan/thrifting.lk/blob/main/frontend/src/App.js"
click node_home "https://github.com/vanaiyan/thrifting.lk/blob/main/frontend/src/Pages/User/HomePage.js"
click node_product_views "https://github.com/vanaiyan/thrifting.lk/blob/main/frontend/src/Components/Home/ProductRow1.js"
click node_product_cards "https://github.com/vanaiyan/thrifting.lk/blob/main/frontend/src/Components/Cards/ProductCardsm.js"
click node_product_list "https://github.com/vanaiyan/thrifting.lk/blob/main/frontend/src/Components/Products.js"
click node_auth_pages "https://github.com/vanaiyan/thrifting.lk/blob/main/frontend/src/Pages/User/LoginMain.js"
click node_login_forms "https://github.com/vanaiyan/thrifting.lk/blob/main/frontend/src/Components/Login/LoginDesk.js"
click node_signup_forms "https://github.com/vanaiyan/thrifting.lk/blob/main/frontend/src/Components/Sign-up/SignUpDesk.js"
click node_user_actions "https://github.com/vanaiyan/thrifting.lk/blob/main/frontend/src/Actions/userAction.js"
click node_chat_page "https://github.com/vanaiyan/thrifting.lk/blob/main/frontend/src/Pages/User/ChatPage.js"
click node_chat_view "https://github.com/vanaiyan/thrifting.lk/blob/main/frontend/src/Pages/User/Chat.js"
click node_chat_actions "https://github.com/vanaiyan/thrifting.lk/blob/main/frontend/src/Actions/chatActions.js"
click node_api_app "https://github.com/vanaiyan/thrifting.lk/blob/main/backend/app.js"
click node_auth_routes "https://github.com/vanaiyan/thrifting.lk/blob/main/backend/routes/auth.js"
click node_auth_controller "https://github.com/vanaiyan/thrifting.lk/blob/main/backend/controllers/authController.js"
click node_auth_middleware "https://github.com/vanaiyan/thrifting.lk/blob/main/backend/middlewares/authenticate.js"
click node_user_model "https://github.com/vanaiyan/thrifting.lk/blob/main/backend/models/userModel.js"
click node_jwt_helper "https://github.com/vanaiyan/thrifting.lk/blob/main/backend/utils/jwt.js"
click node_email_helper "https://github.com/vanaiyan/thrifting.lk/blob/main/backend/utils/email.js"
click node_product_routes "https://github.com/vanaiyan/thrifting.lk/blob/main/backend/routes/product.js"
click node_product_controller "https://github.com/vanaiyan/thrifting.lk/blob/main/backend/controllers/productController.js"
click node_product_model "https://github.com/vanaiyan/thrifting.lk/blob/main/backend/models/productModel.js"
click node_query_features "https://github.com/vanaiyan/thrifting.lk/blob/main/backend/utils/apiFeatures.js"
click node_chat_routes "https://github.com/vanaiyan/thrifting.lk/blob/main/backend/routes/chat.js"
click node_chat_controller "https://github.com/vanaiyan/thrifting.lk/blob/main/backend/controllers/chatController.js"
click node_db_config "https://github.com/vanaiyan/thrifting.lk/blob/main/backend/config/database.js"
click node_server_entry "https://github.com/vanaiyan/thrifting.lk/blob/main/backend/server.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_routes_ui,node_home,node_product_views,node_product_cards,node_product_list,node_chat_page,node_chat_view,node_chat_actions toneBlue
class node_auth_pages,node_login_forms,node_signup_forms,node_user_actions,node_auth_routes,node_auth_controller,node_auth_middleware,node_user_model,node_jwt_helper,node_email_helper toneAmber
class node_product_routes,node_product_controller,node_product_model toneMint
class node_api_app,node_query_features,node_chat_routes,node_chat_controller,node_db_config,node_server_entry toneRose
class node_visitor toneIndigo
```

## Components

### Web application

- [Page routing](https://github.com/vanaiyan/thrifting.lk/blob/main/frontend/src/App.js): `frontend/src/App.js`
- [Marketplace home](https://github.com/vanaiyan/thrifting.lk/blob/main/frontend/src/Pages/User/HomePage.js): `frontend/src/Pages/User/HomePage.js`
- [Product displays](https://github.com/vanaiyan/thrifting.lk/blob/main/frontend/src/Components/Home/ProductRow1.js): `frontend/src/Components/Home/ProductRow1.js`
- [Product cards](https://github.com/vanaiyan/thrifting.lk/blob/main/frontend/src/Components/Cards/ProductCardsm.js): `frontend/src/Components/Cards/ProductCardsm.js`
- [Product listing](https://github.com/vanaiyan/thrifting.lk/blob/main/frontend/src/Components/Products.js): `frontend/src/Components/Products.js`
- [Chat interface](https://github.com/vanaiyan/thrifting.lk/blob/main/frontend/src/Pages/User/ChatPage.js): `frontend/src/Pages/User/ChatPage.js`
- [Chat conversation](https://github.com/vanaiyan/thrifting.lk/blob/main/frontend/src/Pages/User/Chat.js): `frontend/src/Pages/User/Chat.js`
- [Chat actions](https://github.com/vanaiyan/thrifting.lk/blob/main/frontend/src/Actions/chatActions.js): `frontend/src/Actions/chatActions.js`

### Accounts and identity

- [Login and signup](https://github.com/vanaiyan/thrifting.lk/blob/main/frontend/src/Pages/User/LoginMain.js): `frontend/src/Pages/User/LoginMain.js`
- [Login forms](https://github.com/vanaiyan/thrifting.lk/blob/main/frontend/src/Components/Login/LoginDesk.js): `frontend/src/Components/Login/LoginDesk.js`
- [Signup forms](https://github.com/vanaiyan/thrifting.lk/blob/main/frontend/src/Components/Sign-up/SignUpDesk.js): `frontend/src/Components/Sign-up/SignUpDesk.js`
- [User actions](https://github.com/vanaiyan/thrifting.lk/blob/main/frontend/src/Actions/userAction.js): `frontend/src/Actions/userAction.js`
- [Account routes](https://github.com/vanaiyan/thrifting.lk/blob/main/backend/routes/auth.js): `backend/routes/auth.js`
- [Account workflows](https://github.com/vanaiyan/thrifting.lk/blob/main/backend/controllers/authController.js): `backend/controllers/authController.js`
- [Authentication](https://github.com/vanaiyan/thrifting.lk/blob/main/backend/middlewares/authenticate.js): `backend/middlewares/authenticate.js`
- [User records](https://github.com/vanaiyan/thrifting.lk/blob/main/backend/models/userModel.js): `backend/models/userModel.js`
- [Token helper](https://github.com/vanaiyan/thrifting.lk/blob/main/backend/utils/jwt.js): `backend/utils/jwt.js`
- [Email helper](https://github.com/vanaiyan/thrifting.lk/blob/main/backend/utils/email.js): `backend/utils/email.js`

### Product catalog

- [Product routes](https://github.com/vanaiyan/thrifting.lk/blob/main/backend/routes/product.js): `backend/routes/product.js`
- [Product workflows](https://github.com/vanaiyan/thrifting.lk/blob/main/backend/controllers/productController.js): `backend/controllers/productController.js`
- [Product records](https://github.com/vanaiyan/thrifting.lk/blob/main/backend/models/productModel.js): `backend/models/productModel.js`

### API and persistence

- [HTTP application](https://github.com/vanaiyan/thrifting.lk/blob/main/backend/app.js): `backend/app.js`
- [Search and paging](https://github.com/vanaiyan/thrifting.lk/blob/main/backend/utils/apiFeatures.js): `backend/utils/apiFeatures.js`
- [Chat user routes](https://github.com/vanaiyan/thrifting.lk/blob/main/backend/routes/chat.js): `backend/routes/chat.js`
- [User search](https://github.com/vanaiyan/thrifting.lk/blob/main/backend/controllers/chatController.js): `backend/controllers/chatController.js`
- [Database connection](https://github.com/vanaiyan/thrifting.lk/blob/main/backend/config/database.js): `backend/config/database.js`
- [Server startup](https://github.com/vanaiyan/thrifting.lk/blob/main/backend/server.js): `backend/server.js`

### Other components

- **Visitor**

## Connections

- Visitor → Page routing: opens (evidence: `frontend/src/App.js`)
- Page routing → Marketplace home: routes to (evidence: `frontend/src/App.js`)
- Page routing → Login and signup: routes to (evidence: `frontend/src/App.js`)
- Page routing → Chat interface: routes to (evidence: `frontend/src/App.js`)
- Marketplace home → Product displays: renders (evidence: `frontend/src/Pages/User/HomePage.js`)
- Product displays → Product cards: renders (evidence: `frontend/src/Components/Home/ProductRow1.js`)
- Product displays → Product listing: uses (evidence: `frontend/src/Components/Home/ProductRow1.js`)
- Login and signup → Login forms: renders (evidence: `frontend/src/Pages/User/LoginMain.js`)
- Login and signup → Signup forms: renders
- Login forms → User actions: dispatches (evidence: `frontend/src/Components/Login/LoginDesk.js`)
- Chat interface → Chat conversation: renders (evidence: `frontend/src/Pages/User/ChatPage.js`)
- Chat interface → Chat actions: uses (evidence: `frontend/src/Pages/User/ChatPage.js`)
- HTTP application → Account routes: mounts (evidence: `backend/app.js`)
- HTTP application → Product routes: mounts (evidence: `backend/app.js`)
- HTTP application → Chat user routes: mounts (evidence: `backend/app.js`)
- Account routes → Account workflows: dispatches (evidence: `backend/routes/auth.js`)
- Account routes → Authentication: guards (evidence: `backend/routes/auth.js`)
- Account workflows → User records: reads and writes (evidence: `backend/controllers/authController.js`)
- Account workflows → Token helper: issues token (evidence: `backend/controllers/authController.js`)
- Account workflows → Email helper: sends recovery email (evidence: `backend/controllers/authController.js`)
- Authentication → User records: loads user (evidence: `backend/middlewares/authenticate.js`)
- Product routes → Product workflows: dispatches (evidence: `backend/routes/product.js`)
- Product routes → Authentication: guards (evidence: `backend/routes/product.js`)
- Product workflows → Product records: queries (evidence: `backend/controllers/productController.js`)
- Product workflows → Search and paging: filters results (evidence: `backend/controllers/productController.js`)
- Chat user routes → User search: dispatches (evidence: `backend/routes/chat.js`)
- User search → User records: searches users (evidence: `backend/controllers/chatController.js`)
- User search → Search and paging: searches with (evidence: `backend/controllers/chatController.js`)
- Server startup → HTTP application: starts (evidence: `backend/server.js`)
- Server startup → Database connection: connects database (evidence: `backend/server.js`)
