<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Rasmus</title>
    <description>The latest articles on DEV Community by Rasmus (@rsoe).</description>
    <link>https://dev.to/rsoe</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4123592%2Fc913cda8-f484-4dc6-832d-32aeb76855c4.png</url>
      <title>DEV Community: Rasmus</title>
      <link>https://dev.to/rsoe</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rsoe"/>
    <language>en</language>
    <item>
      <title>How to Build a Custom Ecommerce Store with Thor Commerce and AI</title>
      <dc:creator>Rasmus</dc:creator>
      <pubDate>Sun, 13 Sep 2026 21:27:58 +0000</pubDate>
      <link>https://dev.to/rsoe/how-to-build-a-custom-ecommerce-store-with-thor-commerce-and-ai-2786</link>
      <guid>https://dev.to/rsoe/how-to-build-a-custom-ecommerce-store-with-thor-commerce-and-ai-2786</guid>
      <description>&lt;p&gt;Building a custom ecommerce storefront used to mean choosing between two uncomfortable options: start from a rigid template, or spend months rebuilding catalog, pricing, inventory, cart, checkout, and customer logic from scratch.&lt;/p&gt;

&lt;p&gt;Headless commerce changes that tradeoff. You keep a purpose-built commerce backend, but your storefront remains ordinary application code that you can shape around your brand and buying journey.&lt;/p&gt;

&lt;p&gt;In this tutorial, you will create a working custom storefront with &lt;a href="https://thorcommerce.io/" rel="noopener noreferrer"&gt;Thor Commerce&lt;/a&gt;, its open-source &lt;a href="https://github.com/thor-commerce/next-thor-storefront" rel="noopener noreferrer"&gt;Next.js storefront&lt;/a&gt;, and an AI coding agent such as Claude Code, Codex, or Cursor. You do not need to ask the agent to invent checkout logic. Instead, it works inside a typed, documented foundation that already covers product discovery, market-aware pricing, carts, checkout, payments, orders, and customer accounts.&lt;/p&gt;

&lt;p&gt;By the end, you will have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A local Next.js storefront connected to your Thor project&lt;/li&gt;
&lt;li&gt;Products and prices resolved for the correct market&lt;/li&gt;
&lt;li&gt;A persistent cart and checkout flow&lt;/li&gt;
&lt;li&gt;A safe workflow for customizing the storefront with an AI coding agent&lt;/li&gt;
&lt;li&gt;A clear path to production deployment&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What is Thor Commerce?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://thorcommerce.io/" rel="noopener noreferrer"&gt;Thor Commerce&lt;/a&gt; is a headless commerce platform for B2B, DTC, and hybrid businesses. Thor manages the commerce engine—catalog, contextual pricing, inventory, customers, carts, checkout, and orders—while you control the customer experience.&lt;/p&gt;

&lt;p&gt;The separation is straightforward:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;Admin API&lt;/strong&gt; is the control plane for trusted, server-side operations such as managing products, prices, inventory, stores, channels, customers, discounts, and orders.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;Storefront API&lt;/strong&gt; powers buyer-facing product discovery, cart, checkout, and customer account flows.&lt;/li&gt;
&lt;li&gt;Your &lt;strong&gt;storefront&lt;/strong&gt; decides how those capabilities look and feel across web, mobile, portals, and other channels.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Both APIs are GraphQL. Your application selects only the data it needs, and generated TypeScript types keep the storefront aligned with the schema.&lt;/p&gt;

&lt;p&gt;Thor also resolves commerce in context. The same product can have different availability and pricing depending on the store, country, currency, price channel, customer identity, or customer group. That is especially useful when a business sells DTC and B2B from one catalog.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fn9a408ve0rehr4ydc0vx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fn9a408ve0rehr4ydc0vx.png" alt="Thor Commerce Admin product catalog showing status, variants, inventory, and publications" width="800" height="379"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Thor Admin brings product status, variants, inventory, and publications into one catalog view.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Thor Commerce works well with AI coding agents
&lt;/h2&gt;

&lt;p&gt;AI coding agents are most useful when they have strong boundaries and a reliable source of truth. Ecommerce is too important for an agent to guess how totals, stock, payments, or permissions work.&lt;/p&gt;

