How satvikpraveen/nextjs-ecommerce works
This is a Next.js storefront and admin application. Customers discover and filter products, add items to a persistent cart, check out through Stripe, and view their orders; administrators manage products, inventory, and orders. The internal server layer separates product/order queries from cart, checkout, and order actions, with Prisma as the database access point. The graph uses README capabilities and the supplied source index; unsampled routes and integrations are included only where documented or their references are indexed.
Main entry points: checkout.ts Checkout actions · products.ts Product queries · orders.ts Order history · prisma.ts PostgreSQL via Prisma
Components 21
Storefront
- Home page
app/page.tsx - Catalog and search
app/(store)/products/page.tsx - Product detail
app/(store)/products/[slug]/page.tsx - Product cards and grid
components/product-grid.tsx - Cart experience
app/(store)/cart/page.tsx - Account orders
app/(account)/orders/page.tsx - Newsletter subscription
app/api/newsletter/route.ts
Commerce
- Product queries
server/queries/products.ts - Cart actions
server/actions/cart.ts - Checkout
components/checkout/checkout-form.tsx - Checkout actions
server/actions/checkout.ts - Stripe routes
app/api/stripe/create-checkout/route.ts - Order history
server/queries/orders.ts - PostgreSQL via Prisma
lib/prisma.ts
Identity
- Authentication
lib/auth.ts - Auth routes
app/api/auth/[...nextauth]/route.ts
Admin operations
- Admin dashboard
app/admin/products/page.tsx - Inventory management
app/admin/inventory/page.tsx - Order management
app/admin/orders/page.tsx
Other components
- Shopper
- Stripe
Connections 25
- Shopper → Home page: browses
- Home page → Product queries: loads featured items
app/page.tsx - Home page → Product cards and grid: renders products
app/page.tsx - Catalog and search → Product queries: queries catalog
app/(store)/products/page.tsx - Catalog and search → Product cards and grid: renders results
app/(store)/products/page.tsx - Product detail → Product queries: loads product
app/(store)/products/[slug]/page.tsx - Product cards and grid → Cart experience: adds products
- Shopper → Cart experience: manages cart
- Cart experience → Cart actions: updates cart
app/(store)/cart/page.tsx - Shopper → Checkout: checks out
- Checkout → Checkout actions: submits checkout
- Checkout actions → Stripe: creates payment session
server/actions/checkout.ts - Stripe routes → Checkout actions: dispatches checkout
app/api/stripe/create-checkout/route.ts - Checkout actions → Cart actions: uses cart actions
server/actions/checkout.ts - Checkout actions → Order history: fulfills purchase
- Account orders → Order history: loads order history
app/(account)/orders/page.tsx - Auth routes → Authentication: configures authentication
- Authentication → PostgreSQL via Prisma: reads and writes users
lib/auth.ts - Admin dashboard → Product queries: loads products
app/admin/products/page.tsx - Inventory management → Inventory management: loads inventory
app/admin/inventory/page.tsx - Order management → Order history: loads orders
app/admin/orders/page.tsx - Shopper → Newsletter subscription: subscribes
- Product queries → PostgreSQL via Prisma: queries products
server/queries/products.ts - Order history → PostgreSQL via Prisma: queries orders
server/queries/orders.ts - Newsletter subscription → PostgreSQL via Prisma: persists subscription
app/api/newsletter/route.ts