# rohith-kanna-jr-2006/moorthi_cafe_webapp architecture

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

- Interactive diagram: https://gitdiagram.com/rohith-kanna-jr-2006/moorthi_cafe_webapp
- Repository: https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp

## Overview

Hotel New Moorthi Cafe is a React restaurant site backed by Express and MongoDB. Customers browse the menu, authenticate, preview server-calculated cart totals, and place counter-pickup orders; staff use the admin portal for menu, category, order, customer, and sales operations. The graph retains these documented capabilities, while showing only source-supported request and service links. Several screens and backend route/controller implementations were not excerpted, so their internal connections are omitted rather than inferred.

Main entry points: [`backend/src/controllers/adminController.js`](https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/controllers/adminController.js) (Admin controller), [`backend/src/services/orderService.js`](https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/services/orderService.js) (Order pricing and placement), [`src/App.js`](https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/src/App.js) (React routes), [`backend/src/models/Order.js`](https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/models/Order.js) (Orders and counters)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_customer["Customer experience"]
  node_app["React routes<br/>[App.js]"]
  node_public["Public pages"]
  node_foodcard["Food cards<br/>[FoodCard.js]"]
end

subgraph group_admin["Admin operations"]
  node_adminui["Admin screens"]
end

subgraph group_api["API and domain"]
  node_apiclient["HTTP API client<br/>[api.js]"]
  node_express["Express app and routes<br/>[app.js]"]
  node_authroutes["Authentication routes<br/>[authRoutes.js]"]
  node_orderoutes["Order routes<br/>[orderRoutes.js]"]
  node_foodcontroller["Menu controller<br/>[foodController.js]"]
  node_ordercontroller["Order controller<br/>[orderController.js]"]
  node_admincontroller["Admin controller<br/>[adminController.js]"]
  node_authcontroller["Auth controller<br/>[authController.js]"]
  node_orderservice["Order pricing and placement<br/>[orderService.js]"]
  node_counter["Daily token allocation<br/>[counterService.js]"]
  node_reports["Sales reporting<br/>[reportService.js]"]
  node_categorycontroller["Category management"]
  node_authmiddleware["JWT authentication<br/>[authenticate.js]"]
  node_queryhelpers["Query validation helpers<br/>[queryHelpers.js]"]
end

subgraph group_data["Persistence"]
  node_foodmodel[("Food and category records<br/>[Food.js]")]
  node_ordermodel[("Orders and counters<br/>[Order.js]")]
  node_usermodel[("User records<br/>[User.js]")]
end

node_diner(("Diner"))
node_staff(("Restaurant staff"))

node_diner -->|"uses"| node_app
node_staff -->|"uses"| node_app
node_app -->|"routes to"| node_public
node_app -->|"routes to"| node_adminui
node_public -->|"renders"| node_foodcard
node_adminui -->|"requests through"| node_apiclient
node_apiclient -->|"HTTP requests"| node_express
node_express -->|"registers"| node_authroutes
node_express -->|"registers"| node_orderoutes
node_orderoutes -->|"dispatches"| node_ordercontroller
node_authroutes -->|"dispatches"| node_authcontroller
node_orderoutes -->|"authenticates"| node_authmiddleware
node_authmiddleware -->|"loads user"| node_usermodel
node_ordercontroller -->|"prices and places"| node_orderservice
node_orderservice -->|"reads menu"| node_foodmodel
node_orderservice -->|"creates order"| node_ordermodel
node_orderservice -->|"allocates token"| node_counter
node_counter -.->|"increments counter"| node_ordermodel
node_foodcontroller -->|"reads and writes"| node_foodmodel
node_foodcontroller -.->|"checks category"| node_categorycontroller
node_categorycontroller -->|"queries food"| node_foodmodel
node_admincontroller -->|"manages orders"| node_ordermodel
node_admincontroller -->|"lists customers"| node_usermodel
node_admincontroller -->|"requests reports"| node_reports
node_reports -->|"aggregates sales"| node_ordermodel
node_admincontroller -->|"validates queries"| node_queryhelpers

