Skip to content

Add shop microfrontend demo (bedroom-furniture theme)#1

Open
tim123abc wants to merge 14 commits intomainfrom
tim123abc/furniture-demo
Open

Add shop microfrontend demo (bedroom-furniture theme)#1
tim123abc wants to merge 14 commits intomainfrom
tim123abc/furniture-demo

Conversation

@tim123abc
Copy link
Copy Markdown
Collaborator

Summary

  • Adds an 8-app Next.js 16 microfrontend storefront alongside the existing host/remote lab demo (lab demo unchanged).
  • Demonstrates vertical MFEs (shell, home, beds, pdp, checkout, sale) and horizontal remotes (header, footer) composed via remote-components under a single edge proxy on port 3025.
  • Product imagery is rendered as CSS gradients — no external image hosts or assets to manage.

Layout

App Port Pattern Route(s)
shell 3000 Default /api/*, fallback
header 3001 Horizontal /components/header
footer 3002 Horizontal /components/footer
home 3003 Vertical /
beds 3004 Vertical /beds, /mattresses
pdp 3005 Vertical /product/:id
checkout 3006 Vertical /checkout
sale 3008 Vertical /sale, /sale/:category

Plus shared packages: @shop/ui, @shop/api-client, @shop/tsconfig.

Root scripts

  • pnpm devdev:shop (the new 8-app demo, proxy at :3025)
  • pnpm dev:lab → existing host + remote demo (proxy at :3024, unchanged)
  • pnpm typecheck:lab / pnpm typecheck:shop

Test plan

  • pnpm install succeeds
  • pnpm dev:shop boots all 8 apps + proxy
  • /, /beds, /beds/:subcategory, /mattresses, /mattresses/:subcategory, /sale, /sale/:category, /product/:id, /checkout all return 200
  • /api/products and /api/cart return JSON
  • pnpm dev:lab still boots the original host/remote unchanged
  • pnpm typecheck:lab and pnpm typecheck:shop pass

🤖 Generated with Claude Code

Adds an 8-app Next.js 16 microfrontend storefront alongside the
existing host/remote lab demo. Demonstrates vertical MFEs (one app
per route) and horizontal remotes (header/footer composed via
remote-components) under a single edge proxy.

- shell (default), header + footer (horizontal), home, beds,
  mattresses, pdp, checkout, sale (vertical)
- Shared @shop/ui, @shop/api-client, @shop/tsconfig packages
- Product imagery rendered as CSS gradients (no external image hosts)
- Root scripts split into dev:lab / dev:shop; lab demo unchanged

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
vc-runtime-lab-app-remote Error Error May 7, 2026 5:16pm
vc-runtime-lab-host Error Error May 7, 2026 5:16pm
vc-runtime-lab-pages-remote Error Error May 7, 2026 5:16pm

Request Review

@socket-security
Copy link
Copy Markdown

socket-security Bot commented May 7, 2026

@tim123abc tim123abc marked this pull request as ready for review May 7, 2026 11:52
- Add 13 product/hero JPGs to shop-shell's public/products/. Other zones
  reference them as /products/*.jpg — the microfrontends edge routes
  unrouted paths to shop-shell (the default app), so a single copy of
  the assets serves every zone.
- Switch product cards from next/image to plain <img> so the request
  goes through the proxy instead of each zone's own image optimizer.
- Route remote-component fetches through the proxy: apps/beds/app/layout
  now uses relative `/components/header` (was `${HEADER_URL}/...`).
- Refactor CartSummary's server-side /api/cart fetch to derive the
  absolute URL from the current request via headers(), so the request
  rides the proxy regardless of which zone rendered it. Drops the
  NEXT_PUBLIC_SHELL_URL dependency on the server path.
- Mark the six host layouts as `force-dynamic` so the cloud build skips
  prerendering pages that would otherwise try to fetch unreachable
  remote components at build time.
- Track .vercel-link .gitignore files added by `vercel link`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
On wide monitors the PDP main-image area was stretching to ~2000px
because the [1fr 400px] grid had no max-width on its container.
Cap the page width at 1280px on PDP, BedsPage, MattressesPage,
SalePage, and CheckoutPage so the image grid and PDP gallery render
at a sensible size. HomePage hero stays full-bleed.

Also add `block` to the <Link> wrappers in ProductGrid and SalePage
cards — the Link's anchor element renders inline by default, which
let the cards' aspect-square boxes blow out of their grid cells.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Checkout: clicking Checkout now switches to a generated "Order
  placed" success view with a fake order number. Button is disabled
  while the cart is empty.
- PDP: drop the placeholder "Choose Your Size" button and the Finish
  swatch picker — both were inherited from the jewelry demo and made
  no sense for furniture, neither was wired to anything. Removes the
  unused FINISH_OPTIONS constant and selectedFinish state.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
tim123abc and others added 3 commits May 7, 2026 16:02
0.3.7 didn't rewrite TURBOPACK_CHUNK_LISTS to a per-scope global, so
remote chunks pushed into the host's registry and Next 16's
dev-backend-dom registerChunk crashed with
"chunkListsToRegister.forEach is not a function".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
localStorage-backed store in api-client/cart.ts with subscribe events.
Header CartBadge shows live count, PDP Add to Bag actually adds,
MiniCart and CheckoutPage read/write the shared store, cart clears on
order placed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Move the eight shop microfrontend apps under apps/shop/ and the two
React-host lab apps (Vite host + Next remote) under apps/react-host/.
Update pnpm-workspace.yaml to apps/*/*, fix codeLinks paths in the
host examples, and refresh the README workspace tree.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The skeleton used a half-width 50/50 grid with no max-width, while the
loaded page is capped at 1280px and uses a 1fr/400px split with a 72px
thumbnail rail. On wide viewports the image collapsed by ~230px and
shifted horizontally when the product loaded. Mirror the loaded shape
(container, grid, thumbnails, info rows) so the layout stays put.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Move api-client, ui, and tsconfig from the root packages/ into
apps/shop/packages/ — they're consumed only by shop apps, so keeping
them next to those apps gives better locality (rm -rf apps/shop drops
the whole demo). Update pnpm-workspace.yaml globs and the README tree.

