How leonardondev/dev-store works
Dev Store is a Next.js storefront for browsing featured products, viewing product details, searching the catalog, and adding items to a client-side cart. The main journey runs from the store UI through a shared API client to product endpoints backed by local JSON data; product pages can then add products to cart state. The source index and excerpts support the UI and API relationships shown, but do not verify the client’s HTTP routing to individual endpoints, so those links are marked unverified.
Main entry points: api.ts API Client · data.json Catalog Data · page.tsx Featured Home · header.tsx Store Header
Components 19
Storefront UI
- Store Layout
src/app/(store)/layout.tsx - Featured Home
src/app/(store)/(home)/page.tsx - Product Detail
src/app/(store)/product/[slug]/page.tsx - Search Results
src/app/(store)/search/page.tsx - Store Header
src/components/header.tsx - Search Form
src/components/search-form.tsx - Loading Skeleton
src/components/skeleton.tsx
Catalog API
- Featured Products
src/app/api/products/featured/route.ts - Product Lookup
src/app/api/products/[slug]/route.ts - Product Search API
src/app/api/products/search/route.ts - Product Listing API
src/app/api/products/route.ts - Catalog Data
src/app/api/data.json
Cart State
- Cart Provider
src/context/cart-context.tsx - Add to Cart
src/components/add-to-cart-button.tsx - Cart Widget
src/components/cart-widget.tsx
Data Access
- API Client
src/data/api.ts - API Environment
src/env.ts - Product Types
src/data/types/products.ts
Other components
- Shopper
Connections 23
- Shopper → Featured Home: browses
- Store Layout → Store Header: renders
src/app/(store)/layout.tsx - Store Layout → Cart Provider: provides cart
src/app/(store)/layout.tsx - Store Header → Search Form: renders
src/components/header.tsx - Store Header → Cart Widget: renders
src/components/header.tsx - Featured Home → API Client: requests featured
src/app/(store)/(home)/page.tsx - Product Detail → API Client: requests product
src/app/(store)/product/[slug]/page.tsx - Search Results → API Client: requests results
src/app/(store)/search/page.tsx - API Client → API Environment: reads endpoint
src/data/api.ts - API Client → Featured Products: HTTP request
- API Client → Product Lookup: HTTP request
- API Client → Product Search API: HTTP request
- API Client → Product Listing API: HTTP request
- Featured Products → Catalog Data: reads products
src/app/api/products/featured/route.ts - Product Lookup → Catalog Data: finds product
src/app/api/products/[slug]/route.ts - Product Search API → Catalog Data: filters products
src/app/api/products/search/route.ts - Product Listing API → Catalog Data: reads products
src/app/api/products/route.ts - Product Detail → Add to Cart: renders
src/app/(store)/product/[slug]/page.tsx - Add to Cart → Cart Provider: updates cart
src/components/add-to-cart-button.tsx - Cart Widget → Cart Provider: reads cart
src/components/cart-widget.tsx - Shopper → Search Form: submits query
src/components/search-form.tsx - Search Results → Loading Skeleton: shows loading
- Featured Home → Loading Skeleton: shows loading