3.6 KiB
3.6 KiB
Implementer — F-014 Storefront catalog pages (SSG/ISR)
Summary
Implemented storefront catalog pages for product detail, category listing, brand listing and search results using Next.js App Router server components, ISR, per-page metadata/OpenGraph, typed public API client functions and on-demand revalidation.
Code changes
- Extended backend public search filter:
project/src/modules/catalog/domain/product.tsaddscategorySlugto search criteria.project/src/modules/catalog/application/product-use-cases.tsforwardscategorySlug.project/src/modules/catalog/api/catalog.routes.tsaccepts/logscategorySlugon/products/search.project/src/modules/catalog/infrastructure/pg-product-search-repository.tsfilters products by category slug through public catalog/category tables.project/src/modules/catalog/tests/product-use-cases.test.tscovers forwardingbrandSlugandcategorySlugthrough the search port.
- Extended storefront API client:
project/storefront/src/lib/api.tsaddsCategoryDto,BrandDto,getCategoryBySlug,getBrandBySlug,listCategoryTree, andcategorySlugsearch input.project/storefront/src/lib/seo.tscentralizes site URL/title helpers.
- Added catalog UI:
project/storefront/src/components/product-card.tsx.project/storefront/src/app/productos/[slug]/page.tsxproduct detail route.project/storefront/src/app/categoria/[slug]/page.tsxcategory listing route.project/storefront/src/app/marca/[slug]/page.tsxbrand listing route.project/storefront/src/app/products/search/page.tsxsearch results route.
- Added on-demand revalidation:
project/storefront/src/app/api/revalidate/route.tsvalidatesREVALIDATE_SECRETwithtimingSafeEqual, accepts supported catalog paths only, and callsrevalidatePath.
Rendering/SEO behavior
- Product/category/brand pages export
revalidate = 300andgenerateStaticParams() { return []; }, allowing SSG/ISR generation without requiring a live backend at build time. - Search page exports
revalidate = 120. - Search page bounds displayed/metadata query text to 200 characters before rendering or metadata generation.
- Product/category/brand/search pages export
generateMetadatawith title, description, canonical URL and OpenGraph data. - Product page uses
/productos/<slug>and never exposes internal ids in the URL. - All pages are server components; no client components added.
Evidence
cd project/storefront && npm run lint— PASS.cd project/storefront && npm run typecheck— PASS.cd project/storefront && npm run build— PASS; Next output shows SSG routes for/productos/[slug],/categoria/[slug],/marca/[slug]and dynamic/products/searchplus/api/revalidate.cd project/storefront && npm run lintafter build — PASS.cd project && npm run lint— PASS.cd project && npm run typecheck— PASS.cd project && npm test— PASS: 17 files passed, 7 skipped; 64 passed, 33 skipped../scripts/verify.sh— PASS.- Internal review correction run: bounded search query text in search page, then storefront lint/typecheck/build/lint, backend lint/typecheck/test and verify all reran and passed.
- Security correction run: revalidation secret comparison changed to timing-safe comparison, then storefront lint/typecheck/build/lint, backend lint/typecheck/test and verify all reran and passed.
Notes
- Lighthouse tooling is not installed; SEO score criterion is evidenced structurally: SSR/SSG pages, semantic content, metadata/OpenGraph, canonical URLs and no client JavaScript added for these pages.
- No cart or checkout UI added.