Welcome to the Jose Madrid Salsa developer docs — explore features, APIs, and deployment guides.
Jose Madrid SalsaJMS Docs

Product Catalog

Product catalog with categories, heat levels, filtering, search, comparison, and quick view for the Jose Madrid Salsa storefront

Product Catalog

The product catalog powers the public storefront, admin product management, and the Shopify sync pipeline. Products support categories, heat levels, nutritional info, compare-at pricing, and tag-based organization.

Architecture

page.tsx
products-client.tsx
product-card.tsx
product-grid.tsx
product-comparison.tsx
product-recommendations.tsx
quick-view-modal.tsx
heat-gauge.tsx

Data Model

Each product record includes:

FieldTypeDescription
namestringDisplay name
slugstringURL-safe identifier
skustringStock keeping unit
priceDecimalCurrent price
compareAtPriceDecimal?Original price for sale badges
heatLevelenumMILD, MEDIUM, HOT, EXTRA_HOT
inventoryintUnits in stock
featuredImagestring?Primary image URL
ingredientsstring[]Ingredient list
nutritionalInfoJSON?Calories, sodium, fat, carbs, etc.
isFeaturedbooleanShow on homepage
isActivebooleanVisible in storefront
categoryIdstring?FK to Category

Product Card

The ProductCard component (components/store/product-card.tsx) renders each product with:

  • Featured and % OFF badges computed from compareAtPrice
  • Heat level badge with color coding via getHeatLevelColor()
  • Out of stock indicator when inventory <= 0
  • Low stock warning when inventory <= 5
  • Quick view modal (eye icon on hover) with full details and add-to-cart
  • Wishlist toggle (heart icon, requires authentication)
  • Comparison toggle (scale icon, max 4 products)
// Product interface used by ProductCard
interface Product {
  id: string
  name: string
  slug: string
  description: string | null
  price: number
  compareAtPrice?: number | null
  featuredImage: string | null
  heatLevel: string
  sku: string
  inventory: number
  isFeatured: boolean
  ingredients: string[] | null
  nutritionalInfo?: { calories: number; sodiumMg: number; ... } | null
}

The products page (app/(public)/products/page.tsx) is a server component that accepts URL search params:

ParamDescription
categoryFilter by category slug
heatLevelFilter by heat level
searchFull-text search
viewgrid or list layout

The server component calls getProducts() from lib/db/products.ts with these filters, then passes results to the ProductsClient component for interactive filtering and view toggling.

Search params are async in Next.js 15+. The page awaits searchParams before passing them to the query layer.

Product Comparison

Users can compare up to 4 products side-by-side using the comparison store (lib/store/comparison.ts). The comparison panel shows:

  • Price differences
  • Heat level comparison
  • Ingredient lists
  • Nutritional info (when available)
  • Weight and dimensions

Admin Product Management

Admin users manage products at /admin/products with CRUD operations, image upload via UploadThing, category assignment, and inventory adjustments. Product changes can optionally sync to Shopify via lib/shopify/sync.ts.

How is this guide?

Edit on GitHub

Last updated on

On this page