click node_app "https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/src/App.js"
click node_public "https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/tree/main/src/pages"
click node_foodcard "https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/src/components/FoodCard.js"
click node_adminui "https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/tree/main/src/admin"
click node_apiclient "https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/src/utils/api.js"
click node_express "https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/app.js"
click node_authroutes "https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/routes/authRoutes.js"
click node_orderoutes "https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/routes/orderRoutes.js"
click node_foodcontroller "https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/controllers/foodController.js"
click node_ordercontroller "https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/controllers/orderController.js"
click node_admincontroller "https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/controllers/adminController.js"
click node_authcontroller "https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/controllers/authController.js"
click node_orderservice "https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/services/orderService.js"
click node_counter "https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/services/counterService.js"
click node_reports "https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/services/reportService.js"
click node_categorycontroller "https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/controllers/categoryController.js"
click node_authmiddleware "https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/middleware/authenticate.js"
click node_queryhelpers "https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/utils/queryHelpers.js"
click node_foodmodel "https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/models/Food.js"
click node_ordermodel "https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/models/Order.js"
click node_usermodel "https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/models/User.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_public,node_foodcard toneBlue
class node_adminui toneAmber
class node_apiclient,node_express,node_authroutes,node_orderoutes,node_foodcontroller,node_ordercontroller,node_admincontroller,node_authcontroller,node_orderservice,node_counter,node_reports,node_categorycontroller,node_authmiddleware,node_queryhelpers toneMint
class node_foodmodel,node_ordermodel,node_usermodel toneRose
class node_diner,node_staff toneIndigo
```

## Components

### Customer experience

- [React routes](https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/src/App.js): `src/App.js`
- [Public pages](https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/tree/main/src/pages): `src/pages`
- [Food cards](https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/src/components/FoodCard.js): `src/components/FoodCard.js`

### Admin operations

- [Admin screens](https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/tree/main/src/admin): `src/admin`

### API and domain

- [HTTP API client](https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/src/utils/api.js): `src/utils/api.js`
- [Express app and routes](https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/app.js): `backend/src/app.js`
- [Authentication routes](https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/routes/authRoutes.js): `backend/src/routes/authRoutes.js`
- [Order routes](https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/routes/orderRoutes.js): `backend/src/routes/orderRoutes.js`
- [Menu controller](https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/controllers/foodController.js): `backend/src/controllers/foodController.js`
- [Order controller](https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/controllers/orderController.js): `backend/src/controllers/orderController.js`
- [Admin controller](https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/controllers/adminController.js): `backend/src/controllers/adminController.js`
- [Auth controller](https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/controllers/authController.js): `backend/src/controllers/authController.js`
- [Order pricing and placement](https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/services/orderService.js): `backend/src/services/orderService.js`
- [Daily token allocation](https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/services/counterService.js): `backend/src/services/counterService.js`
- [Sales reporting](https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/services/reportService.js): `backend/src/services/reportService.js`
- [Category management](https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/controllers/categoryController.js): `backend/src/controllers/categoryController.js`
- [JWT authentication](https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/middleware/authenticate.js): `backend/src/middleware/authenticate.js`
- [Query validation helpers](https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/utils/queryHelpers.js): `backend/src/utils/queryHelpers.js`

### Persistence

- [Food and category records](https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/models/Food.js): `backend/src/models/Food.js`
- [Orders and counters](https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/models/Order.js): `backend/src/models/Order.js`
- [User records](https://github.com/rohith-kanna-jr-2006/moorthi_cafe_webapp/blob/main/backend/src/models/User.js): `backend/src/models/User.js`

### Other components

- **Diner**
- **Restaurant staff**

## Connections

- Diner → React routes: uses (evidence: `src/App.js`)
- Restaurant staff → React routes: uses (evidence: `src/App.js`)
- React routes → Public pages: routes to (evidence: `src/App.js`)
- React routes → Admin screens: routes to (evidence: `src/App.js`)
- Public pages → Food cards: renders (evidence: `src/pages/Home.js`)
- Admin screens → HTTP API client: requests through (evidence: `src/admin/AddEditFood.js`)
- HTTP API client → Express app and routes: HTTP requests (evidence: `src/utils/api.js`)
- Express app and routes → Authentication routes: registers (evidence: `backend/src/app.js`)
- Express app and routes → Order routes: registers (evidence: `backend/src/app.js`)
- Order routes → Order controller: dispatches (evidence: `backend/src/routes/orderRoutes.js`)
- Authentication routes → Auth controller: dispatches (evidence: `backend/src/routes/authRoutes.js`)
- Order routes → JWT authentication: authenticates (evidence: `backend/src/routes/orderRoutes.js`)
- JWT authentication → User records: loads user (evidence: `backend/src/middleware/authenticate.js`)
- Order controller → Order pricing and placement: prices and places (evidence: `backend/src/controllers/orderController.js`)
- Order pricing and placement → Food and category records: reads menu (evidence: `backend/src/services/orderService.js`)
- Order pricing and placement → Orders and counters: creates order (evidence: `backend/src/services/orderService.js`)
- Order pricing and placement → Daily token allocation: allocates token (evidence: `backend/src/services/orderService.js`)
- Daily token allocation → Orders and counters: increments counter
- Menu controller → Food and category records: reads and writes (evidence: `backend/src/controllers/foodController.js`)
- Menu controller → Category management: checks category
- Category management → Food and category records: queries food (evidence: `backend/src/controllers/categoryController.js`)
- Admin controller → Orders and counters: manages orders (evidence: `backend/src/controllers/adminController.js`)
- Admin controller → User records: lists customers (evidence: `backend/src/controllers/adminController.js`)
- Admin controller → Sales reporting: requests reports (evidence: `backend/src/controllers/adminController.js`)
- Sales reporting → Orders and counters: aggregates sales (evidence: `backend/src/services/reportService.js`)
- Admin controller → Query validation helpers: validates queries (evidence: `backend/src/controllers/adminController.js`)
