# duttaabhirupdev10/restaurant_foodapp architecture

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

- Interactive diagram: https://gitdiagram.com/duttaabhirupdev10/restaurant_foodapp
- Repository: https://github.com/duttaabhirupdev10/restaurant_foodapp

## Overview

This is an Express/MongoDB restaurant-management API. Clients enter through versioned routes; authentication and role checks protect selected operations, controllers implement account, restaurant, category, menu, and order actions, and Mongoose models persist the results. The README documents the broader CRUD and order-status capabilities; some corresponding source was not sampled, so those links follow the documented route/controller structure without asserting finer internal calls.

Main entry points: [`server.js`](https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/server.js) (Express server), [`utils/logger.js`](https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/utils/logger.js) (Logging), [`routes/foodRoutes.js`](https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/routes/foodRoutes.js) (Food routes), [`middleware/authMiddleware.js`](https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/middleware/authMiddleware.js) (JWT verification)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API entry"]
  node_server["Express server<br/>[server.js]"]
  node_authroutes["Auth routes<br/>[authRoutes.js]"]
  node_userroutes["User routes<br/>[userRoutes.js]"]
  node_restaurantroutes["Restaurant routes"]
  node_categoryroutes["Category routes<br/>[categoryRoutes.js]"]
  node_foodroutes["Food routes<br/>[foodRoutes.js]"]
  node_testroutes["Test routes<br/>[testRoutes.js]"]
end

subgraph group_identity["Identity and access"]
  node_authcontroller["Authentication<br/>[authController.js]"]
  node_usercontroller["User management<br/>[userController.js]"]
  node_authmiddleware["JWT verification<br/>[authMiddleware.js]"]
  node_adminmiddleware["Admin check<br/>[adminMiddleware.js]"]
end

subgraph group_catalog["Restaurant catalog"]
  node_restaurantcontroller["Restaurant management"]
  node_categorycontroller["Category management"]
  node_foodcontroller["Menu management<br/>[foodController.js]"]
end

subgraph group_orders["Ordering"]
  node_ordercontroller["Order actions<br/>[foodController.js]"]
end

subgraph group_platform["Persistence and support"]
  node_usermodel[("User records<br/>[userModel.js]")]
  node_restaurantmodel[("Restaurant records<br/>[restaurantModel.js]")]
  node_categorymodel[("Category records<br/>[categoryModel.js]")]
  node_foodmodel[("Food records<br/>[foodModel.js]")]
  node_ordermodel[("Order records<br/>[orderModel.js]")]
  node_dbconfig["DB connection<br/>[db.js]"]
  node_errorhandler["Error handling<br/>[errorHandler.js]"]
  node_logger["Logging<br/>[logger.js]"]
end

node_client(("API client"))
node_database[("MongoDB")]

node_client -->|"sends requests"| node_server
node_server -->|"mounts routes"| node_authroutes
node_server -->|"mounts routes"| node_userroutes
node_server -->|"mounts routes"| node_restaurantroutes
node_server -->|"mounts routes"| node_categoryroutes
node_server -->|"mounts routes"| node_foodroutes
node_server -->|"mounts routes"| node_testroutes
node_server -->|"connects database"| node_dbconfig
node_server -->|"installs handler"| node_errorhandler
node_authroutes -->|"dispatches to"| node_authcontroller
node_userroutes -->|"guards routes"| node_authmiddleware
node_userroutes -->|"dispatches to"| node_usercontroller
node_restaurantroutes -->|"guards writes"| node_authmiddleware
node_restaurantroutes -->|"dispatches to"| node_restaurantcontroller
node_categoryroutes -->|"guards writes"| node_authmiddleware
node_categoryroutes -->|"dispatches to"| node_categorycontroller
node_foodroutes -->|"guards operations"| node_authmiddleware
node_foodroutes -->|"guards status updates"| node_adminmiddleware
node_foodroutes -->|"dispatches to"| node_foodcontroller
node_foodroutes -->|"dispatches orders"| node_ordercontroller
node_authcontroller -->|"reads and writes"| node_usermodel
node_usercontroller -->|"reads and writes"| node_usermodel
node_restaurantcontroller -->|"reads and writes"| node_restaurantmodel
node_categorycontroller -->|"reads and writes"| node_categorymodel
node_foodcontroller -->|"reads and writes"| node_foodmodel
node_ordercontroller -->|"creates and updates"| node_ordermodel
node_dbconfig -->|"connects to"| node_database
node_usermodel -->|"persists records"| node_database
node_restaurantmodel -->|"persists records"| node_database
node_categorymodel -->|"persists records"| node_database
node_foodmodel -->|"persists records"| node_database
node_ordermodel -->|"persists records"| node_database
node_server -->|"logs startup"| node_logger
node_errorhandler -->|"logs errors"| node_logger
node_authcontroller -->|"logs activity"| node_logger
node_usercontroller -->|"logs activity"| node_logger
node_restaurantcontroller -->|"logs activity"| node_logger
node_categorycontroller -->|"logs activity"| node_logger
node_foodcontroller -->|"logs activity"| node_logger

