# rojinagautam/fresh_cart_web_project architecture

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

- Interactive diagram: https://gitdiagram.com/rojinagautam/fresh_cart_web_project
- Repository: https://github.com/rojinagautam/fresh_cart_web_project

## Overview

FreshCart is a full-stack commerce application with customer shopping, account, and support features plus an administration interface. The principal workflow is browsing products and deals, managing a cart or wishlist, placing an order, and handling payment; reviews provide a separate post-purchase-style product capability. The backend exposes these domains through an Express API and MongoDB-backed repositories. The README is empty, and most domain handlers were not sampled, so uncertain frontend-to-backend and internal links are shown as dashed and unverified rather than asserted.

Main entry points: [`frontend/lib/actions`](https://github.com/rojinagautam/fresh_cart_web_project/tree/main/frontend/lib/actions) (Frontend actions), [`backend/src/app.ts`](https://github.com/rojinagautam/fresh_cart_web_project/blob/main/backend/src/app.ts) (Express API), [`backend/src/services/review.service.ts`](https://github.com/rojinagautam/fresh_cart_web_project/blob/main/backend/src/services/review.service.ts) (Review service), [`frontend/lib/api`](https://github.com/rojinagautam/fresh_cart_web_project/tree/main/frontend/lib/api) (Frontend API clients)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_storefront_ui["Shopping UI"]
  node_account_ui["Account UI"]
  node_review_ui["Product reviews<br/>[ProductReviews.tsx]"]
  node_chat_ui["Chat widget"]
  node_frontend_api["Frontend API clients"]
  node_frontend_actions["Frontend actions"]
  node_auth_storage[("Auth storage<br/>[auth-storage.ts]")]
end

subgraph group_admin["Administration"]
  node_admin_ui["Admin console"]
end

subgraph group_api["API and services"]
  node_api_app["Express API<br/>[app.ts]"]
  node_auth_controller["Account handlers<br/>[user.controller.ts]"]
  node_commerce_controllers["Commerce handlers"]
  node_review_controller["Review handler"]
  node_domain_services["Domain services"]
  node_cart_service["Cart service<br/>[cart.service.ts]"]
  node_user_service["User service<br/>[user.service.ts]"]
  node_review_service["Review service<br/>[review.service.ts]"]
  node_auth_middleware["Authentication<br/>[auth.middleware.ts]"]
end

subgraph group_data["Persistence"]
  node_repositories["Domain repositories"]
  node_product_repository["Product repository"]
  node_user_repository["User repository<br/>[user.repository.ts]"]
  node_review_repository["Review repository"]
  node_mongo[("MongoDB<br/>[mongodb.ts]")]
  node_models["Domain models"]
  node_product_model["Product model<br/>[product.model.ts]"]
  node_review_model["Review model<br/>[review.model.ts]"]
end

subgraph group_integrations["Integrations"]
  node_payment_provider["Payment provider"]
  node_mailer["Email delivery"]
end

node_shopper(("Shopper"))

node_shopper -->|"uses"| node_storefront_ui
node_storefront_ui -.->|"invokes"| node_frontend_actions
node_account_ui -.->|"invokes"| node_frontend_actions
node_review_ui -.->|"submits reviews"| node_frontend_actions
node_chat_ui -.->|"sends messages"| node_frontend_actions
node_admin_ui -.->|"requests admin data"| node_frontend_actions
node_frontend_actions -->|"calls clients"| node_frontend_api
node_frontend_api -.->|"HTTP requests"| node_api_app
node_frontend_api -.->|"uses auth state"| node_auth_storage
node_api_app -->|"mounts domain routes"| node_commerce_controllers
node_api_app -->|"mounts auth routes"| node_auth_controller
node_api_app -->|"mounts review routes"| node_review_controller
node_commerce_controllers -.->|"delegates"| node_domain_services
node_auth_controller -->|"calls"| node_user_service
node_review_controller -->|"calls"| node_review_service
node_review_service -->|"reads and writes"| node_review_repository
node_review_service -->|"checks products"| node_product_repository
node_review_service -.->|"raises domain errors"| node_product_model
node_cart_service -.->|"persists cart data"| node_repositories
node_user_service -.->|"persists accounts"| node_user_repository
node_auth_middleware -->|"loads user"| node_user_repository
node_review_repository -->|"queries"| node_review_model
node_review_repository -->|"updates rating cache"| node_product_model
node_product_repository -->|"queries"| node_product_model
node_repositories -.->|"stores domain data"| node_mongo
node_domain_services -.->|"processes payments"| node_payment_provider
node_domain_services -.->|"sends account email"| node_mailer

click node_storefront_ui "https://github.com/rojinagautam/fresh_cart_web_project/tree/main/frontend/app/(homepage)"
click node_account_ui "https://github.com/rojinagautam/fresh_cart_web_project/tree/main/frontend/app/(auth)"
click node_review_ui "https://github.com/rojinagautam/fresh_cart_web_project/blob/main/frontend/app/(homepage)/categories/_components/ProductReviews.tsx"
click node_chat_ui "https://github.com/rojinagautam/fresh_cart_web_project/tree/main/frontend/app/_components/chat"
click node_admin_ui "https://github.com/rojinagautam/fresh_cart_web_project/tree/main/frontend/app/admin"
click node_frontend_api "https://github.com/rojinagautam/fresh_cart_web_project/tree/main/frontend/lib/api"
click node_frontend_actions "https://github.com/rojinagautam/fresh_cart_web_project/tree/main/frontend/lib/actions"
click node_auth_storage "https://github.com/rojinagautam/fresh_cart_web_project/blob/main/frontend/lib/auth-storage.ts"
click node_api_app "https://github.com/rojinagautam/fresh_cart_web_project/blob/main/backend/src/app.ts"
click node_auth_controller "https://github.com/rojinagautam/fresh_cart_web_project/blob/main/backend/src/controllers/user.controller.ts"
click node_commerce_controllers "https://github.com/rojinagautam/fresh_cart_web_project/tree/main/backend/src/controllers"
click node_review_controller "https://github.com/rojinagautam/fresh_cart_web_project/blob/main/backend/src/controllers/review.controller.ts"
click node_domain_services "https://github.com/rojinagautam/fresh_cart_web_project/tree/main/backend/src/services"
click node_cart_service "https://github.com/rojinagautam/fresh_cart_web_project/blob/main/backend/src/services/cart.service.ts"
click node_user_service "https://github.com/rojinagautam/fresh_cart_web_project/blob/main/backend/src/services/user.service.ts"
click node_review_service "https://github.com/rojinagautam/fresh_cart_web_project/blob/main/backend/src/services/review.service.ts"
click node_auth_middleware "https://github.com/rojinagautam/fresh_cart_web_project/blob/main/backend/src/middleware/auth.middleware.ts"
click node_repositories "https://github.com/rojinagautam/fresh_cart_web_project/tree/main/backend/src/repositories"
click node_product_repository "https://github.com/rojinagautam/fresh_cart_web_project/blob/main/backend/src/repositories/product.repository.ts"
click node_user_repository "https://github.com/rojinagautam/fresh_cart_web_project/blob/main/backend/src/repositories/user.repository.ts"
click node_review_repository "https://github.com/rojinagautam/fresh_cart_web_project/blob/main/backend/src/repositories/review.repository.ts"
click node_mongo "https://github.com/rojinagautam/fresh_cart_web_project/blob/main/backend/src/database/mongodb.ts"
click node_models "https://github.com/rojinagautam/fresh_cart_web_project/tree/main/backend/src/models"
click node_product_model "https://github.com/rojinagautam/fresh_cart_web_project/blob/main/backend/src/models/product.model.ts"
click node_review_model "https://github.com/rojinagautam/fresh_cart_web_project/blob/main/backend/src/models/review.model.ts"

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_storefront_ui,node_account_ui,node_review_ui,node_chat_ui,node_frontend_api,node_frontend_actions,node_auth_storage toneBlue
class node_admin_ui toneAmber
class node_api_app,node_auth_controller,node_commerce_controllers,node_review_controller,node_domain_services,node_cart_service,node_user_service,node_review_service,node_auth_middleware toneMint
class node_repositories,node_product_repository,node_user_repository,node_review_repository,node_mongo,node_models,node_product_model,node_review_model toneRose
class node_payment_provider,node_mailer,node_shopper toneIndigo
```

## Components

### Storefront

- [Shopping UI](https://github.com/rojinagautam/fresh_cart_web_project/tree/main/frontend/app/(homepage)): `frontend/app/(homepage)`
- [Account UI](https://github.com/rojinagautam/fresh_cart_web_project/tree/main/frontend/app/(auth)): `frontend/app/(auth)`
- [Product reviews](https://github.com/rojinagautam/fresh_cart_web_project/blob/main/frontend/app/(homepage)/categories/_components/ProductReviews.tsx): `frontend/app/(homepage)/categories/_components/ProductReviews.tsx`
- [Chat widget](https://github.com/rojinagautam/fresh_cart_web_project/tree/main/frontend/app/_components/chat): `frontend/app/_components/chat`
- [Frontend API clients](https://github.com/rojinagautam/fresh_cart_web_project/tree/main/frontend/lib/api): `frontend/lib/api`
- [Frontend actions](https://github.com/rojinagautam/fresh_cart_web_project/tree/main/frontend/lib/actions): `frontend/lib/actions`
- [Auth storage](https://github.com/rojinagautam/fresh_cart_web_project/blob/main/frontend/lib/auth-storage.ts): `frontend/lib/auth-storage.ts`

### Administration

- [Admin console](https://github.com/rojinagautam/fresh_cart_web_project/tree/main/frontend/app/admin): `frontend/app/admin`

### API and services

- [Express API](https://github.com/rojinagautam/fresh_cart_web_project/blob/main/backend/src/app.ts): `backend/src/app.ts`
- [Account handlers](https://github.com/rojinagautam/fresh_cart_web_project/blob/main/backend/src/controllers/user.controller.ts): `backend/src/controllers/user.controller.ts`
- [Commerce handlers](https://github.com/rojinagautam/fresh_cart_web_project/tree/main/backend/src/controllers): `backend/src/controllers`
- [Review handler](https://github.com/rojinagautam/fresh_cart_web_project/blob/main/backend/src/controllers/review.controller.ts): `backend/src/controllers/review.controller.ts`
- [Domain services](https://github.com/rojinagautam/fresh_cart_web_project/tree/main/backend/src/services): `backend/src/services`
- [Cart service](https://github.com/rojinagautam/fresh_cart_web_project/blob/main/backend/src/services/cart.service.ts): `backend/src/services/cart.service.ts`
- [User service](https://github.com/rojinagautam/fresh_cart_web_project/blob/main/backend/src/services/user.service.ts): `backend/src/services/user.service.ts`
- [Review service](https://github.com/rojinagautam/fresh_cart_web_project/blob/main/backend/src/services/review.service.ts): `backend/src/services/review.service.ts`
- [Authentication](https://github.com/rojinagautam/fresh_cart_web_project/blob/main/backend/src/middleware/auth.middleware.ts): `backend/src/middleware/auth.middleware.ts`

### Persistence

- [Domain repositories](https://github.com/rojinagautam/fresh_cart_web_project/tree/main/backend/src/repositories): `backend/src/repositories`
- [Product repository](https://github.com/rojinagautam/fresh_cart_web_project/blob/main/backend/src/repositories/product.repository.ts): `backend/src/repositories/product.repository.ts`
- [User repository](https://github.com/rojinagautam/fresh_cart_web_project/blob/main/backend/src/repositories/user.repository.ts): `backend/src/repositories/user.repository.ts`
- [Review repository](https://github.com/rojinagautam/fresh_cart_web_project/blob/main/backend/src/repositories/review.repository.ts): `backend/src/repositories/review.repository.ts`
- [MongoDB](https://github.com/rojinagautam/fresh_cart_web_project/blob/main/backend/src/database/mongodb.ts): `backend/src/database/mongodb.ts`
- [Domain models](https://github.com/rojinagautam/fresh_cart_web_project/tree/main/backend/src/models): `backend/src/models`
- [Product model](https://github.com/rojinagautam/fresh_cart_web_project/blob/main/backend/src/models/product.model.ts): `backend/src/models/product.model.ts`
- [Review model](https://github.com/rojinagautam/fresh_cart_web_project/blob/main/backend/src/models/review.model.ts): `backend/src/models/review.model.ts`

### Integrations

- **Payment provider**
- **Email delivery**

### Other components

- **Shopper**

## Connections

- Shopper → Shopping UI: uses
- Shopping UI → Frontend actions: invokes
- Account UI → Frontend actions: invokes (evidence: `frontend/app/(auth)/verify-email/useVerifyEmailViewModel.ts`)
- Product reviews → Frontend actions: submits reviews
- Chat widget → Frontend actions: sends messages (evidence: `frontend/app/_components/chat/useChatViewModel.ts`)
- Admin console → Frontend actions: requests admin data (evidence: `frontend/app/admin/page.tsx`)
- Frontend actions → Frontend API clients: calls clients (evidence: `frontend/lib/actions/auth-action.ts`)
- Frontend API clients → Express API: HTTP requests
- Frontend API clients → Auth storage: uses auth state (evidence: `frontend/lib/auth-storage.ts`)
- Express API → Commerce handlers: mounts domain routes (evidence: `backend/src/app.ts`)
- Express API → Account handlers: mounts auth routes (evidence: `backend/src/app.ts`)
- Express API → Review handler: mounts review routes (evidence: `backend/src/app.ts`)
- Commerce handlers → Domain services: delegates (evidence: `backend/src/controllers/review.controller.ts`)
- Account handlers → User service: calls (evidence: `backend/src/controllers/user.controller.ts`)
- Review handler → Review service: calls (evidence: `backend/src/controllers/review.controller.ts`)
- Review service → Review repository: reads and writes (evidence: `backend/src/services/review.service.ts`)
- Review service → Product repository: checks products (evidence: `backend/src/services/review.service.ts`)
- Review service → Product model: raises domain errors
- Cart service → Domain repositories: persists cart data
- User service → User repository: persists accounts
- Authentication → User repository: loads user (evidence: `backend/src/middleware/auth.middleware.ts`)
- Review repository → Review model: queries (evidence: `backend/src/repositories/review.repository.ts`)
- Review repository → Product model: updates rating cache (evidence: `backend/src/repositories/review.repository.ts`)
- Product repository → Product model: queries (evidence: `backend/src/repositories/product.repository.ts`)
- Domain repositories → MongoDB: stores domain data
- Domain services → Payment provider: processes payments
- Domain services → Email delivery: sends account email
