# komal251205/localconnect architecture

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

- Interactive diagram: https://gitdiagram.com/komal251205/localconnect
- Repository: https://github.com/komal251205/localconnect

## Overview

LocalConnect is a local-services marketplace. Customers browse and filter services, inspect provider and review details, then book; providers manage service listings and bookings, while admins have a separate dashboard. The frontend also supports accounts, profiles, recommendations, and review flows. The backend exposes corresponding API routes backed by MongoDB models, with JWT authentication and role checks. Source excerpts directly establish the service-detail and booking flow; other feature branches are included from the source index and file tree, with only evidenced connections shown.

Main entry points: [`frontend/src/App.jsx`](https://github.com/komal251205/localconnect/blob/main/frontend/src/App.jsx) (Application router), [`server.js`](https://github.com/komal251205/localconnect/blob/main/server.js) (API server), [`middleware/auth.js`](https://github.com/komal251205/localconnect/blob/main/middleware/auth.js) (JWT and role checks), [`frontend/src/pages/ServiceDetail.jsx`](https://github.com/komal251205/localconnect/blob/main/frontend/src/pages/ServiceDetail.jsx) (Service detail and booking)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Marketplace frontend"]
  node_app["Application router<br/>[App.jsx]"]
  node_theme["Theme state<br/>[ThemeContext.jsx]"]
  node_catalog["Service discovery<br/>[Services.jsx]"]
  node_home["Home and recommendations<br/>[Home.jsx]"]
  node_card["Service card<br/>[ServiceCard.jsx]"]
  node_detail["Service detail and booking<br/>[ServiceDetail.jsx]"]
  node_bookingsui["Customer bookings<br/>[MyBookings.jsx]"]
end

subgraph group_identity["Identity and access"]
  node_authctx["Authentication state<br/>[AuthContext.jsx]"]
  node_login["Login and registration<br/>[Register.jsx]"]
  node_authapi["Authentication routes<br/>[auth.js]"]
  node_authmw["JWT and role checks<br/>[auth.js]"]
end

subgraph group_market["Marketplace API"]
  node_servicesapi["Service catalog API<br/>[services.js]"]
  node_bookingsapi["Booking API<br/>[bookings.js]"]
  node_reviewsapi["Review API<br/>[reviews.js]"]
  node_aiapi["AI recommendations API<br/>[ai.js]"]
  node_server["API server<br/>[server.js]"]
end

subgraph group_operations["Account operations"]
  node_profile["User profile<br/>[Profile.jsx]"]
  node_providerui["Provider dashboard"]
  node_adminui["Admin dashboard<br/>[AdminDashboard.jsx]"]
  node_usersapi["User operations API<br/>[users.js]"]
end

subgraph group_data["MongoDB domain"]
  node_userdb[("User records<br/>[User.js]")]
  node_servicedb[("Service records<br/>[Service.js]")]
  node_bookingdb[("Booking records<br/>[Booking.js]")]
  node_reviewdb[("Review records<br/>[Review.js]")]
end

node_visitor(("Customer / provider"))

node_visitor -->|"uses"| node_app
node_app -->|"provides auth"| node_authctx
node_app -->|"provides theme"| node_theme
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_catalog
node_app -->|"routes to"| node_detail
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_bookingsui
node_app -->|"routes to"| node_profile
node_app -->|"routes to"| node_providerui
node_app -->|"routes to"| node_adminui
node_home -->|"renders"| node_card
node_catalog -->|"renders"| node_card
node_login -->|"uses auth"| node_authctx
node_profile -->|"uses auth"| node_authctx
node_providerui -->|"uses auth"| node_authctx
node_detail -->|"fetches service"| node_servicesapi
node_detail -->|"fetches reviews"| node_reviewsapi
node_detail -->|"submits booking"| node_bookingsapi
node_server -->|"mounts routes"| node_authapi
node_server -->|"mounts routes"| node_servicesapi
node_server -->|"mounts routes"| node_bookingsapi
node_server -->|"mounts routes"| node_reviewsapi
node_server -->|"mounts routes"| node_usersapi
node_server -->|"mounts routes"| node_aiapi
node_authapi -->|"uses tokens"| node_authmw
node_servicesapi -->|"protects writes"| node_authmw
node_servicesapi -->|"reads and writes"| node_servicedb
node_bookingsapi -->|"protects routes"| node_authmw
node_bookingsapi -->|"reads and writes"| node_bookingdb
node_reviewsapi -->|"protects writes"| node_authmw
node_reviewsapi -->|"reads and writes"| node_reviewdb
node_authmw -->|"loads user"| node_userdb
node_authapi -->|"authenticates users"| node_userdb
node_usersapi -->|"manages users"| node_userdb
node_usersapi -->|"queries services"| node_servicedb
node_usersapi -->|"queries bookings"| node_bookingdb
node_aiapi -->|"queries services"| node_servicedb
node_reviewdb -->|"updates ratings"| node_userdb
node_reviewdb -->|"updates ratings"| node_servicedb

click node_app "https://github.com/komal251205/localconnect/blob/main/frontend/src/App.jsx"
click node_authctx "https://github.com/komal251205/localconnect/blob/main/frontend/src/context/AuthContext.jsx"
click node_theme "https://github.com/komal251205/localconnect/blob/main/frontend/src/context/ThemeContext.jsx"
click node_catalog "https://github.com/komal251205/localconnect/blob/main/frontend/src/pages/Services.jsx"
click node_home "https://github.com/komal251205/localconnect/blob/main/frontend/src/pages/Home.jsx"
click node_card "https://github.com/komal251205/localconnect/blob/main/frontend/src/components/ServiceCard.jsx"
click node_detail "https://github.com/komal251205/localconnect/blob/main/frontend/src/pages/ServiceDetail.jsx"
click node_bookingsui "https://github.com/komal251205/localconnect/blob/main/frontend/src/pages/MyBookings.jsx"
click node_login "https://github.com/komal251205/localconnect/blob/main/frontend/src/pages/Register.jsx"
click node_profile "https://github.com/komal251205/localconnect/blob/main/frontend/src/pages/Profile.jsx"
click node_providerui "https://github.com/komal251205/localconnect/blob/main/frontend/src/pages/ProviderDashboard.jsx"
click node_adminui "https://github.com/komal251205/localconnect/blob/main/frontend/src/pages/AdminDashboard.jsx"
click node_authapi "https://github.com/komal251205/localconnect/blob/main/routes/auth.js"
click node_authmw "https://github.com/komal251205/localconnect/blob/main/middleware/auth.js"
click node_servicesapi "https://github.com/komal251205/localconnect/blob/main/routes/services.js"
click node_bookingsapi "https://github.com/komal251205/localconnect/blob/main/routes/bookings.js"
click node_reviewsapi "https://github.com/komal251205/localconnect/blob/main/routes/reviews.js"
click node_aiapi "https://github.com/komal251205/localconnect/blob/main/routes/ai.js"
click node_usersapi "https://github.com/komal251205/localconnect/blob/main/routes/users.js"
click node_server "https://github.com/komal251205/localconnect/blob/main/server.js"
click node_userdb "https://github.com/komal251205/localconnect/blob/main/models/User.js"
click node_servicedb "https://github.com/komal251205/localconnect/blob/main/models/Service.js"
click node_bookingdb "https://github.com/komal251205/localconnect/blob/main/models/Booking.js"
click node_reviewdb "https://github.com/komal251205/localconnect/blob/main/models/Review.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_theme,node_catalog,node_home,node_card,node_detail,node_bookingsui toneBlue
class node_authctx,node_login,node_authapi,node_authmw toneAmber
class node_servicesapi,node_bookingsapi,node_reviewsapi,node_aiapi,node_server toneMint
class node_profile,node_providerui,node_adminui,node_usersapi toneRose
class node_userdb,node_servicedb,node_bookingdb,node_reviewdb,node_visitor toneIndigo
```

## Components

### Marketplace frontend

- [Application router](https://github.com/komal251205/localconnect/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Theme state](https://github.com/komal251205/localconnect/blob/main/frontend/src/context/ThemeContext.jsx): `frontend/src/context/ThemeContext.jsx`
- [Service discovery](https://github.com/komal251205/localconnect/blob/main/frontend/src/pages/Services.jsx): `frontend/src/pages/Services.jsx`
- [Home and recommendations](https://github.com/komal251205/localconnect/blob/main/frontend/src/pages/Home.jsx): `frontend/src/pages/Home.jsx`
- [Service card](https://github.com/komal251205/localconnect/blob/main/frontend/src/components/ServiceCard.jsx): `frontend/src/components/ServiceCard.jsx`
- [Service detail and booking](https://github.com/komal251205/localconnect/blob/main/frontend/src/pages/ServiceDetail.jsx): `frontend/src/pages/ServiceDetail.jsx`
- [Customer bookings](https://github.com/komal251205/localconnect/blob/main/frontend/src/pages/MyBookings.jsx): `frontend/src/pages/MyBookings.jsx`

### Identity and access

- [Authentication state](https://github.com/komal251205/localconnect/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Login and registration](https://github.com/komal251205/localconnect/blob/main/frontend/src/pages/Register.jsx): `frontend/src/pages/Register.jsx`
- [Authentication routes](https://github.com/komal251205/localconnect/blob/main/routes/auth.js): `routes/auth.js`
- [JWT and role checks](https://github.com/komal251205/localconnect/blob/main/middleware/auth.js): `middleware/auth.js`

### Marketplace API

- [Service catalog API](https://github.com/komal251205/localconnect/blob/main/routes/services.js): `routes/services.js`
- [Booking API](https://github.com/komal251205/localconnect/blob/main/routes/bookings.js): `routes/bookings.js`
- [Review API](https://github.com/komal251205/localconnect/blob/main/routes/reviews.js): `routes/reviews.js`
- [AI recommendations API](https://github.com/komal251205/localconnect/blob/main/routes/ai.js): `routes/ai.js`
- [API server](https://github.com/komal251205/localconnect/blob/main/server.js): `server.js`

### Account operations

- [User profile](https://github.com/komal251205/localconnect/blob/main/frontend/src/pages/Profile.jsx): `frontend/src/pages/Profile.jsx`
- [Provider dashboard](https://github.com/komal251205/localconnect/blob/main/frontend/src/pages/ProviderDashboard.jsx): `frontend/src/pages/ProviderDashboard.jsx`
- [Admin dashboard](https://github.com/komal251205/localconnect/blob/main/frontend/src/pages/AdminDashboard.jsx): `frontend/src/pages/AdminDashboard.jsx`
- [User operations API](https://github.com/komal251205/localconnect/blob/main/routes/users.js): `routes/users.js`

### MongoDB domain

- [User records](https://github.com/komal251205/localconnect/blob/main/models/User.js): `models/User.js`
- [Service records](https://github.com/komal251205/localconnect/blob/main/models/Service.js): `models/Service.js`
- [Booking records](https://github.com/komal251205/localconnect/blob/main/models/Booking.js): `models/Booking.js`
- [Review records](https://github.com/komal251205/localconnect/blob/main/models/Review.js): `models/Review.js`

### Other components

- **Customer / provider**

## Connections

- Customer / provider → Application router: uses (evidence: `frontend/src/App.jsx`)
- Application router → Authentication state: provides auth (evidence: `frontend/src/App.jsx`)
- Application router → Theme state: provides theme (evidence: `frontend/src/App.jsx`)
- Application router → Home and recommendations: routes to (evidence: `frontend/src/App.jsx`)
- Application router → Service discovery: routes to (evidence: `frontend/src/App.jsx`)
- Application router → Service detail and booking: routes to (evidence: `frontend/src/App.jsx`)
- Application router → Login and registration: routes to (evidence: `frontend/src/App.jsx`)
- Application router → Customer bookings: routes to (evidence: `frontend/src/App.jsx`)
- Application router → User profile: routes to (evidence: `frontend/src/App.jsx`)
- Application router → Provider dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Application router → Admin dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Home and recommendations → Service card: renders (evidence: `frontend/src/pages/Home.jsx`)
- Service discovery → Service card: renders (evidence: `frontend/src/pages/Services.jsx`)
- Login and registration → Authentication state: uses auth (evidence: `frontend/src/pages/Register.jsx`)
- User profile → Authentication state: uses auth (evidence: `frontend/src/pages/Profile.jsx`)
- Provider dashboard → Authentication state: uses auth (evidence: `frontend/src/pages/ProviderDashboard.jsx`)
- Service detail and booking → Service catalog API: fetches service (evidence: `frontend/src/pages/ServiceDetail.jsx`)
- Service detail and booking → Review API: fetches reviews (evidence: `frontend/src/pages/ServiceDetail.jsx`)
- Service detail and booking → Booking API: submits booking (evidence: `frontend/src/pages/ServiceDetail.jsx`)
- API server → Authentication routes: mounts routes (evidence: `server.js`)
- API server → Service catalog API: mounts routes (evidence: `server.js`)
- API server → Booking API: mounts routes (evidence: `server.js`)
- API server → Review API: mounts routes (evidence: `server.js`)
- API server → User operations API: mounts routes (evidence: `server.js`)
- API server → AI recommendations API: mounts routes (evidence: `server.js`)
- Authentication routes → JWT and role checks: uses tokens (evidence: `routes/auth.js`)
- Service catalog API → JWT and role checks: protects writes (evidence: `routes/services.js`)
- Service catalog API → Service records: reads and writes (evidence: `routes/services.js`)
- Booking API → JWT and role checks: protects routes (evidence: `routes/bookings.js`)
- Booking API → Booking records: reads and writes (evidence: `routes/bookings.js`)
- Review API → JWT and role checks: protects writes (evidence: `routes/reviews.js`)
- Review API → Review records: reads and writes (evidence: `routes/reviews.js`)
- JWT and role checks → User records: loads user (evidence: `middleware/auth.js`)
- Authentication routes → User records: authenticates users (evidence: `routes/auth.js`)
- User operations API → User records: manages users (evidence: `routes/users.js`)
- User operations API → Service records: queries services (evidence: `routes/users.js`)
- User operations API → Booking records: queries bookings (evidence: `routes/users.js`)
- AI recommendations API → Service records: queries services (evidence: `routes/ai.js`)
- Review records → User records: updates ratings (evidence: `models/Review.js`)
- Review records → Service records: updates ratings (evidence: `models/Review.js`)
