# rahulshamra/newpizza architecture

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

- Interactive diagram: https://gitdiagram.com/rahulshamra/newpizza
- Repository: https://github.com/rahulshamra/newpizza

## Overview

PizaViza is a Next.js food-ordering app: customers browse and filter pizza listings, manage a cart, check out, and view order history; users can also sign up, log in, and review products. A separate admin area supports listing management and image uploads. The graph includes the documented payment stages, but their implementation was not sampled. API-to-model and admin integration links are supported by excerpts; page-to-feature relationships follow the README, so unsampled client calls are not asserted.

Main entry points: [`src/lib/db/connect.js`](https://github.com/rahulshamra/newpizza/blob/main/src/lib/db/connect.js) (MongoDB connection), [`src/app/api/admin/listings/route.js`](https://github.com/rahulshamra/newpizza/blob/main/src/app/api/admin/listings/route.js) (Admin listings API), [`src/app/(routes)/cart/page.js`](https://github.com/rahulshamra/newpizza/blob/main/src/app/(routes)/cart/page.js) (Cart page), [`src/app/(routes)/login/page.js`](https://github.com/rahulshamra/newpizza/blob/main/src/app/(routes)/login/page.js) (Login and signup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_customer["Customer experience"]
  node_home["Menu home<br/>[page.js]"]
  node_menu_ui["Menu components"]
  node_product_page["Product details<br/>[page.js]"]
  node_cart_page["Cart page<br/>[page.js]"]
  node_cart_state["Cart state<br/>[cartSlice.js]"]
  node_orders_page["Order history<br/>[page.js]"]
  node_login_page["Login and signup<br/>[page.js]"]
  node_auth_state["Auth context<br/>[AuthContext.js]"]
end

subgraph group_api["Application APIs"]
  node_menu_api["Menu API<br/>[route.js]"]
  node_product_api["Product details API<br/>[route.js]"]
  node_rating_api["Rating API<br/>[route.js]"]
  node_auth_api["Auth APIs<br/>[route.js]"]
  node_signup_api["Signup API<br/>[route.js]"]
  node_orders_api["Orders API<br/>[route.js]"]
  node_payment_create["Create payment order<br/>[route.js]"]
  node_payment_verify["Verify payment<br/>[route.js]"]
end

subgraph group_admin["Admin operations"]
  node_admin_page["Admin console<br/>[page.jsx]"]
  node_listing_form["Listing form<br/>[page.jsx]"]
  node_admin_api["Admin listings API<br/>[route.js]"]
  node_admin_login_api["Admin login API<br/>[route.js]"]
end

subgraph group_domain["Data and services"]
  node_listing_model[("Menu listing model<br/>[NewListing.js]")]
  node_order_model[("Order model<br/>[Order.js]")]
  node_user_model[("User model<br/>[User.js]")]
  node_db["MongoDB connection<br/>[connect.js]"]
  node_jwt["JWT utilities<br/>[jwt.js]"]
  node_cloudinary["Cloudinary uploader<br/>[page.js]"]
end

node_shopper(("Shopper"))
node_admin_user(("Administrator"))

node_shopper -->|"browses"| node_home
node_home -->|"shows menu"| node_menu_ui
node_shopper -->|"views item"| node_product_page
node_shopper -->|"checks out"| node_cart_page
node_cart_page -->|"uses cart"| node_cart_state
node_shopper -->|"views orders"| node_orders_page
node_shopper -->|"signs in"| node_login_page
node_login_page -->|"stores session"| node_auth_state
node_home -.->|"loads menu"| node_menu_api
node_product_page -.->|"loads details"| node_product_api
node_product_page -.->|"submits review"| node_rating_api
node_login_page -.->|"logs in"| node_auth_api
node_login_page -.->|"creates account"| node_signup_api
node_cart_page -.->|"starts payment"| node_payment_create
node_payment_create -.->|"verifies payment"| node_payment_verify
node_cart_page -.->|"saves order"| node_orders_api
node_orders_page -.->|"fetches history"| node_orders_api
node_admin_user -->|"manages menu"| node_admin_page
node_admin_page -.->|"uses form"| node_listing_form
node_listing_form -.->|"submits listings"| node_admin_api
node_menu_api -->|"connects"| node_db
node_menu_api -->|"queries"| node_listing_model
node_product_api -->|"connects"| node_db
node_product_api -->|"finds item"| node_listing_model
node_rating_api -->|"connects"| node_db
node_rating_api -->|"updates rating"| node_listing_model
node_auth_api -->|"connects"| node_db
node_auth_api -->|"finds user"| node_user_model
node_auth_api -->|"signs token"| node_jwt
node_signup_api -->|"connects"| node_db
node_signup_api -->|"creates user"| node_user_model
node_signup_api -->|"signs token"| node_jwt
node_orders_api -->|"connects"| node_db
node_orders_api -->|"reads and writes"| node_order_model
node_admin_api -->|"connects"| node_db
node_admin_api -->|"manages listings"| node_listing_model
node_admin_api -->|"verifies admin"| node_jwt
node_admin_api -->|"uploads images"| node_cloudinary
node_admin_login_api -->|"creates token"| node_jwt

click node_home "https://github.com/rahulshamra/newpizza/blob/main/src/app/page.js"
click node_menu_ui "https://github.com/rahulshamra/newpizza/tree/main/src/components/home"
click node_product_page "https://github.com/rahulshamra/newpizza/blob/main/src/app/(routes)/%5Bid%5D/page.js"
click node_cart_page "https://github.com/rahulshamra/newpizza/blob/main/src/app/(routes)/cart/page.js"
click node_cart_state "https://github.com/rahulshamra/newpizza/blob/main/src/store/slices/cartSlice.js"
click node_orders_page "https://github.com/rahulshamra/newpizza/blob/main/src/app/(routes)/orders/page.js"
click node_login_page "https://github.com/rahulshamra/newpizza/blob/main/src/app/(routes)/login/page.js"
click node_auth_state "https://github.com/rahulshamra/newpizza/blob/main/src/store/AuthContext.js"
click node_admin_page "https://github.com/rahulshamra/newpizza/blob/main/src/app/(routes)/admin/page.jsx"
click node_listing_form "https://github.com/rahulshamra/newpizza/blob/main/src/components/newlistingform/page.jsx"
click node_menu_api "https://github.com/rahulshamra/newpizza/blob/main/src/app/api/menu/route.js"
click node_product_api "https://github.com/rahulshamra/newpizza/blob/main/src/app/api/productdetails/%5Bid%5D/route.js"
click node_rating_api "https://github.com/rahulshamra/newpizza/blob/main/src/app/api/rating/route.js"
click node_auth_api "https://github.com/rahulshamra/newpizza/blob/main/src/app/api/auth/login/route.js"
click node_signup_api "https://github.com/rahulshamra/newpizza/blob/main/src/app/api/auth/signup/route.js"
click node_orders_api "https://github.com/rahulshamra/newpizza/blob/main/src/app/api/orders/route.js"
click node_payment_create "https://github.com/rahulshamra/newpizza/blob/main/src/app/api/orders/payment/create_order/route.js"
click node_payment_verify "https://github.com/rahulshamra/newpizza/blob/main/src/app/api/orders/payment/verify/route.js"
click node_admin_api "https://github.com/rahulshamra/newpizza/blob/main/src/app/api/admin/listings/route.js"
click node_admin_login_api "https://github.com/rahulshamra/newpizza/blob/main/src/app/api/admin/login/route.js"
click node_listing_model "https://github.com/rahulshamra/newpizza/blob/main/src/models/NewListing.js"
click node_order_model "https://github.com/rahulshamra/newpizza/blob/main/src/models/Order.js"
click node_user_model "https://github.com/rahulshamra/newpizza/blob/main/src/models/User.js"
click node_db "https://github.com/rahulshamra/newpizza/blob/main/src/lib/db/connect.js"
click node_jwt "https://github.com/rahulshamra/newpizza/blob/main/src/lib/auth/jwt.js"
click node_cloudinary "https://github.com/rahulshamra/newpizza/blob/main/src/lib/Cloudinary/page.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_home,node_menu_ui,node_product_page,node_cart_page,node_cart_state,node_orders_page,node_login_page,node_auth_state toneBlue
class node_menu_api,node_product_api,node_rating_api,node_auth_api,node_signup_api,node_orders_api,node_payment_create,node_payment_verify toneAmber
class node_admin_page,node_listing_form,node_admin_api,node_admin_login_api toneMint
class node_listing_model,node_order_model,node_user_model,node_db,node_jwt,node_cloudinary toneRose
class node_shopper,node_admin_user toneIndigo
```

## Components

### Customer experience

- [Menu home](https://github.com/rahulshamra/newpizza/blob/main/src/app/page.js): `src/app/page.js`
- [Menu components](https://github.com/rahulshamra/newpizza/tree/main/src/components/home): `src/components/home`
- [Product details](https://github.com/rahulshamra/newpizza/blob/main/src/app/(routes)/%5Bid%5D/page.js): `src/app/(routes)/[id]/page.js`
- [Cart page](https://github.com/rahulshamra/newpizza/blob/main/src/app/(routes)/cart/page.js): `src/app/(routes)/cart/page.js`
- [Cart state](https://github.com/rahulshamra/newpizza/blob/main/src/store/slices/cartSlice.js): `src/store/slices/cartSlice.js`
- [Order history](https://github.com/rahulshamra/newpizza/blob/main/src/app/(routes)/orders/page.js): `src/app/(routes)/orders/page.js`
- [Login and signup](https://github.com/rahulshamra/newpizza/blob/main/src/app/(routes)/login/page.js): `src/app/(routes)/login/page.js`
- [Auth context](https://github.com/rahulshamra/newpizza/blob/main/src/store/AuthContext.js): `src/store/AuthContext.js`

### Application APIs

- [Menu API](https://github.com/rahulshamra/newpizza/blob/main/src/app/api/menu/route.js): `src/app/api/menu/route.js`
- [Product details API](https://github.com/rahulshamra/newpizza/blob/main/src/app/api/productdetails/%5Bid%5D/route.js): `src/app/api/productdetails/[id]/route.js`
- [Rating API](https://github.com/rahulshamra/newpizza/blob/main/src/app/api/rating/route.js): `src/app/api/rating/route.js`
- [Auth APIs](https://github.com/rahulshamra/newpizza/blob/main/src/app/api/auth/login/route.js): `src/app/api/auth/login/route.js`
- [Signup API](https://github.com/rahulshamra/newpizza/blob/main/src/app/api/auth/signup/route.js): `src/app/api/auth/signup/route.js`
- [Orders API](https://github.com/rahulshamra/newpizza/blob/main/src/app/api/orders/route.js): `src/app/api/orders/route.js`
- [Create payment order](https://github.com/rahulshamra/newpizza/blob/main/src/app/api/orders/payment/create_order/route.js): `src/app/api/orders/payment/create_order/route.js`
- [Verify payment](https://github.com/rahulshamra/newpizza/blob/main/src/app/api/orders/payment/verify/route.js): `src/app/api/orders/payment/verify/route.js`

### Admin operations

- [Admin console](https://github.com/rahulshamra/newpizza/blob/main/src/app/(routes)/admin/page.jsx): `src/app/(routes)/admin/page.jsx`
- [Listing form](https://github.com/rahulshamra/newpizza/blob/main/src/components/newlistingform/page.jsx): `src/components/newlistingform/page.jsx`
- [Admin listings API](https://github.com/rahulshamra/newpizza/blob/main/src/app/api/admin/listings/route.js): `src/app/api/admin/listings/route.js`
- [Admin login API](https://github.com/rahulshamra/newpizza/blob/main/src/app/api/admin/login/route.js): `src/app/api/admin/login/route.js`

### Data and services

- [Menu listing model](https://github.com/rahulshamra/newpizza/blob/main/src/models/NewListing.js): `src/models/NewListing.js`
- [Order model](https://github.com/rahulshamra/newpizza/blob/main/src/models/Order.js): `src/models/Order.js`
- [User model](https://github.com/rahulshamra/newpizza/blob/main/src/models/User.js): `src/models/User.js`
- [MongoDB connection](https://github.com/rahulshamra/newpizza/blob/main/src/lib/db/connect.js): `src/lib/db/connect.js`
- [JWT utilities](https://github.com/rahulshamra/newpizza/blob/main/src/lib/auth/jwt.js): `src/lib/auth/jwt.js`
- [Cloudinary uploader](https://github.com/rahulshamra/newpizza/blob/main/src/lib/Cloudinary/page.js): `src/lib/Cloudinary/page.js`

### Other components

- **Shopper**
- **Administrator**

## Connections

- Shopper → Menu home: browses (evidence: `README.md`)
- Menu home → Menu components: shows menu (evidence: `README.md`)
- Shopper → Product details: views item (evidence: `README.md`)
- Shopper → Cart page: checks out (evidence: `README.md`)
- Cart page → Cart state: uses cart (evidence: `README.md`)
- Shopper → Order history: views orders (evidence: `README.md`)
- Shopper → Login and signup: signs in (evidence: `README.md`)
- Login and signup → Auth context: stores session (evidence: `README.md`)
- Menu home → Menu API: loads menu
- Product details → Product details API: loads details
- Product details → Rating API: submits review
- Login and signup → Auth APIs: logs in
- Login and signup → Signup API: creates account
- Cart page → Create payment order: starts payment
- Create payment order → Verify payment: verifies payment
- Cart page → Orders API: saves order
- Order history → Orders API: fetches history
- Administrator → Admin console: manages menu (evidence: `README.md`)
- Admin console → Listing form: uses form
- Listing form → Admin listings API: submits listings
- Menu API → MongoDB connection: connects (evidence: `src/app/api/menu/route.js`)
- Menu API → Menu listing model: queries (evidence: `src/app/api/menu/route.js`)
- Product details API → MongoDB connection: connects (evidence: `src/app/api/productdetails/[id]/route.js`)
- Product details API → Menu listing model: finds item (evidence: `src/app/api/productdetails/[id]/route.js`)
- Rating API → MongoDB connection: connects (evidence: `src/app/api/rating/route.js`)
- Rating API → Menu listing model: updates rating (evidence: `src/app/api/rating/route.js`)
- Auth APIs → MongoDB connection: connects (evidence: `src/app/api/auth/login/route.js`)
- Auth APIs → User model: finds user (evidence: `src/app/api/auth/login/route.js`)
- Auth APIs → JWT utilities: signs token (evidence: `src/app/api/auth/login/route.js`)
- Signup API → MongoDB connection: connects (evidence: `src/app/api/auth/signup/route.js`)
- Signup API → User model: creates user (evidence: `src/app/api/auth/signup/route.js`)
- Signup API → JWT utilities: signs token (evidence: `src/app/api/auth/signup/route.js`)
- Orders API → MongoDB connection: connects (evidence: `src/app/api/orders/route.js`)
- Orders API → Order model: reads and writes (evidence: `src/app/api/orders/route.js`)
- Admin listings API → MongoDB connection: connects (evidence: `src/app/api/admin/listings/route.js`)
- Admin listings API → Menu listing model: manages listings (evidence: `src/app/api/admin/listings/route.js`)
- Admin listings API → JWT utilities: verifies admin (evidence: `src/app/api/admin/listings/route.js`)
- Admin listings API → Cloudinary uploader: uploads images (evidence: `src/app/api/admin/listings/route.js`)
- Admin login API → JWT utilities: creates token (evidence: `src/app/api/admin/login/route.js`)
