2.7 KiB
2.7 KiB
Implementer — F-013 Storefront shell (Next.js)
Summary
Implemented a dedicated Next.js storefront shell under project/storefront/ with TypeScript, React, Tailwind CSS, server-rendered home layout/navigation, and a typed public API client for backend catalog endpoints.
Code changes
- Added standalone frontend package:
project/storefront/package.jsonandpackage-lock.json. - Added Next.js config and TypeScript config:
project/storefront/next.config.tsproject/storefront/tsconfig.jsonproject/storefront/postcss.config.mjsproject/storefront/next-env.d.ts
- Added App Router shell:
project/storefront/src/app/layout.tsxproject/storefront/src/app/page.tsxproject/storefront/src/app/globals.cssproject/storefront/src/components/site-header.tsxproject/storefront/src/components/site-footer.tsx
- Added typed backend public API client:
project/storefront/src/lib/api.ts- Defines DTOs for public product/image payloads.
- Uses
GET /products/searchandGET /productos/:slug. - Uses
API_BASE_URLorNEXT_PUBLIC_API_BASE_URL, defaulting tohttp://localhost:3000. - Imports
server-onlyso the API client cannot be accidentally bundled into client components. - Does not import backend internals.
- Updated formatting/lint boundaries:
project/eslint.config.mjsignoresstorefront/**for backend lint.project/.prettierignoreignoresstorefront/for backend formatting; storefront has its own quality scripts.project/storefront/.prettierignoreignores generated Next files such asnext-env.d.tsand.next/.
UI behavior
- Home is a server component (
asyncpage, nouse client). - Layout includes navigation and footer.
- Home fetches a small product preview via the typed API client when backend is available.
- If backend is unavailable, home renders a graceful ready-state instead of failing build/runtime rendering.
Evidence
cd project/storefront && npm run lint— PASS.cd project/storefront && npm run typecheck— PASS.cd project/storefront && npm run 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.- QA correction run with
set -e: storefront lint/typecheck/build, storefront lint after build, backend lint/typecheck/test, and verify all PASS.
Notes
- New frontend dependencies are isolated to
project/storefront/package.json, includingserver-onlyto enforce server-side API access. - No catalog detail pages, category pages, cart UI, checkout UI, auth UI, or ISR catalog pages added.