click node_server "https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/server.js"
click node_authroutes "https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/routes/authRoutes.js"
click node_userroutes "https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/routes/userRoutes.js"
click node_restaurantroutes "https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/routes/restaurantRoutes.js"
click node_categoryroutes "https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/routes/categoryRoutes.js"
click node_foodroutes "https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/routes/foodRoutes.js"
click node_testroutes "https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/routes/testRoutes.js"
click node_authcontroller "https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/controllers/authController.js"
click node_usercontroller "https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/controllers/userController.js"
click node_authmiddleware "https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/middleware/authMiddleware.js"
click node_adminmiddleware "https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/middleware/adminMiddleware.js"
click node_restaurantcontroller "https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/controllers/restaurantController.js"
click node_categorycontroller "https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/controllers/categoryController.js"
click node_foodcontroller "https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/controllers/foodController.js"
click node_ordercontroller "https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/controllers/foodController.js"
click node_usermodel "https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/models/userModel.js"
click node_restaurantmodel "https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/models/restaurantModel.js"
click node_categorymodel "https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/models/categoryModel.js"
click node_foodmodel "https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/models/foodModel.js"
click node_ordermodel "https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/models/orderModel.js"
click node_dbconfig "https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/config/db.js"
click node_errorhandler "https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/utils/errorHandler.js"
click node_logger "https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/utils/logger.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_server,node_authroutes,node_userroutes,node_restaurantroutes,node_categoryroutes,node_foodroutes,node_testroutes,node_client toneBlue
class node_authcontroller,node_usercontroller,node_authmiddleware,node_adminmiddleware,node_database toneAmber
class node_restaurantcontroller,node_categorycontroller,node_foodcontroller toneMint
class node_ordercontroller toneRose
class node_usermodel,node_restaurantmodel,node_categorymodel,node_foodmodel,node_ordermodel,node_dbconfig,node_errorhandler,node_logger toneIndigo
```

## Components

### API entry

- [Express server](https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/server.js): `server.js`
- [Auth routes](https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/routes/authRoutes.js): `routes/authRoutes.js`
- [User routes](https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/routes/userRoutes.js): `routes/userRoutes.js`
- [Restaurant routes](https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/routes/restaurantRoutes.js): `routes/restaurantRoutes.js`
- [Category routes](https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/routes/categoryRoutes.js): `routes/categoryRoutes.js`
- [Food routes](https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/routes/foodRoutes.js): `routes/foodRoutes.js`
- [Test routes](https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/routes/testRoutes.js): `routes/testRoutes.js`

### Identity and access

- [Authentication](https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/controllers/authController.js): `controllers/authController.js`
- [User management](https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/controllers/userController.js): `controllers/userController.js`
- [JWT verification](https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/middleware/authMiddleware.js): `middleware/authMiddleware.js`
- [Admin check](https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/middleware/adminMiddleware.js): `middleware/adminMiddleware.js`

### Restaurant catalog

- [Restaurant management](https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/controllers/restaurantController.js): `controllers/restaurantController.js`
- [Category management](https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/controllers/categoryController.js): `controllers/categoryController.js`
- [Menu management](https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/controllers/foodController.js): `controllers/foodController.js`

### Ordering

- [Order actions](https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/controllers/foodController.js): `controllers/foodController.js`

### Persistence and support

- [User records](https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/models/userModel.js): `models/userModel.js`
- [Restaurant records](https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/models/restaurantModel.js): `models/restaurantModel.js`
- [Category records](https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/models/categoryModel.js): `models/categoryModel.js`
- [Food records](https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/models/foodModel.js): `models/foodModel.js`
- [Order records](https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/models/orderModel.js): `models/orderModel.js`
- [DB connection](https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/config/db.js): `config/db.js`
- [Error handling](https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/utils/errorHandler.js): `utils/errorHandler.js`
- [Logging](https://github.com/duttaabhirupdev10/restaurant_foodapp/blob/main/utils/logger.js): `utils/logger.js`

### Other components

- **API client**
- **MongoDB**

## Connections

- API client → Express server: sends requests
- Express server → Auth routes: mounts routes
- Express server → User routes: mounts routes
- Express server → Restaurant routes: mounts routes
- Express server → Category routes: mounts routes
- Express server → Food routes: mounts routes
- Express server → Test routes: mounts routes
- Express server → DB connection: connects database
- Express server → Error handling: installs handler
- Auth routes → Authentication: dispatches to
- User routes → JWT verification: guards routes
- User routes → User management: dispatches to
- Restaurant routes → JWT verification: guards writes
- Restaurant routes → Restaurant management: dispatches to
- Category routes → JWT verification: guards writes
- Category routes → Category management: dispatches to
- Food routes → JWT verification: guards operations
- Food routes → Admin check: guards status updates
- Food routes → Menu management: dispatches to
- Food routes → Order actions: dispatches orders
- Authentication → User records: reads and writes
- User management → User records: reads and writes
- Restaurant management → Restaurant records: reads and writes
- Category management → Category records: reads and writes
- Menu management → Food records: reads and writes
- Order actions → Order records: creates and updates
- DB connection → MongoDB: connects to
- User records → MongoDB: persists records
- Restaurant records → MongoDB: persists records
- Category records → MongoDB: persists records
- Food records → MongoDB: persists records
- Order records → MongoDB: persists records
- Express server → Logging: logs startup
- Error handling → Logging: logs errors
- Authentication → Logging: logs activity
- User management → Logging: logs activity
- Restaurant management → Logging: logs activity
- Category management → Logging: logs activity
- Menu management → Logging: logs activity
