Skip to content

Ecommerce · React · Featured

Ecommerce storefront

A product catalog with category filters and search, product detail view, and a cart kept in local state.
Ecommerce storefront starter, as built from its own files
Starter screenshot captured from this template's own build at 1440×900. It shows the template as it ships, not output generated from a prompt.

What you get

Catalog, product detail and cart screens driven by a typed in-memory product list. The cart is persisted to localStorage through a small hook, quantities can be adjusted inline, and the checkout form is explicitly a placeholder: it records the order locally and tells you where to plug in Stripe or Razorpay on the server.

Files, exactly as copied.

Exactly what is copied into a new project: 14 files, nothing generated.

Raw data: GET /api/v1/templates/vite-react-storefront

src/App.tsx
src/App.tsx
import { useMemo, useState } from "react";import { categories, formatPrice, products, type Product } from "./products";import { useCart } from "./cart";import { Cart } from "./Cart";import { ProductArt } from "./ProductArt"; type View = { kind: "catalog" } | { kind: "product"; id: string } | { kind: "cart" }; export default function App() {  const [view, setView] = useState<View>({ kind: "catalog" });  const [category, setCategory] = useState<(typeof categories)[number]>("All");  const [query, setQuery] = useState("");  const cart = useCart();   const visible = useMemo(    () => products.filter((p) => (category === "All" || p.category === category) && p.name.toLowerCase().includes(query.toLowerCase())),    [category, query],  );   return (    <div className="min-h-screen bg-stone-50 text-stone-900">      <div className="bg-stone-900 px-4 py-2 text-center text-xs text-stone-300">Sample catalog · prices in USD · checkout is a placeholder</div>      <header className="sticky top-0 z-10 border-b border-stone-200 bg-white/90 backdrop-blur">        <div className="mx-auto flex max-w-6xl items-center justify-between gap-4 px-4 py-3.5 sm:px-6">          <button type="button" onClick={() => setView({ kind: "catalog" })} className="flex items-center gap-2 text-lg font-semibold tracking-tight">            <span className="grid h-8 w-8 place-items-center rounded-full bg-stone-900 text-sm text-white">N</span>            Northwind Goods          </button>          <nav className="hidden items-center gap-6 text-sm text-stone-600 md:flex" aria-label="Shop">            {categories.slice(1).map((c) => (              <button key={c} type="button" onClick={() => { setCategory(c); setView({ kind: "catalog" }); }} className="hover:text-stone-900">                {c}              </button>            ))}          </nav>          <button type="button" onClick={() => setView({ kind: "cart" })} className="flex items-center gap-2 rounded-full border border-stone-200 bg-white px-4 py-2 text-sm font-medium shadow-sm hover:bg-stone-50" aria-label={"Open cart, " + cart.count + " items"}>            <svg viewBox="0 0 24 24" className="h-4 w-4" fill="none" stroke="currentColor" strokeWidth={1.8} aria-hidden="true">              <path d="M6 6h15l-1.5 9h-12zM6 6L5 3H2M9 20a1 1 0 100-2 1 1 0 000 2zM18 20a1 1 0 100-2 1 1 0 000 2z" strokeLinecap="round" strokeLinejoin="round" />            </svg>            Cart            <span className="grid h-5 min-w-5 place-items-center rounded-full bg-stone-900 px-1.5 text-[11px] text-white">{cart.count}</span>          </button>        </div>      </header>       <main className="mx-auto max-w-6xl px-4 py-8 sm:px-6">        {view.kind === "cart" ? (          <Cart cart={cart} onBack={() => setView({ kind: "catalog" })} />        ) : view.kind === "product" ? (          <ProductDetail product={products.find((p) => p.id === view.id)} onAdd={cart.add} onBack={() => setView({ kind: "catalog" })} />        ) : (          <>            <section className="grid items-center gap-8 overflow-hidden rounded-3xl bg-gradient-to-br from-amber-100 via-orange-50 to-rose-100 px-8 py-10 md:grid-cols-[1.1fr_1fr]">              <div>                <p className="text-xs font-semibold uppercase tracking-[0.18em] text-orange-700">Spring collection</p>                <h1 className="mt-3 text-4xl font-semibold tracking-tight sm:text-5xl">Considered goods for desk, home and trail.</h1>                <p className="mt-4 max-w-md text-stone-600">A small catalog to start from. Swap in your products, photos and prices.</p>              </div>              <div className="grid grid-cols-3 gap-3">                {["p1", "p3", "p5"].map((id, i) => (                  <ProductArt key={id} id={id} className={"aspect-[3/4] rounded-2xl shadow-lg shadow-orange-900/10 " + (i === 1 ? "-translate-y-4" : "translate-y-2")} />                ))}              </div>            </section>             <div className="mt-10 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">              <div className="flex flex-wrap gap-2" role="group" aria-label="Filter by category">                {categories.map((c) => (                  <button                    key={c}                    type="button"                    onClick={() => setCategory(c)}                    aria-pressed={category === c}                    className={"rounded-full border px-4 py-1.5 text-sm transition " + (category === c ? "border-stone-900 bg-stone-900 text-white" : "border-stone-200 bg-white hover:border-stone-300")}                  >                    {c}                  </button>                ))}              </div>              <input value={query} onChange={(e) => setQuery(e.target.value)} placeholder="Search products" aria-label="Search products" className="rounded-full border border-stone-200 bg-white px-4 py-2 text-sm outline-none focus:border-stone-400 sm:w-64" />            </div>            {visible.length === 0 ? (              <div className="mt-10 rounded-2xl border border-dashed border-stone-300 p-10 text-center">                <p className="font-medium">No products match your search.</p>                <button type="button" onClick={() => { setQuery(""); setCategory("All"); }} className="mt-3 text-sm text-orange-700 underline">                  Clear filters                </button>              </div>            ) : (              <ul className="mt-6 grid gap-6 sm:grid-cols-2 lg:grid-cols-3">                {visible.map((p) => (                  <li key={p.id} className="group flex flex-col rounded-2xl border border-stone-200 bg-white p-3 transition hover:shadow-lg hover:shadow-stone-900/5">                    <button type="button" onClick={() => setView({ kind: "product", id: p.id })} className="block overflow-hidden rounded-xl" aria-label={"View " + p.name}>                      <ProductArt id={p.id} className="aspect-[4/3] transition duration-500 group-hover:scale-[1.03]" />                    </button>                    <div className="flex items-start justify-between gap-3 px-1 pt-4">                      <div>                        <h2 className="font-medium">{p.name}</h2>                        <p className="text-sm text-stone-500">{p.category}</p>                      </div>                      <span className="font-semibold">{formatPrice(p.price)}</span>                    </div>                    <div className="mt-auto flex gap-2 px-1 pb-1 pt-4">                      <button type="button" onClick={() => setView({ kind: "product", id: p.id })} className="flex-1 rounded-xl border border-stone-200 px-3 py-2 text-sm hover:bg-stone-50">                        Details                      </button>                      <button type="button" onClick={() => cart.add(p.id)} className="flex-1 rounded-xl bg-stone-900 px-3 py-2 text-sm font-medium text-white hover:bg-stone-700">                        Add to cart                      </button>                    </div>                  </li>                ))}              </ul>            )}          </>        )}      </main>    </div>  );} function ProductDetail({ product, onAdd, onBack }: { product: Product | undefined; onAdd: (id: string) => void; onBack: () => void }) {  if (!product) {    return (      <div>        <p>Product not found.</p>        <button type="button" onClick={onBack} className="mt-4 text-sm text-orange-700">          Back to catalog        </button>      </div>    );  }  return (    <article className="grid gap-10 md:grid-cols-2">      <ProductArt id={product.id} className="aspect-square rounded-3xl" />      <div className="py-4">        <button type="button" onClick={onBack} className="text-sm text-orange-700">          ← Back to catalog        </button>        <p className="mt-6 text-xs font-semibold uppercase tracking-[0.18em] text-stone-500">{product.category}</p>        <h1 className="mt-2 text-4xl font-semibold tracking-tight">{product.name}</h1>        <p className="mt-4 text-lg leading-relaxed text-stone-600">{product.description}</p>        <p className="mt-8 text-3xl font-semibold">{formatPrice(product.price)}</p>        <button type="button" onClick={() => onAdd(product.id)} className="mt-6 rounded-xl bg-stone-900 px-6 py-3 text-sm font-medium text-white hover:bg-stone-700">          Add to cart        </button>      </div>    </article>  );}

Remix

Remix this template.

Describe what to change and the agent starts from Ecommerce storefront's files. The box is already started for you: finish “Start from Ecommerce storefront and …”

Agent ready

Creates a free account first; your idea is carried over.

Dependencies

Documented from the template's package.json. The runtime has a prebuilt dependency set for Vite + React + TypeScript, so installs are fast.

  • react^19.1.0
  • react-dom^19.1.0
  • vite^6.3.0
  • @vitejs/plugin-react^4.4.0
  • tailwindcss^4.1.0
  • @tailwindcss/vite^4.1.0
  • typescript^5.8.0

How it runs

Framework
Vite + React + TypeScript
Dev command
npm run dev
Build command
npm run build
Output directory
dist
Port
5173
Entry route
/

Projects run in an isolated sandbox with a live preview. Read the projects documentation for settings, snapshots and deployment.

All templates

Build on Ecommerce storefront

Create a free account, start from this template, and ask the AI agent to turn it into your app.