Prebit Developer Docs
Storefront Framework (Boron)

server/

Server-Component-first data fetching — the primary read path.

Plain async functions, safe in Server Components, generateMetadata(), and generateStaticParams(). No hooks for reads — Next.js App Router fetches data server-side, so that's what these do.

import {
  getProduct,
  getProducts,
  getProductRecommendations,
  getCollection,
  getCollections,
  getProductMetadata,
  getProductStaticParams,
  getCollectionStaticParams,
  productCacheTag,
  collectionCacheTag,
  NotFoundError,
} from "@prebit/boron/server";

getProduct(slug)

The rich detail shape — image gallery (media[]), variants[], options[], faqs[], customFields[], stock, description. Throws NotFoundError for a missing/inactive product.

import { getProduct, NotFoundError } from "@prebit/boron/server";
import { notFound } from "next/navigation";

const product = await getProduct(slug).catch((err) => {
  if (err instanceof NotFoundError) return null;
  throw err;
});
if (!product) notFound();

getProducts({ page, limit }) / getProductRecommendations(slug, { limit })

Grid-card fields only (name, price, imageUrl, slug, vendorName, productType) — a deliberately different, lighter TypeScript type than getProduct's return value. Don't force the two shapes to match.

getCollection(slug)

Collection metadata with its products already embedded — again in the grid-card shape, not full product detail.

getCollections({ page, limit })

List of collections (no embedded products in the list form).

Cache tags — precise revalidation

import { productCacheTag, collectionCacheTag } from "@prebit/boron/server";
import { revalidateTag } from "next/cache";

revalidateTag(productCacheTag(slug), "max");

Every getProduct/getCollection fetch is tagged with productCacheTag(slug)/collectionCacheTag(slug) internally — call revalidateTag() with the same tag-builder to invalidate exactly the page that changed, not a full rebuild.

No real trigger wired up yet

A storefront isn't a registered Partner API app (no OAuth client, no webhookEndpointUrl), so it can't receive the same catalog.product.updated.v1 webhook deliveries a real installed Partner app gets. prebit-template-store's /api/revalidate route demonstrates revalidateTag() working, but you have to call it yourself today (a deploy hook, a cron, a manual trigger) until Prebit has a storefront-specific revalidation mechanism.

Next.js 16's revalidateTag() requires a cache-life profile as its second argument ("max", "default", etc.) — a real API change from earlier Next versions, not optional.

getProductMetadata(product)

Returns a Next.js Metadata object (title/description/openGraph) ready to return from generateMetadata().

getProductStaticParams() / getCollectionStaticParams()

Paginate through every slug — feed straight into generateStaticParams() if you want a given page to be statically generated/ISR'd instead of the template's default force-dynamic.

trackPageView(request)

A proxy.ts (Next.js 16's renamed middleware.ts) helper — page-view and session tracking. See the Analytics page for why this runs in the proxy instead of as a direct browser call, and how it pairs with client/'s <AnalyticsProvider>.

On this page