Skip to content

Preview

Ask your codebase anything.

Try it right away on a sample repository, or paste a public GitHub repository and ask how something works. Answers cite the exact files and lines.

No sign-up needed. Pick a scenario and a question to see the answer, the files it cites and the path through the dependency graph. This sample uses predefined answers for a fictional repository.

Explore storefront-app

A small e-commerce app: product pages, a cart, and checkout.

storefront-app / main

app/products/[id]/page.tsx

import { notFound } from "next/navigation";
import { getProduct } from "@/lib/api/products";
import { ProductDetails } from "@/components/ProductDetails";
type Props = { params: Promise<{ id: string }> };
export default async function ProductPage({ params }: Props) {
const { id } = await params;
const product = await getProduct(id);
if (!product) {
notFound();
}
return <ProductDetails product={product} />;
}
Explanation

How does the product page retrieve and display product information?

The product page loads the product identifier from the route, requests the matching product through the API utility, and passes the returned data to the ProductDetails component for rendering.

  1. Awaits the route params and reads id.
  2. getProduct(id) calls apiFetch with a 60s revalidate window.
  3. apiFetch requests /api/products/:id and throws ApiError on non-2xx.
  4. The GET handler looks the product up and returns 404 when missing.
  5. findProductById selects one row from the products table.
  6. The page renders ProductDetails with the returned product.

Direct evidence

Inference

Follow up

Dependency graph: files in the current answer are lit

page.tsxProductDetails.tsxAddToCartButton.tsxapi/products.tsclient.tssession.ts[id]/route.tscart/route.tscheckout/route.tsserver/products.tscart.tscheckout.tsschema.tscart.test.tsapi-client.test.ts

Related files

Product route. Reads the id, loads the product, renders details.

Depends on