How arafat-shaikh/food-app-nextjs works
NextEat is a food-ordering application: customers browse and filter food listings, open an item, add it to a cart, choose a delivery address, pay through Stripe, and view order history. The graph separates browsing, cart and address management, checkout, and account/order capabilities, with Prisma as the shared persistence layer. API and client excerpts support the shown request and payment paths; several page loaders and API routes are unsampled, so their internal wiring is not inferred.
Main entry points: prismadb.ts Prisma database · CartClientPage.tsx Cart page · checkout/route.ts Checkout API · cart/route.ts Cart API
Components 23
Food browsing
- Home page
app/page.tsx - Catalog filters
app/components/HomeClient.tsx - Listing queries
app/actions/getFoodListings.ts - Item page
app/item/[itemId]/ItemPageClient.tsx - Item lookup
app/actions/getItemById.ts
Cart and delivery
- Cart page
app/cart/CartClientPage.tsx - Cart API
app/api/cart/route.ts - Cart query
app/actions/getCartItems.ts - Address API
app/api/user/address/route.ts - Address query
app/actions/getUserAddress.ts - Address dialog
app/components/UserAddressModal.tsx
Checkout and payment
- Checkout API
app/api/user/checkout/route.ts - Stripe client
app/libs/stripe.ts - Stripe
- Payment webhook
app/api/webhook/route.ts
Accounts and orders
- Order history
app/order/OrdersClientPage.tsx - Order query
app/actions/getAllOrders.ts - Order API
app/api/user/order/[orderId]/route.ts - Registration API
app/api/register/route.ts - Authentication
pages/api/auth/[...nextauth].ts
Application runtime
- Current user
app/actions/getCurrentUser.ts - Prisma database
app/libs/prismadb.ts
Other components
- Customer
Connections 28
- Customer → Home page: opens
- Home page → Catalog filters: renders
- Catalog filters → Listing queries: displays listings
- Customer → Item page: opens item
- Item page → Cart API: adds item
- Customer → Cart page: opens cart
- Cart page → Cart API: updates cart
- Cart page → Address API: selects address
- Cart page → Checkout API: starts checkout
- Cart page → Order API: deletes canceled order
- Address dialog → Address API: submits address
- Customer → Order history: views orders
- Customer → Registration API: registers
- Customer → Authentication: authenticates
- Cart API → Current user: gets user
- Address API → Current user: gets user
- Checkout API → Current user: gets user
- Order API → Current user: gets user
- Cart API → Prisma database: reads and writes cart
- Address API → Prisma database: reads and writes addresses
- Registration API → Prisma database: creates user
- Checkout API → Prisma database: creates order
- Checkout API → Stripe client: creates session
- Stripe client → Stripe: calls API
- Stripe → Payment webhook: sends event
- Payment webhook → Stripe client: verifies event
- Payment webhook → Prisma database: marks order paid
- Order API → Prisma database: deletes order