&lt;p&gt;Thor gives the agent four useful guardrails:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Typed GraphQL contracts.&lt;/strong&gt; Operation names, inputs, nullability, and error types can be checked against the Admin or Storefront schema.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Task-oriented documentation.&lt;/strong&gt; The &lt;a href="https://docs.thorcommerce.io/guides" rel="noopener noreferrer"&gt;Thor developer guides&lt;/a&gt; describe prerequisites, ordered steps, expected outcomes, and recovery behavior.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Agent-ready sources.&lt;/strong&gt; Thor publishes an &lt;a href="https://docs.thorcommerce.io/llms.txt" rel="noopener noreferrer"&gt;&lt;code&gt;llms.txt&lt;/code&gt;&lt;/a&gt; index and Markdown versions of its docs. The starter also includes &lt;code&gt;AGENTS.md&lt;/code&gt; plus Thor API skills that coding agents can read before changing commerce operations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A working reference implementation.&lt;/strong&gt; The starter already demonstrates the correct boundaries for credentials, request context, cart persistence, GraphQL documents, and generated types.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The result is a better division of labor: you describe the experience and business outcome; the agent reads the relevant contract, changes the code, and proves the result with lint, build, and browser checks.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you will build
&lt;/h2&gt;

&lt;p&gt;We will start from Thor's reference storefront rather than an empty folder. It uses:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Next.js 16 and React 19&lt;/li&gt;
&lt;li&gt;TypeScript and typed GraphQL documents&lt;/li&gt;
&lt;li&gt;React Server Components and Server Actions&lt;/li&gt;
&lt;li&gt;Country-prefixed, multi-market routing&lt;/li&gt;
&lt;li&gt;Product listings, product details, variants, categories, collections, sorting, and filters&lt;/li&gt;
&lt;li&gt;Cookie-backed carts&lt;/li&gt;
&lt;li&gt;Custom and hosted checkout options&lt;/li&gt;
&lt;li&gt;Stripe and manual payment flows&lt;/li&gt;
&lt;li&gt;Customer registration, login, sessions, and account pages&lt;/li&gt;
&lt;li&gt;OpenNext configuration for Cloudflare Workers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is a reference implementation, not a locked theme. The commerce plumbing is present, but the components, CSS, routes, queries, and buying journey remain yours to change.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F08n0rm55x3svtspoucmk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F08n0rm55x3svtspoucmk.png" alt="Thor Commerce product variant manager showing SKUs and active variants" width="800" height="379"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A product can expose multiple active variants while Thor keeps SKU and status explicit.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;You need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Node.js 20.9 or newer&lt;/li&gt;
&lt;li&gt;&lt;a href="https://pnpm.io/" rel="noopener noreferrer"&gt;pnpm&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Git&lt;/li&gt;
&lt;li&gt;A &lt;a href="https://thorcommerce.io/" rel="noopener noreferrer"&gt;Thor Commerce&lt;/a&gt; project with Storefront API access&lt;/li&gt;
&lt;li&gt;A configured store and at least one published, priced variant&lt;/li&gt;
&lt;li&gt;An AI coding agent that can read and edit a local repository&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If your Thor project is empty, follow the guides to &lt;a href="https://docs.thorcommerce.io/guides/catalog/configure-store" rel="noopener noreferrer"&gt;configure a store&lt;/a&gt; and &lt;a href="https://docs.thorcommerce.io/guides/catalog/create-product" rel="noopener noreferrer"&gt;create and publish a product&lt;/a&gt; first. Product content, variants, price, inventory, activation, and publication are separate pieces of sellability, so verify the full sequence before debugging the storefront.&lt;/p&gt;

&lt;p&gt;Use a development project and test payment method while building. Keep all credential values in environment files or your hosting provider's secret store—never paste production secrets into an AI prompt.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Create your storefront
&lt;/h2&gt;

&lt;p&gt;Create a repository from the &lt;a href="https://github.com/new?template_name=next-thor-storefront&amp;amp;template_owner=thor-commerce" rel="noopener noreferrer"&gt;GitHub template&lt;/a&gt;, or clone the public reference directly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/thor-commerce/next-thor-storefront.git
&lt;span class="nb"&gt;cd &lt;/span&gt;next-thor-storefront
pnpm &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Before prompting your coding agent, ask it to read &lt;code&gt;AGENTS.md&lt;/code&gt;. That file directs it to the included Thor Admin and Storefront API skills, which explain how to discover and validate the GraphQL schema.&lt;/p&gt;

