Every order placed through the app moves through a defined lifecycle — from initial processing to final delivery. Customers can monitor this journey from their My Orders page, while restaurant admins drive each status transition from the admin dashboard. The Verify page bridges the gap between Stripe’s payment redirect and the order being confirmed in the database.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/bhavnesh7781/Food-Delivery-App/llms.txt
Use this file to discover all available pages before exploring further.
Order Lifecycle
Orders progress through three statuses, stored as plain strings in MongoDB:Food Processing
The default status assigned when an order is first created. The kitchen has received the order and is preparing the food.
My Orders Page (Customer)
The/myorders route renders the MyOrders component. On mount (and whenever the token value changes), it calls POST /api/order/userorders — with the JWT token in the request header — to fetch all orders belonging to the logged-in user.
| Field | Source |
|---|---|
| Item list | item.name + " x " + item.quantity for every item, comma-separated |
| Total amount | Rs.<order.amount>.00 |
| Item count | Items: <order.items.length> |
| Status badge | order.status — one of the three lifecycle values |
fetchOrders to pull the latest status on demand.
Order Data Model
Order documents in MongoDB follow this Mongoose schema (frombackend/models/orderModel.js):
| Field | Type | Required | Default |
|---|---|---|---|
userId | String | ✅ | — |
items | Array | ✅ | — |
amount | Number | ✅ | — |
address | Object | ✅ | — |
status | String | ❌ | "Food Processing" |
date | Date | ❌ | Date.now() |
payment | Boolean | ❌ | false |
Example Order Object
Admin Order Management
The admin/orders page calls GET /api/order/list on mount to fetch every order across all users. Each order card shows:
- Ordered items (name × quantity, comma-separated)
- Customer full name (
address.firstName + " " + address.lastName) - Delivery address (street, city, state, country, zipcode)
- Customer phone number
- Item count
- Order total
<select> dropdown lets the admin transition an order to any of the three lifecycle states. Changing the dropdown fires:
POST /api/order/status on the backend, which runs findByIdAndUpdate to persist the new status, then the admin page refreshes its order list.
Verify Page (Payment Callback)
After Stripe redirects the customer back to the app, the/verify route handles the result. The page reads success and orderId from the URL query string and immediately calls POST /api/order/verify:
- Payment confirmed (
success=true) → the order’spaymentfield is set totrueand the user is sent to/myorders - Payment cancelled (
success=false) → the order document is deleted from MongoDB and the user is redirected to the home page