How caoh29/petshop works
PetShop is a Next.js ecommerce application for pet supplies. Shoppers browse and search products, manage a cart, provide delivery and payment details, and view orders; administrators manage products, orders, and users. The code map also includes authentication, reviews, Stripe payment callbacks, and scheduled order/stock maintenance. The index documents the action-module exports and sampled pages identify some component calls. Most action implementations and route pages were not sampled, so their internal calls and storage behavior are not asserted.
Main entry points: index.ts Action Exports · db.ts Prisma Client · [category]/page.tsx Catalog Pages · search/page.tsx Search Page
Components 34
Storefront
- Catalog Pages
src/app/(shop)/[category]/page.tsx - Search Page
src/app/(shop)/search/page.tsx - Home Page
src/app/(shop)/page.tsx - Product Card
src/app/components/ProductCard.tsx - Product Grid
src/app/components/GridSection.tsx - Product Filters
src/app/components/ProductFilters.tsx - Product Sorting
src/app/components/SortDropdown.tsx - Pagination
src/app/components/Pagination.tsx - Featured Products
src/app/components/FeaturedProductsSection.tsx - Button UI
src/app/components/ui/button.tsx - Checkbox UI
src/app/components/ui/checkbox.tsx
Cart & Orders
- Cart Page
src/app/(shop)/cart/page.tsx - Checkout Page
src/app/(shop)/checkout/page.tsx - Checkout Form
src/app/components/CheckoutSection.tsx - Order Pages
src/app/(shop)/orders/page.tsx - Product Reviews
src/app/components/Reviews.tsx
Identity & Admin
- Authentication
src/auth.ts - Admin Pages
src/app/(shop)/admin/page.tsx
Application Services
- Action Exports
src/app/api/actions/index.ts - Product Actions
src/app/api/actions/products/index.ts - Cart Actions
src/app/api/actions/cart/index.ts - Checkout Actions
src/app/api/actions/checkout/index.ts - Order Actions
src/app/api/actions/orders/index.ts - Admin Actions
src/app/api/actions/admin/index.ts - Review Actions
src/app/api/actions/reviews/index.ts - Payment Webhook
src/app/api/webhooks/payments/route.ts - Order Maintenance
src/app/api/cron/cancel-pending-orders/route.ts - Stock Reserve Release
src/app/api/cron/release-reserves/route.ts
State & Persistence
- Redux Store
src/store/store.ts - Cart State
src/store/slices/cart/index.ts - Prisma Client
prisma/db.ts - PostgreSQL
Other components
- Shopper
- Stripe
Connections 35
- Shopper → Home Page: browses
README.md - Catalog Pages → Product Filters: renders
src/app/(shop)/[category]/page.tsx - Catalog Pages → Product Sorting: renders
src/app/(shop)/[category]/page.tsx - Catalog Pages → Product Grid: renders
src/app/(shop)/[category]/page.tsx - Catalog Pages → Pagination: renders
src/app/(shop)/[category]/page.tsx - Search Page → Product Filters: renders
src/app/(shop)/search/page.tsx - Search Page → Product Sorting: renders
src/app/(shop)/search/page.tsx - Search Page → Product Grid: renders
src/app/(shop)/search/page.tsx - Search Page → Pagination: renders
src/app/(shop)/search/page.tsx - Product Grid → Product Card: renders
src/app/components/GridSection.tsx - Home Page → Featured Products: renders
src/app/(shop)/page.tsx - Featured Products → Product Card: renders
src/app/components/FeaturedProductsSection.tsx - Checkout Page → Checkout Form: renders
src/app/(shop)/checkout/page.tsx - Checkout Page → Action Exports: loads user data
src/app/(shop)/checkout/page.tsx - Order Pages → Pagination: renders
src/app/(shop)/orders/page.tsx - Authentication → Prisma Client: uses
src/auth.ts - Authentication → PostgreSQL: accesses
README.md - Action Exports → Product Actions: exports
src/app/api/actions/index.ts - Action Exports → Cart Actions: exports
src/app/api/actions/index.ts - Action Exports → Checkout Actions: exports
src/app/api/actions/index.ts - Action Exports → Order Actions: exports
src/app/api/actions/index.ts - Action Exports → Admin Actions: exports
src/app/api/actions/index.ts - Action Exports → Review Actions: exports
src/app/api/actions/index.ts - Redux Store → Cart State: registers
src/store/store.ts - Checkout Form → Redux Store: uses state
src/app/components/CheckoutSection.tsx - Checkout Page → Cart Actions: invokes via exports
- Checkout Page → Checkout Actions: invokes via exports
- Payment Webhook → Prisma Client: uses
src/app/api/webhooks/payments/route.ts - Order Maintenance → Prisma Client: uses
src/app/api/cron/cancel-pending-orders/route.ts - Stock Reserve Release → Prisma Client: uses
src/app/api/cron/release-reserves/route.ts - Prisma Client → PostgreSQL: connects
- Payment Webhook → Stripe: handles payment events
- Checkout Form → Stripe: processes payment
README.md - Product Filters → Checkbox UI: uses
src/app/components/ProductFilters.tsx - Product Sorting → Button UI: uses
src/app/components/SortDropdown.tsx