Also delete the design-reference/ folder of mockup PNGs (~5.5MB)
that's no longer needed now that the demo is built.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The Vercel Blob upload helper was a one-off used to populate the
product image manifest; not needed in the repo anymore.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The shop apps used plain <img> tags so the browser fetched images
straight through the microfrontends proxy from shell's public/. Switching
to next/image breaks that — each app's _next/image optimizer fetches the
source from its own origin to optimize, but the files only existed in
shell.

Convert the seven uses (home heroes, sale/beds/pdp/checkout cards,
PDP main + thumbnail rail, MiniCart and CheckoutPage line items) to
next/image with appropriate fill/sizes/priority props, and copy the
needed product images into each consuming app's public/ so the
optimizer can resolve them.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
remote-components/dist/config/nextjs.js gates its Turbopack code path
on process.env.TURBOPACK. next dev --turbo propagates that env var,
but next build (which uses Turbopack as the bundler in Next 16) never
sets it. Without it, the config falls through to the webpack branch,
the #remote-components/remote/defaults/app alias is never registered,
the dynamic import in app-client.js fails inside its try/catch, and
no TURBOPACK_REMOTE_SHARED marker ends up in the remote bundle. The
host then can't dedupe shared modules, so the remote ships its own
copy of React and useContext crashes the page.

Set TURBOPACK=1 in each shop app's build script so the marker is
emitted. Also bump to 0.4.3 (latest) — only chunk hashes changed,
but worth staying current.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The shell-prefix form `TURBOPACK=1 next build` in package.json scripts
doesn't reliably propagate through Vercel's build runner, so the env
var is now also set as a Vercel project env var. Declare it in turbo.json's
build.env so cache keys reflect it and globalPassThroughEnv so it reaches
the task process.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant