# rajeevranjan-023/test-loco architecture

> Architecture diagram of the GitHub repository rajeevranjan-023/test-loco, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rajeevranjan-023/test-loco
- Repository: https://github.com/rajeevranjan-023/test-loco

## Overview

Local Finder combines a public local-business marketplace with seller profiles and a shop-management workspace. Visitors browse the home page, search listings, and view shop or service profiles; sellers manage products, billing, inventory, customers, orders, and analytics through username-scoped pages. Backend routes dispatch to controllers, which read and write MongoDB models and use ledger, stock, and billing utilities. The README is empty, and several frontend-to-API and backend route details are unsampled, so those relationships are not inferred.

Main entry points: [`backend/controllers/salesController.js`](https://github.com/rajeevranjan-023/test-loco/blob/main/backend/controllers/salesController.js) (Sales controller), [`frontend/src/App.jsx`](https://github.com/rajeevranjan-023/test-loco/blob/main/frontend/src/App.jsx) (App routing), [`backend/controllers/ordersController.js`](https://github.com/rajeevranjan-023/test-loco/blob/main/backend/controllers/ordersController.js) (Orders controller), [`backend/routes/sellerRoutes.js`](https://github.com/rajeevranjan-023/test-loco/blob/main/backend/routes/sellerRoutes.js) (Seller routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Public marketplace"]
  node_app["App routing<br/>[App.jsx]"]
  node_home["Home discovery<br/>[Home.jsx]"]
  node_search["Listing search"]
  node_public_profile["Public profiles"]
end

subgraph group_seller["Seller workspace"]
  node_auth["Session context<br/>[AuthContext.jsx]"]
  node_seller_pages["Seller workspace"]
  node_billing_ui["Billing pages<br/>[BillingPage.jsx]"]
  node_api_client["Frontend API client<br/>[api.js]"]
end

subgraph group_api["Backend API"]
  node_backend["API server<br/>[server.js]"]
  node_seller_routes["Seller routes<br/>[sellerRoutes.js]"]
  node_customer_routes["Customer routes<br/>[customerRoutes.js]"]
  node_billing["Billing controller"]
  node_sales["Sales controller<br/>[salesController.js]"]
  node_orders["Orders controller"]
  node_reviews["Review controller"]
  node_auth_middleware["Access control<br/>[auth.js]"]
end

subgraph group_data["Persistence and domain logic"]
  node_shop_data[("Shop and service data<br/>[Shop.js]")]
  node_catalog_data[("Products and sales<br/>[Product.js]")]
  node_billing_data[("Bills and drafts<br/>[Bill.js]")]
  node_customer_data[("Customer ledger<br/>[Customer.js]")]
  node_review_data[("Reviews<br/>[Review.js]")]
  node_ledger["Ledger utilities<br/>[ledger.js]"]
  node_stock["Stock utilities<br/>[stock.js]"]
  node_bill_ids["Bill ID utility<br/>[billId.js]"]
end

node_visitor(("Visitor"))
node_seller_actor(("Seller"))

node_visitor -->|"opens"| node_app
node_seller_actor -->|"opens"| node_app
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_search
node_app -->|"routes to"| node_public_profile
node_app -->|"routes to"| node_seller_pages
node_app -->|"routes to"| node_billing_ui
node_auth -->|"calls"| node_api_client
node_backend -->|"registers"| node_seller_routes
node_backend -->|"registers"| node_customer_routes
node_seller_routes -->|"protects routes"| node_auth_middleware
node_seller_routes -->|"dispatches to"| node_billing
node_seller_routes -->|"dispatches to"| node_sales
node_seller_routes -->|"dispatches to"| node_orders
node_customer_routes -->|"dispatches to"| node_billing
node_billing -->|"reads and writes"| node_billing_data
node_billing -->|"reads and writes"| node_customer_data
node_billing -->|"reads"| node_catalog_data
node_sales -->|"reads and writes"| node_catalog_data
node_sales -->|"writes"| node_billing_data
node_sales -->|"updates"| node_customer_data
node_sales -->|"adjusts stock"| node_stock
node_sales -->|"updates balances"| node_ledger
node_sales -->|"generates IDs"| node_bill_ids
node_orders -->|"reads and writes"| node_billing_data
node_orders -->|"reads and writes"| node_catalog_data
node_orders -->|"reads"| node_customer_data
node_orders -->|"restores stock"| node_stock
node_orders -->|"updates balances"| node_ledger
node_reviews -->|"reads and writes"| node_review_data
node_reviews -->|"looks up targets"| node_shop_data

click node_app "https://github.com/rajeevranjan-023/test-loco/blob/main/frontend/src/App.jsx"
click node_home "https://github.com/rajeevranjan-023/test-loco/blob/main/frontend/src/pages/Home.jsx"
click node_search "https://github.com/rajeevranjan-023/test-loco/blob/main/frontend/src/pages/SearchResultsPage.jsx"
click node_public_profile "https://github.com/rajeevranjan-023/test-loco/tree/main/frontend/src/features/profile"
click node_auth "https://github.com/rajeevranjan-023/test-loco/blob/main/frontend/src/context/AuthContext.jsx"
click node_seller_pages "https://github.com/rajeevranjan-023/test-loco/tree/main/frontend/src/features/analytics/pages"
click node_billing_ui "https://github.com/rajeevranjan-023/test-loco/blob/main/frontend/src/features/analytics/pages/BillingPage.jsx"
click node_backend "https://github.com/rajeevranjan-023/test-loco/blob/main/backend/server.js"
click node_seller_routes "https://github.com/rajeevranjan-023/test-loco/blob/main/backend/routes/sellerRoutes.js"
click node_customer_routes "https://github.com/rajeevranjan-023/test-loco/blob/main/backend/routes/customerRoutes.js"
click node_billing "https://github.com/rajeevranjan-023/test-loco/blob/main/backend/controllers/billingController.js"
click node_sales "https://github.com/rajeevranjan-023/test-loco/blob/main/backend/controllers/salesController.js"
click node_orders "https://github.com/rajeevranjan-023/test-loco/blob/main/backend/controllers/ordersController.js"
click node_reviews "https://github.com/rajeevranjan-023/test-loco/blob/main/backend/controllers/reviewController.js"
click node_auth_middleware "https://github.com/rajeevranjan-023/test-loco/blob/main/backend/middleware/auth.js"
click node_shop_data "https://github.com/rajeevranjan-023/test-loco/blob/main/backend/models/Shop.js"
click node_catalog_data "https://github.com/rajeevranjan-023/test-loco/blob/main/backend/models/Product.js"
click node_billing_data "https://github.com/rajeevranjan-023/test-loco/blob/main/backend/models/Bill.js"
click node_customer_data "https://github.com/rajeevranjan-023/test-loco/blob/main/backend/models/Customer.js"
click node_review_data "https://github.com/rajeevranjan-023/test-loco/blob/main/backend/models/Review.js"
click node_ledger "https://github.com/rajeevranjan-023/test-loco/blob/main/backend/utils/ledger.js"
click node_stock "https://github.com/rajeevranjan-023/test-loco/blob/main/backend/utils/stock.js"
click node_bill_ids "https://github.com/rajeevranjan-023/test-loco/blob/main/backend/utils/billId.js"
click node_api_client "https://github.com/rajeevranjan-023/test-loco/blob/main/frontend/src/services/api.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_app,node_home,node_search,node_public_profile toneBlue
class node_auth,node_seller_pages,node_billing_ui,node_api_client toneAmber
class node_backend,node_seller_routes,node_customer_routes,node_billing,node_sales,node_orders,node_reviews,node_auth_middleware toneMint
class node_shop_data,node_catalog_data,node_billing_data,node_customer_data,node_review_data,node_ledger,node_stock,node_bill_ids toneRose
class node_visitor,node_seller_actor toneIndigo
```

## Components

### Public marketplace

- [App routing](https://github.com/rajeevranjan-023/test-loco/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Home discovery](https://github.com/rajeevranjan-023/test-loco/blob/main/frontend/src/pages/Home.jsx): `frontend/src/pages/Home.jsx`
- [Listing search](https://github.com/rajeevranjan-023/test-loco/blob/main/frontend/src/pages/SearchResultsPage.jsx): `frontend/src/pages/SearchResultsPage.jsx`
- [Public profiles](https://github.com/rajeevranjan-023/test-loco/tree/main/frontend/src/features/profile): `frontend/src/features/profile`

### Seller workspace

- [Session context](https://github.com/rajeevranjan-023/test-loco/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Seller workspace](https://github.com/rajeevranjan-023/test-loco/tree/main/frontend/src/features/analytics/pages): `frontend/src/features/analytics/pages`
- [Billing pages](https://github.com/rajeevranjan-023/test-loco/blob/main/frontend/src/features/analytics/pages/BillingPage.jsx): `frontend/src/features/analytics/pages/BillingPage.jsx`
- [Frontend API client](https://github.com/rajeevranjan-023/test-loco/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`

### Backend API

- [API server](https://github.com/rajeevranjan-023/test-loco/blob/main/backend/server.js): `backend/server.js`
- [Seller routes](https://github.com/rajeevranjan-023/test-loco/blob/main/backend/routes/sellerRoutes.js): `backend/routes/sellerRoutes.js`
- [Customer routes](https://github.com/rajeevranjan-023/test-loco/blob/main/backend/routes/customerRoutes.js): `backend/routes/customerRoutes.js`
- [Billing controller](https://github.com/rajeevranjan-023/test-loco/blob/main/backend/controllers/billingController.js): `backend/controllers/billingController.js`
- [Sales controller](https://github.com/rajeevranjan-023/test-loco/blob/main/backend/controllers/salesController.js): `backend/controllers/salesController.js`
- [Orders controller](https://github.com/rajeevranjan-023/test-loco/blob/main/backend/controllers/ordersController.js): `backend/controllers/ordersController.js`
- [Review controller](https://github.com/rajeevranjan-023/test-loco/blob/main/backend/controllers/reviewController.js): `backend/controllers/reviewController.js`
- [Access control](https://github.com/rajeevranjan-023/test-loco/blob/main/backend/middleware/auth.js): `backend/middleware/auth.js`

### Persistence and domain logic

- [Shop and service data](https://github.com/rajeevranjan-023/test-loco/blob/main/backend/models/Shop.js): `backend/models/Shop.js`
- [Products and sales](https://github.com/rajeevranjan-023/test-loco/blob/main/backend/models/Product.js): `backend/models/Product.js`
- [Bills and drafts](https://github.com/rajeevranjan-023/test-loco/blob/main/backend/models/Bill.js): `backend/models/Bill.js`
- [Customer ledger](https://github.com/rajeevranjan-023/test-loco/blob/main/backend/models/Customer.js): `backend/models/Customer.js`
- [Reviews](https://github.com/rajeevranjan-023/test-loco/blob/main/backend/models/Review.js): `backend/models/Review.js`
- [Ledger utilities](https://github.com/rajeevranjan-023/test-loco/blob/main/backend/utils/ledger.js): `backend/utils/ledger.js`
- [Stock utilities](https://github.com/rajeevranjan-023/test-loco/blob/main/backend/utils/stock.js): `backend/utils/stock.js`
- [Bill ID utility](https://github.com/rajeevranjan-023/test-loco/blob/main/backend/utils/billId.js): `backend/utils/billId.js`

### Other components

- **Visitor**
- **Seller**

## Connections

- Visitor → App routing: opens (evidence: `frontend/src/App.jsx`)
- Seller → App routing: opens (evidence: `frontend/src/App.jsx`)
- App routing → Home discovery: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Listing search: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Public profiles: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Seller workspace: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Billing pages: routes to (evidence: `frontend/src/App.jsx`)
- Session context → Frontend API client: calls (evidence: `frontend/src/context/AuthContext.jsx`)
- API server → Seller routes: registers (evidence: `backend/server.js`)
- API server → Customer routes: registers (evidence: `backend/server.js`)
- Seller routes → Access control: protects routes (evidence: `backend/routes/sellerRoutes.js`)
- Seller routes → Billing controller: dispatches to (evidence: `backend/routes/sellerRoutes.js`)
- Seller routes → Sales controller: dispatches to (evidence: `backend/routes/sellerRoutes.js`)
- Seller routes → Orders controller: dispatches to (evidence: `backend/routes/sellerRoutes.js`)
- Customer routes → Billing controller: dispatches to (evidence: `backend/routes/customerRoutes.js`)
- Billing controller → Bills and drafts: reads and writes (evidence: `backend/controllers/billingController.js`)
- Billing controller → Customer ledger: reads and writes (evidence: `backend/controllers/billingController.js`)
- Billing controller → Products and sales: reads (evidence: `backend/controllers/billingController.js`)
- Sales controller → Products and sales: reads and writes (evidence: `backend/controllers/salesController.js`)
- Sales controller → Bills and drafts: writes (evidence: `backend/controllers/salesController.js`)
- Sales controller → Customer ledger: updates (evidence: `backend/controllers/salesController.js`)
- Sales controller → Stock utilities: adjusts stock (evidence: `backend/controllers/salesController.js`)
- Sales controller → Ledger utilities: updates balances (evidence: `backend/controllers/salesController.js`)
- Sales controller → Bill ID utility: generates IDs (evidence: `backend/controllers/salesController.js`)
- Orders controller → Bills and drafts: reads and writes (evidence: `backend/controllers/ordersController.js`)
- Orders controller → Products and sales: reads and writes (evidence: `backend/controllers/ordersController.js`)
- Orders controller → Customer ledger: reads (evidence: `backend/controllers/ordersController.js`)
- Orders controller → Stock utilities: restores stock (evidence: `backend/controllers/ordersController.js`)
- Orders controller → Ledger utilities: updates balances (evidence: `backend/controllers/ordersController.js`)
- Review controller → Reviews: reads and writes (evidence: `backend/controllers/reviewController.js`)
- Review controller → Shop and service data: looks up targets (evidence: `backend/controllers/reviewController.js`)