&lt;p&gt;A useful first prompt is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Read AGENTS.md and the relevant Thor Commerce Storefront API skill before making changes.
Then map the repository for me: explain where product queries, product pages, cart actions,
checkout, customer authentication, market configuration, and generated GraphQL types live.
Do not change any files yet.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This gives you a quick architectural tour and makes the agent establish the right context before it writes code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Connect the storefront to Thor Commerce
&lt;/h2&gt;

&lt;p&gt;Copy the example environment file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cp&lt;/span&gt; .env.example .env
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add your project values:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;THOR_PROJECT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"your-project-slug"&lt;/span&gt;
&lt;span class="nv"&gt;THOR_STOREFRONT_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"your-storefront-token"&lt;/span&gt;
&lt;span class="nv"&gt;BETTER_AUTH_SECRET&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"generate-a-new-secret"&lt;/span&gt;
&lt;span class="nv"&gt;BETTER_AUTH_URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"http://localhost:3000"&lt;/span&gt;
&lt;span class="nv"&gt;NEXT_SERVER_ACTIONS_ENCRYPTION_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"generate-a-new-persistent-key"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use the project slug from your Thor project URL. A store ID is a resource inside that project; it is not the project slug.&lt;/p&gt;

&lt;p&gt;The storefront token is sent server-side as &lt;code&gt;X-Thor-Storefront-Token&lt;/code&gt;. Do not use an Admin API key here, do not expose a private value with a &lt;code&gt;NEXT_PUBLIC_&lt;/code&gt; prefix, and do not commit &lt;code&gt;.env&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Next, edit &lt;code&gt;src/lib/thorcommerce/config.ts&lt;/code&gt; and replace the example market configuration with your real:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Country codes&lt;/li&gt;
&lt;li&gt;Default country&lt;/li&gt;
&lt;li&gt;Thor store IDs&lt;/li&gt;
&lt;li&gt;Currencies&lt;/li&gt;
&lt;li&gt;Store and market mappings&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Keep this context consistent throughout catalog, cart, and checkout requests. A product can exist in Admin and still be absent from a storefront when its publication, store, channel, price, currency, country, or inventory context does not match.&lt;/p&gt;

&lt;p&gt;If you want the agent to help, be explicit about the boundary:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Configure this storefront for Denmark and Germany using the store IDs and currencies already
present in my local environment configuration. Read the Thor Next.js storefront guide first.
Keep secrets server-side, do not invent missing IDs, and show me the exact files you plan to edit.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 3: Generate the typed GraphQL client and run the app
&lt;/h2&gt;

&lt;p&gt;Generate TypeScript types from the GraphQL documents:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pnpm codegen
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then start the development server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pnpm dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open &lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt;. The middleware should redirect to a country-prefixed route such as &lt;code&gt;/dk&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You should see products from the store configured for that market. Open a product, select a variant, and add it to the cart. Refresh the page and confirm the cart persists.&lt;/p&gt;

&lt;p&gt;If the catalog is empty, do not replace IDs until something appears. Ask the agent to trace the request context and check each layer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;The Thor storefront returns no products for /dk. Diagnose this without changing data first.
Verify the project slug, Storefront token, store ID, country, currency, price channel,
product and variant status, publication window, price, and purchase availability.
Show the evidence for the first failing layer.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That prompt is intentionally diagnostic. It prevents a coding agent from hiding a configuration problem behind a UI workaround.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Customize the design
&lt;/h2&gt;

&lt;p&gt;The storefront groups code by commerce domain, so you can change one experience without searching the entire repository:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;What you want to change&lt;/th&gt;
&lt;th&gt;Start here&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Product queries&lt;/td&gt;
&lt;td&gt;&lt;code&gt;src/lib/thorcommerce/storefront/queries/products.graphql&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Product listing and detail UI&lt;/td&gt;
&lt;td&gt;&lt;code&gt;src/features/products&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cart state and actions&lt;/td&gt;
&lt;td&gt;&lt;code&gt;src/features/cart&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Checkout steps&lt;/td&gt;
&lt;td&gt;&lt;code&gt;src/features/checkout&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Customer accounts&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;src/features/account&lt;/code&gt; and &lt;code&gt;src/lib/auth.ts&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Market routing&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;src/lib/thorcommerce/config.ts&lt;/code&gt;, &lt;code&gt;src/lib/request-context.ts&lt;/code&gt;, and &lt;code&gt;src/middleware.ts&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Shared UI&lt;/td&gt;
&lt;td&gt;&lt;code&gt;src/components&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;You can now give the coding agent a visual and behavioral brief. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Redesign the product listing and product detail pages for a minimal Scandinavian homeware brand.
Keep the existing Thor Commerce data flow, variant selection, market-aware prices, availability,
and add-to-cart behavior intact. Use the existing CSS Modules and accessible components.
Do not add mock commerce data. Verify the result at mobile and desktop widths.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The important phrase is “keep the existing data flow intact.” A redesign should not move credentials into the browser or replace calculated backend values with frontend guesses.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Add a custom commerce feature
&lt;/h2&gt;

&lt;p&gt;Suppose you want to display a structured material specification on product pages and make it available to filters or integrations. Thor supports typed metafields for named, validated custom data.&lt;/p&gt;

&lt;p&gt;Ask the agent to start with the contract rather than a guessed field:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;I want products to have a public, typed material specification that appears on the product page.
Read Thor's metafields documentation and inspect the Admin and Storefront schemas.
Propose the metafield definition, explain how its value is assigned through the product update input,
add the Storefront GraphQL selection, regenerate types, and render it accessibly.
Use only a development project. Stop if the required owner type or field is not in the schema.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why this works:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The agent has a specific outcome.&lt;/li&gt;
&lt;li&gt;It knows which API controls configuration and which API serves buyers.&lt;/li&gt;
&lt;li&gt;It must verify the live contract before writing an operation.&lt;/li&gt;
&lt;li&gt;It updates the source &lt;code&gt;.graphql&lt;/code&gt; document and runs &lt;code&gt;pnpm codegen&lt;/code&gt; instead of editing generated files.&lt;/li&gt;
&lt;li&gt;It has a concrete UI verification target.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After any GraphQL selection changes, rerun:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pnpm codegen
pnpm lint
pnpm build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 6: Test cart and checkout as commerce flows
&lt;/h2&gt;

&lt;p&gt;Cart and checkout deserve more than a visual spot-check. Thor calculates prices, discounts, stock, shipping eligibility, tax, and totals against the current commerce context.&lt;/p&gt;

&lt;p&gt;Your storefront should render the returned cart state, not independently calculate what the customer owes. After a cart mutation, use the latest returned or refetched cart because several values can change together.&lt;/p&gt;

&lt;p&gt;Give your coding agent an outcome-based test brief:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Verify one complete test purchase in this storefront. Use an existing sellable variant and the
configured test payment method. Confirm variant selection, add to cart, quantity update,
cart persistence after refresh, shipping method selection, payment, order completion,
and the resulting order in Thor Admin. Report evidence for each step and any untested dependency.
Do not use production credentials or a live payment method.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Also test failure paths: out-of-stock variants, stale carts, rejected discount codes, unavailable shipping methods, payment cancellation, and expired customer sessions. A storefront is production-ready only when recovery paths are understandable to buyers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 7: Deploy
&lt;/h2&gt;

&lt;p&gt;Before deployment, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pnpm lint
pnpm build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The starter includes OpenNext and Wrangler configuration for Cloudflare Workers, including R2-backed incremental caching. Review the resource names, bindings, secrets, country detection, and build scripts before deploying. A cloned configuration does not provision production infrastructure automatically.&lt;/p&gt;

&lt;p&gt;If you deploy to another Next.js-compatible platform, adapt platform-specific country detection in &lt;code&gt;src/middleware.ts&lt;/code&gt;. The &lt;code&gt;CF-IPCountry&lt;/code&gt; header is specific to Cloudflare.&lt;/p&gt;

&lt;p&gt;Whichever platform you choose, verify:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Production environment variables are stored as secrets&lt;/li&gt;
&lt;li&gt;Store and market IDs point to the intended Thor project&lt;/li&gt;
&lt;li&gt;Payment, tax, and shipping configuration use the correct environment&lt;/li&gt;
&lt;li&gt;Authentication callbacks use the production origin&lt;/li&gt;
&lt;li&gt;Cart, sign-in, market switching, and a test order work after deployment&lt;/li&gt;
&lt;li&gt;Logging and monitoring do not expose tokens or customer data&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  A repeatable workflow for AI-assisted commerce development
&lt;/h2&gt;

&lt;p&gt;The best prompts follow a simple loop:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;State the outcome.&lt;/strong&gt; Describe the buyer or operator behavior you want.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Name the surface.&lt;/strong&gt; Say whether it belongs in the Storefront, an Admin integration, or an embedded app.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Point to authoritative context.&lt;/strong&gt; Ask the agent to read &lt;code&gt;AGENTS.md&lt;/code&gt;, the focused Thor guide, and the relevant GraphQL schema.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Set boundaries.&lt;/strong&gt; Identify the development environment and forbid invented IDs, schema fields, secrets, and mock data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Require verification.&lt;/strong&gt; Ask for changed files, commands run, observed behavior, and untested dependencies.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is more reliable than asking an agent to “build an ecommerce site” in one enormous prompt. The agent handles bounded implementation tasks while Thor remains the source of truth for commerce behavior.&lt;/p&gt;

&lt;h2&gt;
  
  
  What can you build with Thor Commerce?
&lt;/h2&gt;

&lt;p&gt;Because storefront presentation is decoupled from the commerce core, the same foundation can support:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;DTC storefronts with custom brand experiences&lt;/li&gt;
&lt;li&gt;B2B portals with customer-group pricing and account-specific buying flows&lt;/li&gt;
&lt;li&gt;Hybrid B2B and DTC commerce using one catalog&lt;/li&gt;
&lt;li&gt;Multi-market and multi-currency storefronts&lt;/li&gt;
&lt;li&gt;Product discovery with categories, collections, search, sorting, and facets&lt;/li&gt;
&lt;li&gt;Custom checkout, hosted checkout, or a mix of both&lt;/li&gt;
&lt;li&gt;Customer account areas and order history&lt;/li&gt;
&lt;li&gt;ERP, PIM, fulfillment, email, and payment integrations through APIs and webhooks&lt;/li&gt;
&lt;li&gt;Embedded operational apps inside the Thor dashboard&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can begin with the reference storefront, then replace the visual system and extend one feature at a time without rebuilding the underlying commerce engine.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Is Thor Commerce headless?
&lt;/h3&gt;

&lt;p&gt;Yes. Thor provides Admin and Storefront GraphQL APIs while your frontend remains a separate application. You control the framework, design system, routes, content, and interaction model.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I use Claude Code with Thor Commerce?
&lt;/h3&gt;

&lt;p&gt;Yes. You can use Claude Code or another repository-aware coding agent. The Thor storefront includes &lt;code&gt;AGENTS.md&lt;/code&gt; and portable API skills, and the documentation provides agent-friendly Markdown sources. The same safety rule applies to every agent: keep credentials in the application's secret environment, not in prompts.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does the starter support B2B ecommerce?
&lt;/h3&gt;

&lt;p&gt;It provides the foundation for B2B, DTC, and hybrid experiences, including contextual pricing, customer-aware flows, markets, carts, checkout, and accounts. Your final B2B experience may add business-specific approval, purchasing, or account UI on top of those primitives.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I build a custom checkout?
&lt;/h3&gt;

&lt;p&gt;Yes. The starter includes checkout UI for customer details, shipping, gateway selection, Stripe payments, manual payments, and order completion. Thor can also provide a hosted checkout URL when that is a better fit.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I deploy somewhere other than Cloudflare?
&lt;/h3&gt;

&lt;p&gt;Yes. The storefront uses standard Next.js patterns. Cloudflare configuration is included, but you can adapt the project for another compatible platform.&lt;/p&gt;

&lt;h3&gt;
  
  
  Is the starter production-ready?
&lt;/h3&gt;

&lt;p&gt;It is a working reference implementation and a strong starting point. Before launch, review your market, payment, tax, shipping, authentication, security, observability, performance, and accessibility requirements.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start building
&lt;/h2&gt;

&lt;p&gt;Thor Commerce gives your coding agent something valuable: a real commerce model, typed API contracts, focused documentation, and a working storefront to extend.&lt;/p&gt;

&lt;p&gt;Start with the &lt;a href="https://github.com/thor-commerce/next-thor-storefront" rel="noopener noreferrer"&gt;Thor Commerce Next.js storefront&lt;/a&gt;, connect it to a development project, and make one verified improvement at a time.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://thorcommerce.io/" rel="noopener noreferrer"&gt;Explore Thor Commerce&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.thorcommerce.io/" rel="noopener noreferrer"&gt;Read the documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/thor-commerce/next-thor-storefront" rel="noopener noreferrer"&gt;Open the Next.js storefront&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.thorcommerce.io/guides/ai-agents" rel="noopener noreferrer"&gt;Learn how to build with an AI agent&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ecommerce</category>
      <category>webdev</category>
      <category>nextjs</category>
    </item>
  </channel>
</rss>
